Whamcloud - gitweb
LU-3963 cleanup: C89 and build cleanups 03/7803/29
authorAlexey Lyashkov <alexey_lyashkov@xyratex.com>
Mon, 30 Sep 2013 10:38:10 +0000 (13:38 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 11 Apr 2014 16:34:15 +0000 (16:34 +0000)
use C99 initialization for a types, remove some platform depended code
and use POSIX compatible instead.
don't build a lhsmtool is none utils allowed.

Signed-off-by: Alexey Lyashkov <alexey_lyashkov@xyratex.com>
Change-Id: I6e2837953902520240e9ceb251c92329d328d715
Reviewed-on: http://review.whamcloud.com/7803
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
48 files changed:
libcfs/include/libcfs/libcfs_private.h
libcfs/include/libcfs/linux/Makefile.am
libcfs/include/libcfs/linux/libcfs.h
libcfs/include/libcfs/linux/portals_compat25.h
libcfs/include/libcfs/posix/Makefile.am
libcfs/include/libcfs/posix/libcfs.h
libcfs/include/libcfs/posix/posix-types.h
libcfs/include/libcfs/posix/posix-wordsize.h
libcfs/include/libcfs/user-bitops.h
libcfs/include/libcfs/user-prim.h
libcfs/include/libcfs/winnt/portals_utils.h
libcfs/include/libcfs/winnt/winnt-lock.h
libcfs/libcfs/hash.c
libcfs/libcfs/posix/Makefile.am
libcfs/libcfs/posix/posix-debug.c
libcfs/libcfs/posix/posix-tracefile.h [moved from libcfs/include/libcfs/linux/linux-bitops.h with 57% similarity]
libcfs/libcfs/tracefile.h
libcfs/libcfs/user-bitops.c
libcfs/libcfs/user-tcpip.c
libcfs/libcfs/winnt/winnt-proc.c
libsysio/Makefile.am
lnet/autoMakefile.am
lnet/utils/genlib.sh
lustre/fld/fld_cache.c
lustre/fld/fld_request.c
lustre/include/cl_object.h
lustre/include/darwin/lustre_handles.h
lustre/include/darwin/lustre_user.h
lustre/include/liblustre.h
lustre/include/lvfs.h
lustre/ldlm/ldlm_lib.c
lustre/ldlm/ldlm_lock.c
lustre/ldlm/ldlm_request.c
lustre/liblustre/Makefile.am
lustre/liblustre/dir.c
lustre/liblustre/genlib.sh
lustre/lmv/lmv_fld.c
lustre/lmv/lmv_intent.c
lustre/lmv/lmv_obd.c
lustre/lov/lov_ea.c
lustre/lov/lov_obd.c
lustre/mdc/mdc_locks.c
lustre/mdc/mdc_request.c
lustre/obdclass/cl_lock.c
lustre/obdclass/lprocfs_status.c
lustre/ofd/ofd_dev.c
lustre/tests/conf-sanity.sh
lustre/utils/Makefile.am

index ee5f1da..c8aaabc 100644 (file)
@@ -534,7 +534,7 @@ int cfs_percpt_atomic_summary(atomic_t **refs);
  *       value  after  conversion...
  *
  */
-#define CLASSERT(cond) do {switch(42) {case (cond): case 0: break;}} while (0)
+#define CLASSERT(cond) do {switch (1) {case (cond): case 0: break; } } while (0)
 
 /* support decl needed both by kernel and liblustre */
 int             libcfs_isknown_lnd(int type);
index 6e96ffe..409ac3c 100644 (file)
@@ -1,3 +1,3 @@
 EXTRA_DIST = kp30.h libcfs.h linux-fs.h linux-lock.h linux-mem.h       \
        linux-prim.h linux-time.h linux-tcpip.h linux-cpu.h             \
-       portals_compat25.h linux-bitops.h linux-crypto.h
+       portals_compat25.h linux-crypto.h
index 13bcd3a..8c1d920 100644 (file)
@@ -54,7 +54,6 @@
 #include <libcfs/linux/linux-lock.h>
 #include <libcfs/linux/linux-fs.h>
 #include <libcfs/linux/linux-tcpip.h>
-#include <libcfs/linux/linux-bitops.h>
 #include <libcfs/linux/kp30.h>
 
 #ifdef HAVE_ASM_TYPES_H
@@ -64,6 +63,7 @@
 #include <asm/timex.h>
 #include <linux/sched.h> /* THREAD_SIZE */
 #include <linux/rbtree.h>
+#include <linux/bitops.h>
 
 #if !defined(__x86_64__)
 # ifdef  __ia64__
index 52b6244..c946564 100644 (file)
 #ifndef __LIBCFS_LINUX_PORTALS_COMPAT_H__
 #define __LIBCFS_LINUX_PORTALS_COMPAT_H__
 
-#ifndef __user
-#define __user
-#endif
-
 #define LL_PROC_PROTO(name)                                    \
        name(struct ctl_table *table, int write,                \
                void __user *buffer, size_t *lenp, loff_t *ppos)
index 957f156..def79ff 100644 (file)
@@ -4,4 +4,4 @@ if UTILS
 libcfsposix_HEADERS = posix-types.h
 endif
 
-EXTRA_DIST = libcfs.h posix-wordsize.h posix-types.h posix-crypto.h
+EXTRA_DIST = libcfs.h posix-wordsize.h posix-types.h posix-crypto.h
\ No newline at end of file
index d96afcc..6a16be3 100644 (file)
@@ -67,6 +67,7 @@
 #include <sys/utsname.h>
 #include <ctype.h>
 #include <stdbool.h>
+#include <limits.h>
 
 #ifdef HAVE_NETDB_H
 #include <netdb.h>
@@ -188,11 +189,6 @@ typedef unsigned long long cfs_cycles_t;
 #define __swab64s(x)                            do { *(x) = __swab64(*(x)); } while (0)
 #endif
 
-#if !defined(ALIGN)
-#define __ALIGN_MASK(x, mask)  (((x) + (mask)) & ~(mask))
-#define ALIGN(x, a)            __ALIGN_MASK(x, (typeof(x))(a) - 1)
-#endif
-
 # ifndef THREAD_SIZE /* x86_64 linux has THREAD_SIZE in userspace */
 #  define THREAD_SIZE 8192
 # else
@@ -488,4 +484,8 @@ typedef ssize_t (*read_actor_t)();
 #  define DTTOIF(dirtype)      ((dirtype) << IFSHIFT)
 # endif
 
+#ifndef ERESTARTSYS
+#define ERESTARTSYS ERESTART
+#endif
+
 #endif
index 446db6e..510b178 100644 (file)
@@ -42,7 +42,9 @@
 #ifndef _LUSTRE_POSIX_TYPES_H
 #define _LUSTRE_POSIX_TYPES_H
 
-#include <asm/types.h>
+#ifdef HAVE_LINUX_TYPES_H
+# include <linux/types.h>
+#endif
 #include <stdbool.h> /* for bool */
 #ifndef HAVE_UMODE_T
 typedef unsigned short umode_t;
index b826d36..b7ef6e2 100644 (file)
 # define LP_POISON ((void *)(long)0x5a5a5a5a)
 #endif
 
-#if (defined(__KERNEL__) && defined(HAVE_KERN__U64_LONG_LONG)) || \
-    (!defined(__KERNEL__) && defined(HAVE_USER__U64_LONG_LONG))
-/* x86_64 defines __u64 as "long" in userspace, but "long long" in the kernel */
 # define LPU64 "%llu"
 # define LPD64 "%lld"
 # define LPX64 "%#llx"
 # define LPX64i "%llx"
 # define LPO64 "%#llo"
 # define LPF64 "ll"
-#elif (BITS_PER_LONG == 32)
-# define LPU64 "%llu"
-# define LPD64 "%lld"
-# define LPX64 "%#llx"
-# define LPX64i "%llx"
-# define LPO64 "%#llo"
-# define LPF64 "L"
-#elif (BITS_PER_LONG == 64)
-# define LPU64 "%lu"
-# define LPD64 "%ld"
-# define LPX64i "%lx"
-# define LPX64 "%#lx"
-# define LPO64 "%#lo"
-# define LPF64 "l"
-#endif
-
-#ifndef LPU64
-# error "No word size defined"
-#endif
 
 /*
  * long_ptr_t & ulong_ptr_t, same to "long" for gcc
index 1b16ca7..7b31bc9 100644 (file)
@@ -76,7 +76,7 @@ static inline int test_bit(int nr, const unsigned long *addr)
 }
 
 /* using binary seach */
-static __inline__ unsigned long fls(long data)
+static inline unsigned long __fls(long data)
 {
        int pos = 32;
 
@@ -115,7 +115,7 @@ static __inline__ unsigned long fls(long data)
        return pos;
 }
 
-static __inline__ unsigned long __cfs_ffs(long data)
+static inline unsigned long __ffs(long data)
 {
         int pos = 0;
 
@@ -147,8 +147,8 @@ static __inline__ unsigned long __cfs_ffs(long data)
         return pos;
 }
 
-#define ffz(x)         ffs(~(x))
-#define flz(x)         fls(~(x))
+#define __ffz(x)       __ffs(~(x))
+#define __flz(x)       __fls(~(x))
 
 unsigned long find_next_bit(unsigned long *addr,
                            unsigned long size, unsigned long offset);
index 6053eb4..ec121d6 100644 (file)
@@ -55,8 +55,6 @@
 # define EXPORT_SYMBOL(s)
 #endif
 
-#ifndef __KERNEL__
-
 typedef struct proc_dir_entry           cfs_proc_dir_entry_t;
 
 /*
@@ -166,7 +164,6 @@ static inline int misc_deregister(struct miscdevice *foo)
        return 0;
 }
 
-#define cfs_sigfillset(l)               do {} while (0)
 #define cfs_recalc_sigpending(l)        do {} while (0)
 
 #define DAEMON_FLAGS                0
@@ -264,8 +261,6 @@ static inline void libcfs_arch_cleanup(void) {
 /* !__WINNT__ */
 #endif
 
-/* !__KERNEL__ */
-#endif
 
 /* __LIBCFS_USER_PRIM_H__ */
 #endif
index 39ab41f..b8678d9 100644 (file)
@@ -141,7 +141,7 @@ static inline int ffs(int x)
         return r;
 }
 
-static inline unsigned long __cfs_ffs(unsigned long word)
+static inline unsigned long __ffs(unsigned long word)
 {
         int num = 0;
 
@@ -180,7 +180,7 @@ static inline unsigned long __cfs_ffs(unsigned long word)
  * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
  */
 static inline
-int fls(int x)
+int __fls(int x)
 {
         int r = 32;
 
@@ -217,7 +217,7 @@ static inline unsigned find_first_bit(const unsigned long *addr,
         while (x < size) {
                 unsigned long val = *addr++;
                 if (val)
-                        return __cfs_ffs(val) + x;
+                        return __ffs(val) + x;
                 x += (sizeof(*addr)<<3);
         }
         return x;
index fc39dd8..2251c5d 100644 (file)
@@ -580,8 +580,8 @@ static inline int down_trylock(struct semaphore *s)
  *
  * - init_mutex(x)
  * - init_mutex_locked(x)
- * - mutex_up(x)
- * - mutex_down(x)
+ * - mutex_unlock(x)
+ * - mutex_lock(x)
  */
 
 #define mutex semaphore
index 0c4faf8..af0b3a9 100644 (file)
@@ -2131,7 +2131,7 @@ int cfs_hash_debug_str(cfs_hash_t *hs, char *str, int size)
 #endif
                 }
                 total += bd.bd_bucket->hsb_count;
-                dist[min(fls(bd.bd_bucket->hsb_count/max(theta,1)),7)]++;
+               dist[min(__fls(bd.bd_bucket->hsb_count/max(theta,1)),7UL)]++;
                 cfs_hash_bd_unlock(hs, &bd, 0);
         }
 
@@ -2200,7 +2200,7 @@ int cfs_hash_debug_str_seq(cfs_hash_t *hs, struct seq_file *m)
 #endif
                }
                total += bd.bd_bucket->hsb_count;
-               dist[min(fls(bd.bd_bucket->hsb_count/max(theta,1)),7)]++;
+               dist[min(__fls(bd.bd_bucket->hsb_count/max(theta,1)),7UL)]++;
                cfs_hash_bd_unlock(hs, &bd, 0);
        }
 
index 185710f..3cfdf7a 100644 (file)
@@ -1,2 +1,3 @@
-EXTRA_DIST = posix-debug.c
+EXTRA_DIST = posix-debug.c posix-tracefile.h
+
 
index 68b606e..3de41f6 100644 (file)
@@ -210,7 +210,7 @@ libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
         gettimeofday(&tv, NULL);
 
         fprintf(debug_file_fd, CFS_TIME_T".%06lu:%u:%s:(%s:%d:%s()): %s",
-                tv.tv_sec, tv.tv_usec, source_pid, source_nid,
+               tv.tv_sec, (unsigned long)tv.tv_usec, source_pid, source_nid,
                 msgdata->msg_file, msgdata->msg_line, msgdata->msg_fn, buf);
 
         return 0;
similarity index 57%
rename from libcfs/include/libcfs/linux/linux-bitops.h
rename to libcfs/libcfs/posix/posix-tracefile.h
index 715c138..020c494 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.htm
  *
  * GPL HEADER END
  */
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2012, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
+ * libcfs/libcfs/posix/posix-tracefile.h
  *
- * libcfs/include/libcfs/linux/linux-bitops.h
+ * Userspace debugging-tracing
  */
-#include <linux/bitops.h>
 
+#ifndef __LIBCFS_POSIX_TRACEFILE_H__
+#define __LIBCFS_POSIX_TRACEFILE_H__
+
+/**
+ * three types of trace_data in linux
+ * posix need to max of available types to have 
+ * type checking happy.
+ */
+typedef enum {
+       CFS_TCD_TYPE_PROC = 0,
+       CFS_TCD_TYPE_SOFTIRQ,
+       CFS_TCD_TYPE_IRQ,
+       CFS_TCD_TYPE_MAX
+} cfs_trace_buf_type_t;
 
+#endif
index c7b4c42..3aa8989 100644 (file)
@@ -39,6 +39,7 @@
 
 #include <libcfs/libcfs.h>
 
+#ifdef __KERNEL__
 #if defined(__linux__)
 #include "linux/linux-tracefile.h"
 #elif defined(__WINNT__)
@@ -46,7 +47,9 @@
 #else
 #error Unsupported operating system.
 #endif
-
+#else
+#include "posix/posix-tracefile.h"
+#endif
 /* trace file lock routines */
 
 #define TRACEFILE_NAME_SIZE 1024
index 65f2da9..26228ee 100644 (file)
@@ -55,7 +55,7 @@ unsigned long find_next_bit(unsigned long *addr,
                 return size;
         if (first_bit != 0) {
                 int tmp = (*word++) & (~0UL << first_bit);
-                bit = __cfs_ffs(tmp);
+                bit = __ffs(tmp);
                 if (bit < BITS_PER_LONG)
                         goto found;
                 word++;
@@ -63,7 +63,7 @@ unsigned long find_next_bit(unsigned long *addr,
         }
         while (word <= last) {
                 if (*word != 0UL) {
-                        bit = __cfs_ffs(*word);
+                        bit = __ffs(*word);
                         goto found;
                 }
                 word++;
@@ -89,7 +89,7 @@ unsigned long find_next_zero_bit(unsigned long *addr,
                 return size;
         if (first_bit != 0) {
                 int tmp = (*word++) & (~0UL << first_bit);
-                bit = ffz(tmp);
+               bit = __ffz(tmp);
                 if (bit < BITS_PER_LONG)
                         goto found;
                 word++;
@@ -97,7 +97,7 @@ unsigned long find_next_zero_bit(unsigned long *addr,
         }
         while (word <= last) {
                 if (*word != ~0UL) {
-                        bit = ffz(*word);
+                       bit = __ffz(*word);
                         goto found;
                 }
                 word++;
index 4477f13..4b7fdaa 100644 (file)
@@ -521,14 +521,8 @@ libcfs_sock_set_nagle(cfs_socket_t *sock, int nagle)
         int rc;
         int option = nagle ? 0 : 1;
 
-#if defined(__sun__) || defined(__sun)
         rc = setsockopt(sock->s_fd,
                         IPPROTO_TCP, TCP_NODELAY, &option, sizeof(option));
-#else
-        rc = setsockopt(sock->s_fd,
-                        SOL_TCP, TCP_NODELAY, &option, sizeof(option));
-#endif
-
         if (rc != 0) {
                 rc = -errno;
                 CERROR ("Cannot set NODELAY socket option\n");
index 3d7e7bb..6364371 100644 (file)
@@ -83,8 +83,8 @@ spinlock_t                    proc_fs_lock;
 struct mutex                           proc_fs_lock;
 
 #define INIT_PROCFS_LOCK()      cfs_init_mutex(&proc_fs_lock)
-#define LOCK_PROCFS()           cfs_mutex_down(&proc_fs_lock)
-#define UNLOCK_PROCFS()         cfs_mutex_up(&proc_fs_lock)
+#define LOCK_PROCFS()           mutex_lock(&proc_fs_lock)
+#define UNLOCK_PROCFS()         mutex_unlock(&proc_fs_lock)
 
 #endif
 
index dfa4f9e..1262105 100644 (file)
@@ -82,8 +82,8 @@ really-clean: testsclean maintainer-clean
        cd $(TESTDIR); rm -rf Makefile Makefile.in .deps
 
 tests: $(lib_LIBRARIES) FORCE
-       cd $(TESTDIR); make
+       cd $(TESTDIR); ${MAKE}
 testsclean: FORCE
-       cd $(TESTDIR); make clean
+       cd $(TESTDIR); ${MAKE} clean
 clean: testsclean clean-am
 FORCE:
index b3c05fa..77c2566 100644 (file)
@@ -36,3 +36,6 @@
 
 SUBDIRS = lnet klnds ulnds selftest doc utils include  \
        autoconf
+
+DIST_SUBDIRS = lnet klnds ulnds selftest doc utils include \
+       autoconf
index bad9833..02b22c6 100755 (executable)
@@ -14,7 +14,7 @@ rm -f liblst.so
 ALL_OBJS=
 
 build_obj_list() {
-  _objs=`$AR -t $1/$2`
+       _objs=`$AR -t $1/$2 | grep -v SYMDEF | grep -v SORTED`
   for _lib in $_objs; do
     ALL_OBJS=$ALL_OBJS"$1/$_lib ";
   done;
index 2254cd3..8ca90f4 100644 (file)
@@ -46,7 +46,7 @@
 #ifdef __KERNEL__
 # include <libcfs/libcfs.h>
 # include <linux/module.h>
-# include <asm/div64.h>
+# include <linux/math64.h>
 #else /* __KERNEL__ */
 # include <liblustre.h>
 # include <libcfs/list.h>
index f7c33dc..2a2a927 100644 (file)
@@ -45,7 +45,7 @@
 #ifdef __KERNEL__
 # include <libcfs/libcfs.h>
 # include <linux/module.h>
-# include <asm/div64.h>
+# include <linux/math64.h>
 #else /* __KERNEL__ */
 # include <liblustre.h>
 # include <libcfs/list.h>
index d933936..286ecfa 100644 (file)
@@ -97,7 +97,9 @@
 /*
  * super-class definitions.
  */
+#include <libcfs/libcfs.h>
 #include <lu_object.h>
+
 #ifdef __KERNEL__
 # include <linux/mutex.h>
 # include <linux/radix-tree.h>
@@ -806,7 +808,8 @@ enum cl_lock_mode {
         CLM_PHANTOM,
         CLM_READ,
         CLM_WRITE,
-        CLM_GROUP
+       CLM_GROUP,
+       CLM_MAX,
 };
 
 /**
index 225929e..c416e61 100644 (file)
@@ -33,7 +33,7 @@
  */
 
 #ifndef __DARWIN_LUSTRE_HANDLES_H_
-#define __DARWIN_LUSTR_HANDLES_H_
+#define __DARWIN_LUSTRE_HANDLES_H_
 
 #ifndef __LUSTRE_HANDLES_H_
 #error Do not #include this file directly. #include <lustre_handles.h> instead
index c686809..5c219bf 100644 (file)
@@ -41,7 +41,6 @@
 
 #ifndef __KERNEL__
 /* for llmount */
-# define _GNU_SOURCE
 # include <getopt.h>
 # include <sys/utsname.h>
 # include <sys/stat.h>
index 77b1fb3..815b96b 100644 (file)
@@ -134,10 +134,7 @@ extern int mgc_init(void);
         ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
 #endif
 
-/* registering symbols */
-#ifndef ERESTARTSYS
-#define ERESTARTSYS ERESTART
-#endif
+#define simple_strtol strtol
 
 #ifdef HZ
 #undef HZ
index 293abbd..a8ae589 100644 (file)
 #define __LVFS_H__
 
 #include <libcfs/libcfs.h>
+
+struct lvfs_callback_ops {
+       struct dentry *(*l_fid2dentry)(__u64 id_ino, __u32 gen, __u64 gr,
+                                      void *data);
+};
+
 #if defined(__linux__)
 #include <linux/lvfs.h>
 #elif defined(__APPLE__)
@@ -53,4 +59,5 @@
 /* ptlrpc_sec_ctx.c */
 void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx);
 void pop_ctxt(struct lvfs_run_ctxt *saved, struct lvfs_run_ctxt *new_ctx);
+
 #endif
index 4c35cab..aac76e9 100644 (file)
@@ -2507,14 +2507,14 @@ void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id)
 EXPORT_SYMBOL(target_send_reply);
 
 ldlm_mode_t lck_compat_array[] = {
-        [LCK_EX] LCK_COMPAT_EX,
-        [LCK_PW] LCK_COMPAT_PW,
-        [LCK_PR] LCK_COMPAT_PR,
-        [LCK_CW] LCK_COMPAT_CW,
-        [LCK_CR] LCK_COMPAT_CR,
-        [LCK_NL] LCK_COMPAT_NL,
-        [LCK_GROUP] LCK_COMPAT_GROUP,
-        [LCK_COS] LCK_COMPAT_COS,
+       [LCK_EX]    = LCK_COMPAT_EX,
+       [LCK_PW]    = LCK_COMPAT_PW,
+       [LCK_PR]    = LCK_COMPAT_PR,
+       [LCK_CW]    = LCK_COMPAT_CW,
+       [LCK_CR]    = LCK_COMPAT_CR,
+       [LCK_NL]    = LCK_COMPAT_NL,
+       [LCK_GROUP] = LCK_COMPAT_GROUP,
+       [LCK_COS]   = LCK_COMPAT_COS,
 };
 
 /**
index a0a6755..33ada0a 100644 (file)
 
 /* lock types */
 char *ldlm_lockname[] = {
-        [0] "--",
-        [LCK_EX] "EX",
-        [LCK_PW] "PW",
-        [LCK_PR] "PR",
-        [LCK_CW] "CW",
-        [LCK_CR] "CR",
-        [LCK_NL] "NL",
-        [LCK_GROUP] "GROUP",
-        [LCK_COS] "COS"
+       [0] = "--",
+       [LCK_EX] = "EX",
+       [LCK_PW] = "PW",
+       [LCK_PR] = "PR",
+       [LCK_CW] = "CW",
+       [LCK_CR] = "CR",
+       [LCK_NL] = "NL",
+       [LCK_GROUP] = "GROUP",
+       [LCK_COS] = "COS"
 };
 EXPORT_SYMBOL(ldlm_lockname);
 
 char *ldlm_typename[] = {
-        [LDLM_PLAIN] "PLN",
-        [LDLM_EXTENT] "EXT",
-        [LDLM_FLOCK] "FLK",
-        [LDLM_IBITS] "IBT",
+       [LDLM_PLAIN] = "PLN",
+       [LDLM_EXTENT] = "EXT",
+       [LDLM_FLOCK] = "FLK",
+       [LDLM_IBITS] = "IBT",
 };
 EXPORT_SYMBOL(ldlm_typename);
 
 static ldlm_policy_wire_to_local_t ldlm_policy_wire18_to_local[] = {
-        [LDLM_PLAIN - LDLM_MIN_TYPE] ldlm_plain_policy_wire_to_local,
-        [LDLM_EXTENT - LDLM_MIN_TYPE] ldlm_extent_policy_wire_to_local,
-        [LDLM_FLOCK - LDLM_MIN_TYPE] ldlm_flock_policy_wire18_to_local,
-        [LDLM_IBITS - LDLM_MIN_TYPE] ldlm_ibits_policy_wire_to_local,
+       [LDLM_PLAIN - LDLM_MIN_TYPE]  = ldlm_plain_policy_wire_to_local,
+       [LDLM_EXTENT - LDLM_MIN_TYPE] = ldlm_extent_policy_wire_to_local,
+       [LDLM_FLOCK - LDLM_MIN_TYPE]  = ldlm_flock_policy_wire18_to_local,
+       [LDLM_IBITS - LDLM_MIN_TYPE]  = ldlm_ibits_policy_wire_to_local,
 };
 
 static ldlm_policy_wire_to_local_t ldlm_policy_wire21_to_local[] = {
-        [LDLM_PLAIN - LDLM_MIN_TYPE] ldlm_plain_policy_wire_to_local,
-        [LDLM_EXTENT - LDLM_MIN_TYPE] ldlm_extent_policy_wire_to_local,
-        [LDLM_FLOCK - LDLM_MIN_TYPE] ldlm_flock_policy_wire21_to_local,
-        [LDLM_IBITS - LDLM_MIN_TYPE] ldlm_ibits_policy_wire_to_local,
+       [LDLM_PLAIN - LDLM_MIN_TYPE]  = ldlm_plain_policy_wire_to_local,
+       [LDLM_EXTENT - LDLM_MIN_TYPE] = ldlm_extent_policy_wire_to_local,
+       [LDLM_FLOCK - LDLM_MIN_TYPE]  = ldlm_flock_policy_wire21_to_local,
+       [LDLM_IBITS - LDLM_MIN_TYPE]  = ldlm_ibits_policy_wire_to_local,
 };
 
 static ldlm_policy_local_to_wire_t ldlm_policy_local_to_wire[] = {
-        [LDLM_PLAIN - LDLM_MIN_TYPE] ldlm_plain_policy_local_to_wire,
-        [LDLM_EXTENT - LDLM_MIN_TYPE] ldlm_extent_policy_local_to_wire,
-        [LDLM_FLOCK - LDLM_MIN_TYPE] ldlm_flock_policy_local_to_wire,
-        [LDLM_IBITS - LDLM_MIN_TYPE] ldlm_ibits_policy_local_to_wire,
+       [LDLM_PLAIN - LDLM_MIN_TYPE]  = ldlm_plain_policy_local_to_wire,
+       [LDLM_EXTENT - LDLM_MIN_TYPE] = ldlm_extent_policy_local_to_wire,
+       [LDLM_FLOCK - LDLM_MIN_TYPE]  = ldlm_flock_policy_local_to_wire,
+       [LDLM_IBITS - LDLM_MIN_TYPE]  = ldlm_ibits_policy_local_to_wire,
 };
 
 /**
@@ -160,12 +160,12 @@ extern struct kmem_cache *ldlm_lock_slab;
 
 #ifdef HAVE_SERVER_SUPPORT
 static ldlm_processing_policy ldlm_processing_policy_table[] = {
-        [LDLM_PLAIN] ldlm_process_plain_lock,
-        [LDLM_EXTENT] ldlm_process_extent_lock,
+       [LDLM_PLAIN]    = ldlm_process_plain_lock,
+       [LDLM_EXTENT]   = ldlm_process_extent_lock,
 # ifdef __KERNEL__
-        [LDLM_FLOCK] ldlm_process_flock_lock,
+       [LDLM_FLOCK]    = ldlm_process_flock_lock,
 # endif
-        [LDLM_IBITS] ldlm_process_inodebits_lock,
+       [LDLM_IBITS]    = ldlm_process_inodebits_lock,
 };
 
 ldlm_processing_policy ldlm_get_processing_policy(struct ldlm_resource *res)
index 59723ae..972083b 100644 (file)
@@ -2081,7 +2081,7 @@ void ldlm_namespace_foreach(struct ldlm_namespace *ns,
                             ldlm_iterator_t iter, void *closure)
 
 {
-        struct iter_helper_data helper = { iter: iter, closure: closure };
+       struct iter_helper_data helper = { .iter = iter, .closure = closure };
 
         cfs_hash_for_each_nolock(ns->ns_rs_hash,
                                  ldlm_res_iter_helper, &helper);
index e0d75b1..7164155 100644 (file)
@@ -1,7 +1,7 @@
 ## Liblustre excecutables & libraries Makefile
 SUBDIRS = . tests
 
-AM_CPPFLAGS = $(HAVE_EFENCE) -I$(SYSIO)/include -D_LARGEFILE64_SOURCE=1 \
+AM_CPPFLAGS = $(HAVE_EFENCE) -I$(SYSIO)/include \
               $(LLCPPFLAGS) -I$(top_srcdir)/lnet/ulnds
 AM_CFLAGS = $(LLCFLAGS)
 
index 5282eae..706cc74 100644 (file)
@@ -146,8 +146,8 @@ static void *(*memmover)(void *, const void *, size_t) = memmove;
 static int filldir(char *buf, int buflen, const char *name, int namelen,
                   loff_t offset, ino_t ino, unsigned int d_type, int *filled)
 {
-       struct dirent64 *dirent = (struct dirent64 *)(buf + *filled);
-       struct dirent64  holder;
+       struct intnl_dirent *dirent = (struct intnl_dirent *)(buf + *filled);
+       struct intnl_dirent holder;
        int reclen = ROUND_UP64(NAME_OFFSET(dirent) + namelen + 1);
 
         /*
index ce5445a..023d630 100755 (executable)
@@ -39,7 +39,7 @@ rm -f liblustre.so
 ALL_OBJS=
 
 build_obj_list() {
-  _objs=`$AR -t $1/$2`
+       _objs=`$AR -t $1/$2 | grep -v SYMDEF | grep -v SORTED`
   for _lib in $_objs; do
     ALL_OBJS=$ALL_OBJS"$1/$_lib ";
   done;
@@ -51,7 +51,7 @@ build_obj_list() {
 sysio_tmp=$CWD/sysio_tmp_`date +%s`
 rm -rf $sysio_tmp
 build_sysio_obj_list() {
-  _objs=`$AR -t $1`
+  _objs=`$AR -t $1 | grep -v SYMDEF | grep -v SORTED`
   mkdir -p $sysio_tmp
   cd $sysio_tmp
   $AR -x $1
index fc7f4bd..1874f17 100644 (file)
@@ -41,7 +41,7 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/pagemap.h>
-#include <asm/div64.h>
+#include <linux/math64.h>
 #include <linux/seq_file.h>
 #else
 #include <liblustre.h>
index 74cf0a1..09ee3b2 100644 (file)
@@ -41,7 +41,7 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/pagemap.h>
-#include <asm/div64.h>
+#include <linux/math64.h>
 #include <linux/seq_file.h>
 #include <linux/namei.h>
 #include <linux/lustre_intent.h>
index 298d0db..035bb18 100644 (file)
@@ -42,7 +42,7 @@
 #include <linux/slab.h>
 #include <linux/pagemap.h>
 #include <linux/mm.h>
-#include <asm/div64.h>
+#include <linux/math64.h>
 #include <linux/seq_file.h>
 #include <linux/namei.h>
 #else
index dc06237..767eb2d 100644 (file)
@@ -41,7 +41,7 @@
 #define DEBUG_SUBSYSTEM S_LOV
 
 #ifdef __KERNEL__
-#include <asm/div64.h>
+#include <linux/math64.h>
 #include <libcfs/libcfs.h>
 #else
 #include <liblustre.h>
index d8b508e..3a5432f 100644 (file)
@@ -2256,7 +2256,7 @@ static int lov_quotactl(struct obd_device *obd, struct obd_export *exp,
                 if (!tgt->ltd_active || tgt->ltd_reap) {
                         if (oqctl->qc_cmd == Q_GETOQUOTA &&
                             lov->lov_tgts[i]->ltd_activate) {
-                                rc = -EREMOTEIO;
+                               rc = -ENETDOWN;
                                 CERROR("ost %d is inactive\n", i);
                         } else {
                                 CDEBUG(D_HA, "ost %d is inactive\n", i);
index b6ca65b..4fe9b0f 100644 (file)
@@ -1167,7 +1167,7 @@ int mdc_intent_lock(struct obd_export *exp, struct md_op_data *op_data,
        LASSERT(it);
 
        CDEBUG(D_DLMTRACE, "(name: %.*s,"DFID") in obj "DFID
-               ", intent: %s flags %#Lo\n", op_data->op_namelen,
+               ", intent: %s flags %#"LPF64"o\n", op_data->op_namelen,
                op_data->op_name, PFID(&op_data->op_fid2),
                PFID(&op_data->op_fid1), ldlm_it2str(it->it_op),
                it->it_flags);
@@ -1276,7 +1276,8 @@ int mdc_intent_getattr_async(struct obd_export *exp,
        __u64                    flags = LDLM_FL_HAS_INTENT;
        ENTRY;
 
-       CDEBUG(D_DLMTRACE,"name: %.*s in inode "DFID", intent: %s flags %#Lo\n",
+       CDEBUG(D_DLMTRACE, "name: %.*s in inode "DFID", intent: %s flags %#"
+               LPF64"o\n",
                op_data->op_namelen, op_data->op_name, PFID(&op_data->op_fid1),
                ldlm_it2str(it->it_op), it->it_flags);
 
index cae3942..5446045 100644 (file)
@@ -3103,7 +3103,7 @@ static int mdc_resource_inode_free(struct ldlm_resource *res)
 }
 
 struct ldlm_valblock_ops inode_lvbo = {
-       lvbo_free: mdc_resource_inode_free
+       .lvbo_free = mdc_resource_inode_free
 };
 
 static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg)
index 8ac48d5..c1eedc9 100644 (file)
@@ -41,6 +41,7 @@
 
 #define DEBUG_SUBSYSTEM S_CLASS
 
+#include <libcfs/libcfs.h>
 #include <obd_class.h>
 #include <obd_support.h>
 #include <lustre_fid.h>
@@ -2128,10 +2129,8 @@ const char *cl_lock_mode_name(const enum cl_lock_mode mode)
                 [CLM_WRITE]   = "W",
                 [CLM_GROUP]   = "G"
         };
-        if (0 <= mode && mode < ARRAY_SIZE(names))
-                return names[mode];
-        else
-                return "U";
+       CLASSERT(CLM_MAX == ARRAY_SIZE(names));
+       return names[mode];
 }
 EXPORT_SYMBOL(cl_lock_mode_name);
 
index 9956ada..9527bb2 100644 (file)
@@ -3281,7 +3281,7 @@ void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value)
        unsigned int val = 0;
 
        if (likely(value != 0))
-               val = min(fls(value - 1), OBD_HIST_MAX);
+               val = min_t(unsigned int, __fls(value - 1), OBD_HIST_MAX);
 
        lprocfs_oh_tally(oh, val);
 }
index 4cafa48..a27e4b0 100644 (file)
@@ -2192,7 +2192,7 @@ static int ofd_init0(const struct lu_env *env, struct ofd_device *m,
                                obd->obd_name, osfs->os_bsize);
                GOTO(err_fini_stack, rc = -EPROTO);
        }
-       m->ofd_blockbits = fls(osfs->os_bsize) - 1;
+       m->ofd_blockbits = __fls(osfs->os_bsize) - 1;
 
        m->ofd_precreate_batch = OFD_PRECREATE_BATCH_DEFAULT;
        if (osfs->os_bsize * osfs->os_blocks < OFD_PRECREATE_SMALL_FS)
index 3b2370e..a2ede68 100644 (file)
@@ -2320,7 +2320,7 @@ test_36() { # 12743
        #     different one than the default value here.
        add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
                --fsname=${FSNAME2} --reformat $fs2ostdev $fs2ostvdev || exit 10
-       add fs3ost $(mkfs_opts ost1 ${fs3ostdev}) --mgsnode=$MGSNID \
+       add fs3ost $(mkfs_opts ost2 ${fs3ostdev}) --mgsnode=$MGSNID \
                --fsname=${FSNAME2} --reformat $fs3ostdev $fs3ostvdev || exit 10
 
         start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
index 0084056..d587b3b 100644 (file)
@@ -15,9 +15,10 @@ LIBPTLCTL := $(top_builddir)/lnet/utils/libptlctl.a \
 sbin_scripts = lrun
 bin_scripts = llstat llobdstat plot-llstat llbackup
 
+EXTRA_PROGRAMS = wirecheck
+
 if UTILS
 noinst_PROGRAMS = obdio obdbarrier
-EXTRA_PROGRAMS = wirecheck
 
 # mount only finds helpers in /sbin
 rootsbin_PROGRAMS = mount.lustre
@@ -39,6 +40,7 @@ if LDISKFS_ENABLED
 lib_LIBRARIES += libiam.a
 endif
 noinst_LIBRARIES = liblustreapitmp.a
+endif # UTILS
 
 lctl_SOURCES = lustre_lfsck.c obd.c lustre_cfg.c lctl.c obdctl.h
 lctl_LDADD :=  liblustreapi.a $(LIBPTLCTL) $(PTHREAD_LIBS) $(LIBREADLINE)
@@ -166,17 +168,16 @@ l_getidentity_LDADD := $(LIBPTLCTL)
 l_getidentity_DEPENDENCIES := $(LIBPTLCTL)
 
 ltrack_stats_SOURCES = ltrack_stats.c
-endif # UTILS
+
+lhsmtool_posix_SOURCES = lhsmtool_posix.c
+lhsmtool_posix_LDADD := liblustreapi.a $(PTHREAD_LIBS)
+lhsmtool_posix_DEPENDENCIES := liblustreapi.a
 
 wirecheck_SOURCES = wirecheck.c
 wirecheck_CPPFLAGS = -DCC="\"$(CC)\""
 
 wiretest_SOURCES = wiretest.c
 
-lhsmtool_posix_SOURCES = lhsmtool_posix.c
-lhsmtool_posix_LDADD := liblustreapi.a $(PTHREAD_LIBS)
-lhsmtool_posix_DEPENDENCIES := liblustreapi.a
-
 EXTRA_DIST = $(sbin_scripts) $(bin_scripts)
 
 # NOTE: this should only be run on i386.