From: John L. Hammond Date: Thu, 1 May 2014 21:26:41 +0000 (-0500) Subject: LU-4961 lustre: remove liblustre.h and obd.h from userspace X-Git-Tag: 2.5.59~31 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=281671b5ee43c2aea5d5b708aadf10fd1df45b16;hp=82d485c9b47a2eb15784ccbfca9d656aff81f518 LU-4961 lustre: remove liblustre.h and obd.h from userspace In lustre/tests/ and lustre/utils/ replace inclusion of liblustre.h and obd.h with libcfs/libcfs.h and lustre/lustre_idl.h. In obd.h raise a preprocessod error if being compiled in userspace. Replace the contents of liblustre.h with a single preprocessor error moving what few functions were still in use to their files of use. Signed-off-by: John L. Hammond Change-Id: I778b3207ce561d8adef6f7ecbbc899654c23b9d6 Reviewed-on: http://review.whamcloud.com/10194 Tested-by: Jenkins Reviewed-by: Bob Glossman Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Robert Read --- diff --git a/libcfs/include/libcfs/user-prim.h b/libcfs/include/libcfs/user-prim.h index ec121d6..ceef624 100644 --- a/libcfs/include/libcfs/user-prim.h +++ b/libcfs/include/libcfs/user-prim.h @@ -122,6 +122,9 @@ void cond_resched(void); static inline void schedule(void) {} static inline void schedule_timeout(int64_t t) {} +static inline void set_current_state(int state) +{ +} /* * Lproc diff --git a/libcfs/libcfs/fail.c b/libcfs/libcfs/fail.c index 3d1d3a0..4315bb3 100644 --- a/libcfs/libcfs/fail.c +++ b/libcfs/libcfs/fail.c @@ -33,11 +33,7 @@ * Lustre is a trademark of Oracle Corporation, Inc. */ -#ifndef __KERNEL__ -#include -#else #include -#endif unsigned long cfs_fail_loc = 0; unsigned int cfs_fail_val = 0; diff --git a/lustre/include/liblustre.h b/lustre/include/liblustre.h index 815b96b..2fb7cce 100644 --- a/lustre/include/liblustre.h +++ b/lustre/include/liblustre.h @@ -38,417 +38,4 @@ * User-space Lustre headers. */ -#ifndef LIBLUSTRE_H__ -#define LIBLUSTRE_H__ - -/** \defgroup liblustre liblustre - * - * @{ - */ -#include -#include -#include - -#ifdef __KERNEL__ -#error Kernel files should not #include -#endif - -#include -#include - -/* definitions for liblustre */ - -#ifdef __CYGWIN__ - -#define loff_t long long -#define ERESTART 2001 -typedef unsigned short umode_t; - -#endif - -#ifndef page_private -#define page_private(page) ((page)->private) -#define set_page_private(page, v) ((page)->private = (v)) -#endif - -/* bits ops */ - -/* a long can be more than 32 bits, so use BITS_PER_LONG - * to allow the compiler to adjust the bit shifting accordingly - */ - -static inline int ext2_set_bit(int nr, void *addr) -{ -#if __BYTE_ORDER == __BIG_ENDIAN - return set_bit((nr ^ ((BITS_PER_LONG - 1) & ~0x7)), addr); -#else - return set_bit(nr, addr); -#endif -} - -static inline int ext2_clear_bit(int nr, void *addr) -{ -#if __BYTE_ORDER == __BIG_ENDIAN - return clear_bit((nr ^ ((BITS_PER_LONG - 1) & ~0x7)), addr); -#else - return clear_bit(nr, addr); -#endif -} - -static inline int ext2_test_bit(int nr, const void *addr) -{ -#if __BYTE_ORDER == __BIG_ENDIAN - const unsigned char *tmp = addr; - return (tmp[nr >> 3] >> (nr & 7)) & 1; -#else - return test_bit(nr, addr); -#endif -} - -/* module initialization */ -extern int init_obdclass(void); -extern int ptlrpc_init(void); -extern int ldlm_init(void); -extern int osc_init(void); -extern int lov_init(void); -extern int mdc_init(void); -extern int lmv_init(void); -extern int mgc_init(void); - -/* general stuff */ - -#ifndef min -#define min(x,y) ((x)<(y) ? (x) : (y)) -#endif - -#ifndef max -#define max(x,y) ((x)>(y) ? (x) : (y)) -#endif - -#ifndef min_t -#define min_t(type,x,y) \ - ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; }) -#endif -#ifndef max_t -#define max_t(type,x,y) \ - ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; }) -#endif - -#define simple_strtol strtol - -#ifdef HZ -#undef HZ -#endif -#define HZ 1 - -/* random */ - -void cfs_get_random_bytes(void *ptr, int size); - -/* memory */ - -/* memory size: used for some client tunables */ -#define totalram_pages (256 * 1024) /* 1GB */ -#define NUM_CACHEPAGES totalram_pages - - -/* VFS stuff */ -#define ATTR_MODE 0x0001 -#define ATTR_UID 0x0002 -#define ATTR_GID 0x0004 -#define ATTR_SIZE 0x0008 -#define ATTR_ATIME 0x0010 -#define ATTR_MTIME 0x0020 -#define ATTR_CTIME 0x0040 -#define ATTR_ATIME_SET 0x0080 -#define ATTR_MTIME_SET 0x0100 -#define ATTR_FORCE 0x0200 /* Not a change, but a change it */ -#define ATTR_ATTR_FLAG 0x0400 -#define ATTR_RAW 0x0800 /* file system, not vfs will massage attrs */ -#define ATTR_FROM_OPEN 0x1000 /* called from open path, ie O_TRUNC */ -#define ATTR_CTIME_SET 0x2000 -#define ATTR_BLOCKS 0x4000 -#define ATTR_KILL_SUID 0 -#define ATTR_KILL_SGID 0 -#define ATTR_FILE 0 - -struct iattr { - unsigned int ia_valid; - umode_t ia_mode; - uid_t ia_uid; - gid_t ia_gid; - loff_t ia_size; - time_t ia_atime; - time_t ia_mtime; - time_t ia_ctime; - unsigned int ia_attr_flags; -}; - -/* defined in kernel header include/linux/namei.h */ -#define INTENT_MAGIC 0x19620323 - -struct lustre_intent_data { - int it_disposition; - int it_status; - __u64 it_lock_handle; - int it_lock_mode; - int it_remote_lock_mode; - __u64 it_remote_lock_handle; - void *it_data; - - unsigned int it_lock_set:1; -}; - -struct lookup_intent { - int it_magic; - void (*it_op_release)(struct lookup_intent *); - int it_op; - int it_create_mode; - __u64 it_flags; - union { - struct lustre_intent_data lustre; - } d; -}; - -static inline int it_disposition(const struct lookup_intent *it, int flag) -{ - return it->d.lustre.it_disposition & flag; -} - -static inline void it_set_disposition(struct lookup_intent *it, int flag) -{ - it->d.lustre.it_disposition |= flag; -} - -static inline void it_clear_disposition(struct lookup_intent *it, int flag) -{ - it->d.lustre.it_disposition &= ~flag; -} - -#undef LL_TASK_CL_ENV -#define LL_TASK_CL_ENV cl_env - -struct task_struct { - int state; - char comm[32]; - int uid; - int gid; - int pid; - int fsuid; - int fsgid; - int max_groups; - int ngroups; - gid_t *groups; - void *cl_env; - __u32 cap_effective; -}; - - -#define current_pid() (current->pid) -#define current_comm() (current->comm) -#define current_fsuid() (current->fsuid) -#define current_fsgid() (current->fsgid) -#define current_umask() ({ mode_t mask = umask(0); umask(mask); mask; }) - -extern struct task_struct *current; -int in_group_p(gid_t gid); - -#define set_current_state(foo) do { current->state = foo; } while (0) - -#define wait_event_interruptible(wq, condition) \ -{ \ - struct l_wait_info lwi; \ - int timeout = 100000000;/* forever */ \ - int ret; \ - \ - lwi = LWI_TIMEOUT(timeout, NULL, NULL); \ - ret = l_wait_event(NULL, condition, &lwi); \ - \ - ret; \ -} - -#define call_usermodehelper(path, argv, envp, wait) (0) - -#if HZ != 1 -#error "liblustre's jiffies currently expects HZ to be 1" -#endif -#define jiffies \ -({ \ - unsigned long _ret = 0; \ - struct timeval tv; \ - if (gettimeofday(&tv, NULL) == 0) \ - _ret = tv.tv_sec; \ - _ret; \ -}) -#define get_jiffies_64() (__u64)jiffies - -#ifndef likely -#define likely(exp) (exp) -#endif -#ifndef unlikely -#define unlikely(exp) (exp) -#endif - -#define might_sleep() -#define might_sleep_if(c) -#define smp_mb() - -/* FIXME sys/capability will finally included linux/fs.h thus - * cause numerous trouble on x86-64. as temporary solution for - * build broken at Cray, we copy definition we need from capability.h - * FIXME - */ -struct _cap_struct; -typedef struct _cap_struct *cap_t; -typedef int cap_value_t; -typedef enum { - CAP_EFFECTIVE=0, - CAP_PERMITTED=1, - CAP_INHERITABLE=2 -} cap_flag_t; -typedef enum { - CAP_CLEAR=0, - CAP_SET=1 -} cap_flag_value_t; - -cap_t cap_get_proc(void); -int cap_get_flag(cap_t, cap_value_t, cap_flag_t, cap_flag_value_t *); - -struct liblustre_wait_callback { - cfs_list_t llwc_list; - const char *llwc_name; - int (*llwc_fn)(void *arg); - void *llwc_arg; -}; - -void *liblustre_register_wait_callback(const char *name, - int (*fn)(void *arg), void *arg); -void liblustre_deregister_wait_callback(void *notifier); -int liblustre_wait_event(int timeout); - -void *liblustre_register_idle_callback(const char *name, - int (*fn)(void *arg), void *arg); -void liblustre_deregister_idle_callback(void *notifier); -void liblustre_wait_idle(void); - -struct file_lock { - struct file_lock *fl_next; /* singly linked list for this inode */ - cfs_list_t fl_link; /* doubly linked list of all locks */ - cfs_list_t fl_block; /* circular list of blocked processes */ - void *fl_owner; - unsigned int fl_pid; - wait_queue_head_t fl_wait; - struct file *fl_file; - unsigned char fl_flags; - unsigned char fl_type; - loff_t fl_start; - loff_t fl_end; - - void (*fl_notify)(struct file_lock *); /* unblock callback */ - void (*fl_insert)(struct file_lock *); /* lock insertion callback */ - void (*fl_remove)(struct file_lock *); /* lock removal callback */ - - void *fl_fasync; /* for lease break notifications */ - unsigned long fl_break_time; /* for nonblocking lease breaks */ -}; - -#define flock_type(fl) ((fl)->fl_type) -#define flock_set_type(fl, type) do { (fl)->fl_type = (type); } while (0) -#define flock_pid(fl) ((fl)->fl_pid) -#define flock_set_pid(fl, pid) do { (fl)->fl_pid = (pid); } while (0) -#define flock_start(fl) ((fl)->fl_start) -#define flock_set_start(fl, st) do { (fl)->fl_start = (st); } while (0) -#define flock_end(fl) ((fl)->fl_end) -#define flock_set_end(fl, end) do { (fl)->fl_end = (end); } while (0) - -#ifndef OFFSET_MAX -#define INT_LIMIT(x) (~((x)1 << (sizeof(x)*8 - 1))) -#define OFFSET_MAX INT_LIMIT(loff_t) -#endif - -#define i_atime i_stbuf.st_atime -#define i_mtime i_stbuf.st_mtime -#define i_ctime i_stbuf.st_ctime -/* use i_size_read() i_size_write() to access i_stbuf.st_size */ -#define i_blocks i_stbuf.st_blocks -#define i_blksize i_stbuf.st_blksize -#define i_mode i_stbuf.st_mode -#define i_uid i_stbuf.st_uid -#define i_gid i_stbuf.st_gid - -/* XXX: defined in kernel */ -#define FL_POSIX 1 -#define FL_SLEEP 128 - -/* quota */ -#define QUOTA_OK 0 -#define NO_QUOTA 1 - -/* ACL */ -typedef struct { - __u16 e_tag; - __u16 e_perm; - __u32 e_id; -} posix_acl_xattr_entry; - -struct posix_acl { - atomic_t a_refcount; - unsigned int a_count; - posix_acl_xattr_entry a_entries[0]; -}; - -typedef struct { - __u32 a_version; - posix_acl_xattr_entry a_entries[0]; -} posix_acl_xattr_header; - -static inline size_t posix_acl_xattr_size(int count) -{ - return sizeof(posix_acl_xattr_header) + count * - sizeof(posix_acl_xattr_entry); -} - -static inline -struct posix_acl * posix_acl_from_xattr(const void *value, size_t size) -{ - return NULL; -} - -/* The kernel version takes 3 arguments, so strip that off first. */ -#define posix_acl_from_xattr(a,b,c) posix_acl_from_xattr(b,c) -#define posix_acl_to_xattr(a,b,c) posix_acl_to_xattr(b,c) - -static inline -int posix_acl_valid(const struct posix_acl *acl) -{ - return 0; -} - -static inline -void posix_acl_release(struct posix_acl *acl) -{ -} - -#if defined(LIBLUSTRE_POSIX_ACL) && !defined(CONFIG_FS_POSIX_ACL) -# define CONFIG_FS_POSIX_ACL 1 -#endif - -#ifndef ENOTSUPP -#define ENOTSUPP ENOTSUP -#endif - -typedef int mm_segment_t; - -#define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO) -#define S_IALLUGO (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO) - -#include -#include -#include -#include -#include -#include - -/** @} liblustre */ - -#endif +#error "do not include " diff --git a/lustre/include/lustre/lustre_lfsck_user.h b/lustre/include/lustre/lustre_lfsck_user.h index 5d4e3cc..4c4654d 100644 --- a/lustre/include/lustre/lustre_lfsck_user.h +++ b/lustre/include/lustre/lustre_lfsck_user.h @@ -32,6 +32,7 @@ #ifndef _LUSTRE_LFSCK_USER_H # define _LUSTRE_LFSCK_USER_H +# include enum lfsck_param_flags { /* Reset LFSCK iterator position to the device beginning. */ diff --git a/lustre/include/lustre_update.h b/lustre/include/lustre_update.h index d99e141..b65e00d4 100644 --- a/lustre/include/lustre_update.h +++ b/lustre/include/lustre_update.h @@ -30,6 +30,7 @@ #ifndef _LUSTRE_UPDATE_H #define _LUSTRE_UPDATE_H +#include #define OUT_UPDATE_INIT_BUFFER_SIZE 8192 #define OUT_UPDATE_REPLY_SIZE 8192 diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 6edb1d3..9967577 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -36,6 +36,9 @@ #ifndef __OBD_H #define __OBD_H +#ifndef __KERNEL__ +# error "userspace should not include " +#endif #if defined(__linux__) #include diff --git a/lustre/ldlm/interval_tree.c b/lustre/ldlm/interval_tree.c index 1318562..b052766 100644 --- a/lustre/ldlm/interval_tree.c +++ b/lustre/ldlm/interval_tree.c @@ -41,7 +41,7 @@ #ifdef __KERNEL__ # include #else -# include +# include #endif #include #include diff --git a/lustre/ptlrpc/layout.c b/lustre/ptlrpc/layout.c index 8a861ee..af36c72 100644 --- a/lustre/ptlrpc/layout.c +++ b/lustre/ptlrpc/layout.c @@ -64,14 +64,13 @@ #include /* obd2cli_tgt() (required by DEBUG_REQ()) */ #include +#include +#include +#endif /* !__REQ_LAYOUT_USER__ */ -/* __REQ_LAYOUT_USER__ */ -#endif /* struct ptlrpc_request, lustre_msg* */ #include -#include #include -#include /* * RQFs (see below) refer to two struct req_msg_field arrays describing the diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 8c91793..ee48eec 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -54,8 +54,9 @@ void lustre_assert_wire_constants(void) { /* Wire protocol assertions generated by 'wirecheck' * (make -C lustre/utils newwiretest) - * running on Linux deva 2.6.32-358.18.1.el6_lustre.gdf685d2.x86_64 #1 SMP Sat Aug 31 20:41:4 - * with gcc version 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC) */ + * running on Linux u 2.6.32-431.5.1.el6.lustre.x86_64 #1 SMP Wed Feb 12 11:01:08 CST 2014 x8 + * with gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) */ + /* Constants... */ LASSERTF(PTL_RPC_MSG_REQUEST == 4711, "found %lld\n", @@ -4050,36 +4051,6 @@ void lustre_assert_wire_constants(void) CLASSERT(FIEMAP_EXTENT_MERGED == 0x00001000); CLASSERT(FIEMAP_EXTENT_NO_DIRECT == 0x40000000); CLASSERT(FIEMAP_EXTENT_NET == 0x80000000); -#ifdef LIBLUSTRE_POSIX_ACL - - /* Checks for type posix_acl_xattr_entry */ - LASSERTF((int)sizeof(posix_acl_xattr_entry) == 8, "found %lld\n", - (long long)(int)sizeof(posix_acl_xattr_entry)); - LASSERTF((int)offsetof(posix_acl_xattr_entry, e_tag) == 0, "found %lld\n", - (long long)(int)offsetof(posix_acl_xattr_entry, e_tag)); - LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_tag) == 2, "found %lld\n", - (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_tag)); - LASSERTF((int)offsetof(posix_acl_xattr_entry, e_perm) == 2, "found %lld\n", - (long long)(int)offsetof(posix_acl_xattr_entry, e_perm)); - LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_perm) == 2, "found %lld\n", - (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_perm)); - LASSERTF((int)offsetof(posix_acl_xattr_entry, e_id) == 4, "found %lld\n", - (long long)(int)offsetof(posix_acl_xattr_entry, e_id)); - LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_id) == 4, "found %lld\n", - (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_id)); - - /* Checks for type posix_acl_xattr_header */ - LASSERTF((int)sizeof(posix_acl_xattr_header) == 4, "found %lld\n", - (long long)(int)sizeof(posix_acl_xattr_header)); - LASSERTF((int)offsetof(posix_acl_xattr_header, a_version) == 0, "found %lld\n", - (long long)(int)offsetof(posix_acl_xattr_header, a_version)); - LASSERTF((int)sizeof(((posix_acl_xattr_header *)0)->a_version) == 4, "found %lld\n", - (long long)(int)sizeof(((posix_acl_xattr_header *)0)->a_version)); - LASSERTF((int)offsetof(posix_acl_xattr_header, a_entries) == 4, "found %lld\n", - (long long)(int)offsetof(posix_acl_xattr_header, a_entries)); - LASSERTF((int)sizeof(((posix_acl_xattr_header *)0)->a_entries) == 0, "found %lld\n", - (long long)(int)sizeof(((posix_acl_xattr_header *)0)->a_entries)); -#endif /* Checks for struct link_ea_header */ LASSERTF((int)sizeof(struct link_ea_header) == 24, "found %lld\n", @@ -4687,3 +4658,4 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct lfsck_reply *)0)->lr_padding_2) == 8, "found %lld\n", (long long)(int)sizeof(((struct lfsck_reply *)0)->lr_padding_2)); } + diff --git a/lustre/tests/check_fhandle_syscalls.c b/lustre/tests/check_fhandle_syscalls.c index 8094774..df7104c 100644 --- a/lustre/tests/check_fhandle_syscalls.c +++ b/lustre/tests/check_fhandle_syscalls.c @@ -40,7 +40,7 @@ #include #include -#include +#include #include #define MAX_HANDLE_SZ 128 diff --git a/lustre/tests/ll_dirstripe_verify.c b/lustre/tests/ll_dirstripe_verify.c index ed9baec..b44c32b 100644 --- a/lustre/tests/ll_dirstripe_verify.c +++ b/lustre/tests/ll_dirstripe_verify.c @@ -51,12 +51,8 @@ #include #include -#include #include -#include - - #define MAX_LOV_UUID_COUNT 1000 union { struct obd_uuid uuid; diff --git a/lustre/tests/lp_utils.c b/lustre/tests/lp_utils.c index eb00b21..0874fac 100644 --- a/lustre/tests/lp_utils.c +++ b/lustre/tests/lp_utils.c @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include "lustre/lustre_user.h" #include "lustre/tests/lp_utils.h" diff --git a/lustre/tests/mpi/mdsrate.c b/lustre/tests/mpi/mdsrate.c index 896854e..beca2ff 100644 --- a/lustre/tests/mpi/mdsrate.c +++ b/lustre/tests/mpi/mdsrate.c @@ -220,7 +220,7 @@ sigalrm_handler(int signum) #define HAVE_MDC_LOOKUP #elif defined(USE_MDC_LOOKUP) #include -#include +#include #include int llapi_file_lookup(int dirfd, const char *name) diff --git a/lustre/tests/rwv.c b/lustre/tests/rwv.c index e184c62..7368b52 100644 --- a/lustre/tests/rwv.c +++ b/lustre/tests/rwv.c @@ -43,7 +43,7 @@ #include #include -#include +#include #include #define ACT_NONE 0 diff --git a/lustre/tests/statmany.c b/lustre/tests/statmany.c index e33928e..92f1088 100644 --- a/lustre/tests/statmany.c +++ b/lustre/tests/statmany.c @@ -45,7 +45,7 @@ #include #include -#include +#include #include struct option longopts[] = { diff --git a/lustre/tests/statone.c b/lustre/tests/statone.c index 151fb59..c53a631 100644 --- a/lustre/tests/statone.c +++ b/lustre/tests/statone.c @@ -38,7 +38,7 @@ #include #include -#include +#include #include int main(int argc, char **argv) diff --git a/lustre/tests/test_brw.c b/lustre/tests/test_brw.c index 3d7a344..5a886c9 100644 --- a/lustre/tests/test_brw.c +++ b/lustre/tests/test_brw.c @@ -47,7 +47,7 @@ #include #include -#include +#include #define READ 1 #define WRITE 2 diff --git a/lustre/utils/l_getidentity.c b/lustre/utils/l_getidentity.c index 3729f3f..a15eaf9 100644 --- a/lustre/utils/l_getidentity.c +++ b/lustre/utils/l_getidentity.c @@ -48,7 +48,7 @@ #include #include -#include +#include #include #include diff --git a/lustre/utils/lctl.c b/lustre/utils/lctl.c index a092901..5c6892c 100644 --- a/lustre/utils/lctl.c +++ b/lustre/utils/lctl.c @@ -45,6 +45,7 @@ #include #include "obdctl.h" #include +#include static int jt_quit(int argc, char **argv) { Parser_quit(argc, argv); diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 59f82e6..1c0b2fe 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -69,7 +69,8 @@ #include -#include +#include +#include #include #include diff --git a/lustre/utils/libiam.c b/lustre/utils/libiam.c index a5f3173..9b64c61 100644 --- a/lustre/utils/libiam.c +++ b/lustre/utils/libiam.c @@ -55,7 +55,6 @@ #endif #include -#include #include typedef __u32 lvar_hash_t; diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 5e16e22..d3c99c6 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -69,7 +69,7 @@ #endif #include -#include +#include #include #include #include diff --git a/lustre/utils/liblustreapi_hsm.c b/lustre/utils/liblustreapi_hsm.c index 94c6ba0..47fe2ec 100644 --- a/lustre/utils/liblustreapi_hsm.c +++ b/lustre/utils/liblustreapi_hsm.c @@ -53,8 +53,9 @@ #include #endif -#include +#include #include +#include #include #include "lustreapi_internal.h" diff --git a/lustre/utils/liblustreapi_json.c b/lustre/utils/liblustreapi_json.c index a09a1e0..b4f0882 100644 --- a/lustre/utils/liblustreapi_json.c +++ b/lustre/utils/liblustreapi_json.c @@ -41,7 +41,7 @@ #include #endif -#include +#include #include /** Quick-n'-dirty JSON string escape routine. diff --git a/lustre/utils/liblustreapi_nodemap.c b/lustre/utils/liblustreapi_nodemap.c index acd66e3..836b442 100644 --- a/lustre/utils/liblustreapi_nodemap.c +++ b/lustre/utils/liblustreapi_nodemap.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include "lustreapi_internal.h" diff --git a/lustre/utils/ll_decode_filter_fid.c b/lustre/utils/ll_decode_filter_fid.c index a28b3b9..7f2e170 100644 --- a/lustre/utils/ll_decode_filter_fid.c +++ b/lustre/utils/ll_decode_filter_fid.c @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include int main(int argc, char *argv[]) diff --git a/lustre/utils/ll_recover_lost_found_objs.c b/lustre/utils/ll_recover_lost_found_objs.c index b7250b2..3cafd7c 100644 --- a/lustre/utils/ll_recover_lost_found_objs.c +++ b/lustre/utils/ll_recover_lost_found_objs.c @@ -57,7 +57,7 @@ #include #include -#include +#include #include #define MAX_GROUPS 64 diff --git a/lustre/utils/llog_reader.c b/lustre/utils/llog_reader.c index 3c994fc..2a1903b 100644 --- a/lustre/utils/llog_reader.c +++ b/lustre/utils/llog_reader.c @@ -39,11 +39,23 @@ #include #include #include +#include #include #include -#include +#include #include +#include + +static inline int ext2_test_bit(int nr, const void *addr) +{ +#if __BYTE_ORDER == __BIG_ENDIAN + const unsigned char *tmp = addr; + return (tmp[nr >> 3] >> (nr & 7)) & 1; +#else + return test_bit(nr, addr); +#endif +} int llog_pack_buffer(int fd, struct llog_log_hdr **llog_buf, struct llog_rec_hdr ***recs, int *recs_number); diff --git a/lustre/utils/lustre_cfg.c b/lustre/utils/lustre_cfg.c index fa23d5b..6c8355d 100644 --- a/lustre/utils/lustre_cfg.c +++ b/lustre/utils/lustre_cfg.c @@ -49,9 +49,7 @@ #include #include -#ifndef __KERNEL__ -#include -#endif +#include #include #include #include diff --git a/lustre/utils/mount_lustre.c b/lustre/utils/mount_lustre.c index f0f1f0f..7671da3 100644 --- a/lustre/utils/mount_lustre.c +++ b/lustre/utils/mount_lustre.c @@ -53,6 +53,7 @@ #include #include #include +#include #if LUSTRE_VERSION_CODE > OBD_OCD_VERSION(2, 10, 51, 0) /* * LU-1783 diff --git a/lustre/utils/obd.c b/lustre/utils/obd.c index c628510..4774ac7 100644 --- a/lustre/utils/obd.c +++ b/lustre/utils/obd.c @@ -63,7 +63,10 @@ #include #include "obdctl.h" - +#include +#include +#include +#include #include #include diff --git a/lustre/utils/obdctl.h b/lustre/utils/obdctl.h index abe2dbb..3e67e8b 100644 --- a/lustre/utils/obdctl.h +++ b/lustre/utils/obdctl.h @@ -37,12 +37,6 @@ #ifndef _OBDCTL_H_ #define _OBDCTL_H_ -#ifndef __KERNEL__ -#include -#endif - -#include - #define MAX_IOC_BUFLEN 8192 /* obd.c */ diff --git a/lustre/utils/req-layout.c b/lustre/utils/req-layout.c index ae2202a..22e1972 100644 --- a/lustre/utils/req-layout.c +++ b/lustre/utils/req-layout.c @@ -44,7 +44,7 @@ #include #include -#include +#include #include #define __REQ_LAYOUT_USER__ (1) diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index f9313dc..f27f748 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include @@ -1750,25 +1750,6 @@ check_getinfo_fid2path(void) } static void -check_posix_acl_xattr_entry(void) -{ - BLANK_LINE(); - CHECK_STRUCT_TYPEDEF(posix_acl_xattr_entry); - CHECK_MEMBER_TYPEDEF(posix_acl_xattr_entry, e_tag); - CHECK_MEMBER_TYPEDEF(posix_acl_xattr_entry, e_perm); - CHECK_MEMBER_TYPEDEF(posix_acl_xattr_entry, e_id); -} - -static void -check_posix_acl_xattr_header(void) -{ - BLANK_LINE(); - CHECK_STRUCT_TYPEDEF(posix_acl_xattr_header); - CHECK_MEMBER_TYPEDEF(posix_acl_xattr_header, a_version); - CHECK_MEMBER_TYPEDEF(posix_acl_xattr_header, a_entries); -} - -static void check_ll_user_fiemap(void) { BLANK_LINE(); @@ -2471,13 +2452,6 @@ main(int argc, char **argv) check_getinfo_fid2path(); check_ll_user_fiemap(); check_ll_fiemap_extent(); - printf("#ifdef LIBLUSTRE_POSIX_ACL\n"); -#ifndef LIBLUSTRE_POSIX_ACL -#error build generator without LIBLUSTRE_POSIX_ACL defined - produce wrong check code. -#endif - check_posix_acl_xattr_entry(); - check_posix_acl_xattr_header(); - printf("#endif\n"); check_link_ea_header(); check_link_ea_entry(); check_layout_intent(); diff --git a/lustre/utils/wirehdr.c b/lustre/utils/wirehdr.c index f203baa..6bf14b7 100644 --- a/lustre/utils/wirehdr.c +++ b/lustre/utils/wirehdr.c @@ -35,7 +35,7 @@ */ #include -#include +#include #include #include diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index 75966e2..1138185 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -35,7 +35,7 @@ */ #include -#include +#include #include #include @@ -57,13 +57,13 @@ int main() return ret; } - void lustre_assert_wire_constants(void) { /* Wire protocol assertions generated by 'wirecheck' * (make -C lustre/utils newwiretest) - * running on Linux testnode 2.6.32 #3 SMP Thu Sep 13 12:42:57 PDT 2012 x86_64 x86_64 x86_64 - * with gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) */ + * running on Linux u 2.6.32-431.5.1.el6.lustre.x86_64 #1 SMP Wed Feb 12 11:01:08 CST 2014 x8 + * with gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) */ + /* Constants... */ LASSERTF(PTL_RPC_MSG_REQUEST == 4711, "found %lld\n", @@ -4058,36 +4058,6 @@ void lustre_assert_wire_constants(void) CLASSERT(FIEMAP_EXTENT_MERGED == 0x00001000); CLASSERT(FIEMAP_EXTENT_NO_DIRECT == 0x40000000); CLASSERT(FIEMAP_EXTENT_NET == 0x80000000); -#ifdef LIBLUSTRE_POSIX_ACL - - /* Checks for type posix_acl_xattr_entry */ - LASSERTF((int)sizeof(posix_acl_xattr_entry) == 8, "found %lld\n", - (long long)(int)sizeof(posix_acl_xattr_entry)); - LASSERTF((int)offsetof(posix_acl_xattr_entry, e_tag) == 0, "found %lld\n", - (long long)(int)offsetof(posix_acl_xattr_entry, e_tag)); - LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_tag) == 2, "found %lld\n", - (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_tag)); - LASSERTF((int)offsetof(posix_acl_xattr_entry, e_perm) == 2, "found %lld\n", - (long long)(int)offsetof(posix_acl_xattr_entry, e_perm)); - LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_perm) == 2, "found %lld\n", - (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_perm)); - LASSERTF((int)offsetof(posix_acl_xattr_entry, e_id) == 4, "found %lld\n", - (long long)(int)offsetof(posix_acl_xattr_entry, e_id)); - LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_id) == 4, "found %lld\n", - (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_id)); - - /* Checks for type posix_acl_xattr_header */ - LASSERTF((int)sizeof(posix_acl_xattr_header) == 4, "found %lld\n", - (long long)(int)sizeof(posix_acl_xattr_header)); - LASSERTF((int)offsetof(posix_acl_xattr_header, a_version) == 0, "found %lld\n", - (long long)(int)offsetof(posix_acl_xattr_header, a_version)); - LASSERTF((int)sizeof(((posix_acl_xattr_header *)0)->a_version) == 4, "found %lld\n", - (long long)(int)sizeof(((posix_acl_xattr_header *)0)->a_version)); - LASSERTF((int)offsetof(posix_acl_xattr_header, a_entries) == 4, "found %lld\n", - (long long)(int)offsetof(posix_acl_xattr_header, a_entries)); - LASSERTF((int)sizeof(((posix_acl_xattr_header *)0)->a_entries) == 0, "found %lld\n", - (long long)(int)sizeof(((posix_acl_xattr_header *)0)->a_entries)); -#endif /* Checks for struct link_ea_header */ LASSERTF((int)sizeof(struct link_ea_header) == 24, "found %lld\n", @@ -4695,3 +4665,4 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct lfsck_reply *)0)->lr_padding_2) == 8, "found %lld\n", (long long)(int)sizeof(((struct lfsck_reply *)0)->lr_padding_2)); } +