Whamcloud - gitweb
1. Cleanup Linux jiffies and using cfs_time_*
authorliangzhen <liangzhen>
Wed, 15 Feb 2006 07:42:07 +0000 (07:42 +0000)
committerliangzhen <liangzhen>
Wed, 15 Feb 2006 07:42:07 +0000 (07:42 +0000)
2. Cleanup some headers
3. Info.plist for Tiger
4. Fix automake.am for building in Tiger
5. Porting of lctl

40 files changed:
lustre/autoconf/lustre-core.m4
lustre/include/darwin/lustre_compat.h
lustre/include/darwin/lustre_lib.h
lustre/include/darwin/lustre_net.h
lustre/include/darwin/lustre_user.h
lustre/include/darwin/obd_class.h
lustre/include/darwin/types.h [new file with mode: 0644]
lustre/include/liblustre.h
lustre/include/linux/Makefile.am
lustre/include/linux/lustre_user.h
lustre/include/linux/types.h [new file with mode: 0644]
lustre/include/lustre/types.h
lustre/include/lustre_lib.h
lustre/include/obd_class.h
lustre/lov/Info.plist
lustre/lov/autoMakefile.am
lustre/lvfs/Info.plist
lustre/lvfs/autoMakefile.am
lustre/lvfs/lvfs_darwin.c
lustre/obdclass/Info.plist
lustre/obdclass/autoMakefile.am
lustre/obdclass/class_obd.c
lustre/obdclass/darwin/darwin-module.c
lustre/obdclass/darwin/darwin-sysctl.c
lustre/obdecho/Info.plist
lustre/obdecho/autoMakefile.am
lustre/osc/Info.plist
lustre/osc/autoMakefile.am
lustre/osc/osc_create.c
lustre/osc/osc_internal.h
lustre/osc/osc_request.c
lustre/ptlrpc/Info.plist
lustre/ptlrpc/autoMakefile.am
lustre/ptlrpc/client.c
lustre/ptlrpc/niobuf.c
lustre/ptlrpc/pack_generic.c
lustre/ptlrpc/pinger.c
lustre/utils/Makefile.am
lustre/utils/parser.c
lustre/utils/platform.h [new file with mode: 0644]

index aa1b039..b656b49 100644 (file)
@@ -541,7 +541,7 @@ AC_DEFUN([LC_CONFIGURE],
 [LC_CONFIG_OBD_BUFFER_SIZE
 
 # include/liblustre.h
-AC_CHECK_HEADERS([asm/page.h sys/user.h stdint.h])
+AC_CHECK_HEADERS([asm/page.h sys/user.h sys/vfs.h stdint.h])
 
 # include/lustre/lustre_user.h
 # See note there re: __ASM_X86_64_PROCESSOR_H
index 559d2de..d11c8d6 100644 (file)
@@ -50,6 +50,9 @@ static inline int32_t ext2_clear_bit(int nr, void *a)
        return old;
 }
 
+struct nameidata;
+
+#if !defined(__DARWIN8__)
 static inline int ll_path_lookup(const char *path, unsigned int flags, struct nameidata *nd)
 {
        int ret = 0;
@@ -59,6 +62,7 @@ static inline int ll_path_lookup(const char *path, unsigned int flags, struct na
        }
        return ret;
 }
+#endif
 
 #define to_kdev_t(dev)                  (dev)
 #define kdev_t_to_nr(dev)               (dev)
@@ -66,6 +70,6 @@ static inline int ll_path_lookup(const char *path, unsigned int flags, struct na
 
 #define ext2_test_bit  test_bit
 
-#endif /* !__KERNEL__ */
+#endif /* __KERNEL__ */
 
 #endif
index 605d1e4..5adadae 100644 (file)
@@ -55,12 +55,17 @@ struct obd_ioctl_data;
 #ifdef __KERNEL__
 static inline sigset_t l_w_e_set_sigs(sigset_t sigs)
 {
-        struct proc     *p = current_proc();
-        sigset_t old;
+        sigset_t old = 0;
 
+        /* XXX Liang: how to change sigmask in Darwin8.x? 
+         * there is syscall like pthread_sigmask() but we cannot 
+         * use in kernel  */
+#if !defined(__DARWIN8__)
+        struct proc     *p = current_proc();
         extern int block_procsigmask(struct proc *p,  int bit);
         old = cfs_current()->uu_sigmask;
         block_procsigmask(p, ~sigs);
+#endif
 
         return old;
 }
index 4bd448f..f028545 100644 (file)
@@ -28,7 +28,6 @@
 #endif
 
 #include <libcfs/libcfs.h>
-#include <netat/sysglue.h>
 
 #undef WITH_GROUP_INFO
 
index 7aad75f..a495e60 100644 (file)
 # include <string.h>
 #endif
 
-#if defined(__KERNEL__)
 typedef struct stat     lstat_t;
 #define HAVE_LOV_USER_MDS_DATA
-#endif
 
 #ifndef LPU64
-/* x86_64 defines __u64 as "long" in userspace, but "long long" in the kernel */
-#if defined(__x86_64__) && defined(__KERNEL__)
-# define LPU64 "%Lu"
-# define LPD64 "%Ld"
-# define LPX64 "%#Lx"
-# define LPSZ  "%lu"
-# define LPSSZ "%ld"
-#elif (BITS_PER_LONG == 32 || __WORDSIZE == 32)
-# define LPU64 "%Lu"
-# define LPD64 "%Ld"
-# define LPX64 "%#Lx"
+#if (BITS_PER_LONG == 32 || __WORDSIZE == 32)
+# define LPU64 "%llu"
+# define LPD64 "%lld"
+# define LPX64 "%#llx"
 # define LPSZ  "%u"
 # define LPSSZ "%d"
 #elif (BITS_PER_LONG == 64 || __WORDSIZE == 64)
index eef0332..833da61 100644 (file)
@@ -27,6 +27,8 @@
 #error Do not #include this file directly. #include <obd_class.h> instead
 #endif
 
-#define to_kdev_t(dev) dev
+#if !defined(__KERNEL__)
+#define to_kdev_t(dev)          (dev)
+#endif
 
 #endif /* __XNU_OBD_CLASS_H */
diff --git a/lustre/include/darwin/types.h b/lustre/include/darwin/types.h
new file mode 100644 (file)
index 0000000..548ab38
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef _LUSTRE_DARWIN_TYPES_H
+#define _LUSTRE_DARWIN_TYPES_H
+
+#include <libcfs/libcfs.h>
+
+#endif
index 662f702..6187482 100644 (file)
@@ -57,7 +57,9 @@
 #include <string.h>
 #include <errno.h>
 #include <sys/stat.h>
-#include <sys/vfs.h>
+#ifdef HAVE_SYS_VFS_H
+# include <sys/vfs.h>
+#endif
 #include <unistd.h>
 #include <fcntl.h>
 
@@ -821,13 +823,6 @@ typedef struct file_lock {
 #define QUOTA_OK 0
 #define NO_QUOTA 1
 
-/* proc */
-#define proc_symlink(...)                       \
-({                                              \
-        void *result = NULL;                    \
-        result;                                 \
-})
-
 /* ACL */
 struct posix_acl_entry {
         short                   e_tag;
index 70d4d03..762c6b9 100644 (file)
@@ -9,7 +9,7 @@ if UTILS
 linux_HEADERS = lustre_idl.h
 endif
 
-EXTRA_DIST = lprocfs_status.h lustre_debug.h lustre_lib.h \
+EXTRA_DIST = lprocfs_status.h lustre_debug.h lustre_lib.h types.h\
   lustre_dlm.h lustre_handles.h lustre_net.h obd_class.h obd_support.h  \
   lustre_log.h lustre_compat25.h lustre_fsfilt.h lustre_mds.h obd.h \
   lvfs.h lvfs_linux.h lustre_lite.h  lustre_idl.h lustre_quota.h lustre_user.h
index 1a757c3..dd4723d 100644 (file)
 #include <lustre/types.h>
 #endif
 
-#ifdef HAVE_QUOTA_SUPPORT
-#include <linux/quota.h>
-#endif
 
 #ifndef __KERNEL__
-#define NEED_QUOTA_DEFS
+# define NEED_QUOTA_DEFS
+# ifdef HAVE_QUOTA_SUPPORT
+#  include <sys/quota.h>
+# endif
 #else
 # include <linux/version.h>
 # if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,21)
 #  define NEED_QUOTA_DEFS
 # endif
+# ifdef HAVE_QUOTA_SUPPORT
+#  include <linux/quota.h>
+# endif
 #endif
 
 /*
diff --git a/lustre/include/linux/types.h b/lustre/include/linux/types.h
new file mode 100644 (file)
index 0000000..1adf66c
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef _LUSTRE_LINUX_TYPES_H
+#define _LUSTRE_LINUX_TYPES_H
+
+typedef unsigned short umode_t;
+
+#if (!defined(_LINUX_TYPES_H) && !defined(_BLKID_TYPES_H) && \
+       !defined(_EXT2_TYPES_H) && !defined(_I386_TYPES_H))
+
+/*
+ * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
+ * header files exported to user space
+ */
+
+typedef __signed__ char __s8;
+typedef unsigned char __u8;
+
+typedef __signed__ short __s16;
+typedef unsigned short __u16;
+
+typedef __signed__ int __s32;
+typedef unsigned int __u32;
+
+typedef __signed__ long long __s64;
+typedef unsigned long long __u64;
+#endif
+
+#endif
index 5389d37..bc3f4e9 100644 (file)
@@ -1,27 +1,14 @@
 #ifndef _LUSTRE_TYPES_H
 #define _LUSTRE_TYPES_H
 
-typedef unsigned short umode_t;
-
-#if (!defined(_LINUX_TYPES_H) && !defined(_BLKID_TYPES_H) && \
-       !defined(_EXT2_TYPES_H) && !defined(_I386_TYPES_H))
-
-/*
- * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
- * header files exported to user space
- */
-
-typedef __signed__ char __s8;
-typedef unsigned char __u8;
-
-typedef __signed__ short __s16;
-typedef unsigned short __u16;
-
-typedef __signed__ int __s32;
-typedef unsigned int __u32;
-
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__linux__)
+#include <linux/types.h>
+#elif defined(__APPLE__)
+#include <darwin/types.h>
+#elif defined(__WINNT__)
+#include <winnt/types.h>
+#else
+#error Unsupported operating system.
 #endif
 
 #endif
index deaba07..58ad7b6 100644 (file)
@@ -587,7 +587,7 @@ do {                                                                           \
             }                                                                  \
             if (condition)                                                     \
                     break;                                                     \
-            if (cfs_signal_pending(cfs_current())) {                           \
+            if (cfs_signal_pending()) {                                        \
                     if (!info->lwi_timeout || __timed_out) {                   \
                             break;                                             \
                     } else {                                                   \
@@ -598,9 +598,9 @@ do {                                                                           \
                             /* -EINTR when the RPC actually succeeded.      */ \
                             /* the RECALC_SIGPENDING below will deliver the */ \
                             /* signal properly.                             */ \
-                            cfs_sigmask_lock(cfs_current(), irqflags);         \
-                            cfs_clear_sigpending(cfs_current());               \
-                            cfs_sigmask_unlock(cfs_current(), irqflags);       \
+                            cfs_sigmask_lock(irqflags);                        \
+                            cfs_clear_sigpending();                            \
+                            cfs_sigmask_unlock(irqflags);                      \
                     }                                                          \
             }                                                                  \
         }                                                                      \
@@ -608,7 +608,7 @@ do {                                                                           \
         cfs_block_sigs(blocked);                                               \
                                                                                \
         if ((!info->lwi_timeout || __timed_out) &&                             \
-            cfs_signal_pending(cfs_current())) {                               \
+            cfs_signal_pending()) {                                            \
                 if (info->lwi_on_signal)                                       \
                         info->lwi_on_signal(info->lwi_cb_data);                \
                 ret = -EINTR;                                                  \
index 54bb279..0692bf0 100644 (file)
@@ -586,7 +586,7 @@ obd_lvfs_fid2dentry(struct obd_export *exp, __u64 id_ino, __u32 gen, __u64 gr)
  * If the cache is older than @max_age we will get a new value from the
  * target.  Use a value of "jiffies + HZ" to guarantee freshness. */
 static inline int obd_statfs(struct obd_device *obd, struct obd_statfs *osfs,
-                             unsigned long max_age)
+                             cfs_time_t max_age)
 {
         int rc = 0;
         ENTRY;
@@ -597,8 +597,9 @@ static inline int obd_statfs(struct obd_device *obd, struct obd_statfs *osfs,
         OBD_CHECK_OP(obd, statfs, -EOPNOTSUPP);
         OBD_COUNTER_INCREMENT(obd, statfs);
 
-        CDEBUG(D_SUPER, "osfs %lu, max_age %lu\n", obd->obd_osfs_age, max_age);
-        if (time_before(obd->obd_osfs_age, max_age)) {
+        CDEBUG(D_SUPER, "osfs "CFS_TIME_T", max_age "CFS_TIME_T"\n", 
+               obd->obd_osfs_age, max_age);
+        if (cfs_time_before(obd->obd_osfs_age, max_age)) {
                 rc = OBP(obd, statfs)(obd, osfs, max_age);
                 if (rc == 0) {
                         spin_lock(&obd->obd_osfs_lock);
@@ -688,7 +689,7 @@ static inline int obd_brw_async(int cmd, struct obd_export *exp,
 static inline  int obd_prep_async_page(struct obd_export *exp,
                                        struct lov_stripe_md *lsm,
                                        struct lov_oinfo *loi,
-                                       struct page *page, obd_off offset,
+                                       cfs_page_t *page, obd_off offset,
                                        struct obd_async_page_ops *ops,
                                        void *data, void **res)
 {
index b3818d4..006f794 100644 (file)
         <string>1.0.0</string>
        <key>OSBundleLibraries</key>
        <dict>
-                <key>com.apple.kernel.bsd</key>
-                <string>1.1</string>
-                <key>com.apple.kernel.iokit</key>
-                <string>1.0.0b1</string>
-                <key>com.apple.kernel.mach</key>
-                <string>1.0.0b1</string>
-                <key>com.clusterfs.lustre.libcfs</key>
-                <string>1.0.0</string>
-                <key>com.clusterfs.lustre.portals</key>
-                <string>1.0.0</string>
-                <key>com.clusterfs.lustre.lvfs</key>
-                <string>1.0.0</string>
-                <key>com.clusterfs.lustre.obdclass</key>
-                <string>1.0.0</string>
-                <key>com.clusterfs.lustre.osc</key>
-                <string>1.0.0</string>
+               <key>com.apple.kpi.bsd</key>
+               <string>8.0.0b1</string>
+               <key>com.apple.kpi.libkern</key>
+               <string>8.0.0b1</string>
+               <key>com.apple.kpi.mach</key>
+               <string>8.0.0b1</string>
+               <key>com.clusterfs.lustre.libcfs</key>
+               <string>1.0.0</string>
+               <key>com.clusterfs.lustre.lvfs</key>
+               <string>1.0.0</string>
+               <key>com.clusterfs.lustre.obdclass</key>
+               <string>1.0.0</string>
+               <key>com.clusterfs.lustre.ptlrpc</key>
+               <string>1.0.0</string>
        </dict>
 </dict>
 </plist>
index 9eb1aaa..0ade64c 100644 (file)
@@ -34,11 +34,13 @@ lov_LDADD := $(EXTRA_KLIBS)
 
 plist_DATA := Info.plist
 
-#install-data-hook: fix-kext-ownership
+install_data_hook := fix-kext-ownership
 
 endif # DARWIN
 
 endif # MODULES
 
+install-data-hook: $(install_data_hook)
+
 DIST_SOURCES = $(lov-objs:.o=.c) lov_internal.h
 MOSTLYCLEANFILES := @MOSTLYCLEANFILES@ 
index 51b70ed..44439e2 100644 (file)
        <key>OSBundleCompatibleVersion</key> 
        <string>1.0.0</string>
        <key>OSBundleLibraries</key>
-       <dict> 
-               <key>com.apple.kernel.bsd</key> 
-               <string>1.1</string> 
-               <key>com.apple.kernel.iokit</key> 
-               <string>1.0.0b1</string> 
-               <key>com.apple.kernel.mach</key> 
-               <string>1.0.0b1</string> 
+       <dict>
+               <key>com.apple.kpi.bsd</key>
+               <string>8.0.0b1</string>
+               <key>com.apple.kpi.libkern</key>
+               <string>8.0.0b1</string>
+               <key>com.apple.kpi.mach</key>
+               <string>8.0.0b1</string>
+               <key>com.apple.kpi.unsupported</key>
+               <string>8.0.0b1</string>
                <key>com.clusterfs.lustre.libcfs</key> 
-               <string>1.0.0</string> 
-               <key>com.clusterfs.lustre.lnet</key> 
                <string>1.0.0</string>
        </dict>
 </dict>
index a1c6a31..9185580 100644 (file)
@@ -59,7 +59,7 @@ lvfs_LDADD := $(EXTRA_KLIBS)
 
 plist_DATA := Info.plist
 
-#install-data-hook: fix-kext-ownership
+install_data_hook := fix-kext-ownership
 
 endif # DARWIN
 
@@ -69,6 +69,8 @@ sources:
 
 endif # MODULES
 
+install-data-hook: $(install_data_hook)
+
 DIST_SOURCES = fsfilt.c fsfilt_ext3.c fsfilt_reiserfs.c lvfs_common.c \
        lvfs_internal.h lvfs_linux.c lvfs_userfs.c \
        upcall_cache.c \
index 6315aab..1feb31c 100644 (file)
@@ -21,24 +21,11 @@ void pop_ctxt(struct lvfs_run_ctxt *saved, struct lvfs_run_ctxt *new_ctx,
        LBUG();
 }
 
-int lvfs_arch_init(void)
-{
-       return 0;
-}
-
-void lvfs_arch_exit(void)
-{
-       return;
-}
-
-
 static int __init lvfs_init(void)
 {
        int ret = 0;
        ENTRY;
 
-       ret = lvfs_arch_init();
-
        RETURN(ret);
 }
 
@@ -47,7 +34,6 @@ static void __exit lvfs_exit(void)
        int leaked;
        ENTRY;
        
-       lvfs_arch_exit();
        leaked = atomic_read(&obd_memory);
        CDEBUG(leaked ? D_ERROR : D_INFO,
               "obd mem max: %d leaked: %d\n", obd_memmax, leaked);
index 5e8312c..0b7e718 100644 (file)
         <string>1.0.0</string>
        <key>OSBundleLibraries</key>
        <dict>
-                <key>com.apple.kernel.bsd</key>
-                <string>1.1</string>
-                <key>com.apple.kernel.iokit</key>
-                <string>1.0.0b1</string>
-                <key>com.apple.kernel.mach</key>
-                <string>1.0.0b1</string>
+               <key>com.apple.kpi.bsd</key>
+               <string>8.0.0b1</string>
+               <key>com.apple.kpi.libkern</key>
+               <string>8.0.0b1</string>
+               <key>com.apple.kpi.mach</key>
+               <string>8.0.0b1</string>
+               <key>com.apple.kpi.unsupported</key>
+               <string>8.0.0b1</string>
                 <key>com.clusterfs.lustre.libcfs</key>
                 <string>1.0.0</string>
-                <key>com.clusterfs.lustre.lnet</key>
-                <string>1.0.0</string>
                 <key>com.clusterfs.lustre.lvfs</key>
                 <string>1.0.0</string>
        </dict>
index 1ee08d0..b31e2c5 100644 (file)
@@ -40,11 +40,14 @@ obdclass_LDADD := $(EXTRA_KLIBS)
 
 plist_DATA := Info.plist
 
-#install-data-hook: fix-kext-ownership
+install_data_hook := fix-kext-ownership
+
 endif # DARWIN
 
 endif # MODULES
 
+install-data-hook: $(install_data_hook)
+
 MOSTLYCLEANFILES := @MOSTLYCLEANFILES@  llog-test.c
 MOSTLYCLEANFILES += linux/*.o darwin/*.o
 DIST_SOURCES = $(filter-out llog-test.c,$(obdclass-all-objs:.o=.c)) $(llog-test-objs:.o=.c) llog_test.c llog_internal.h
index 44b2103..456ce2a 100644 (file)
@@ -448,8 +448,8 @@ int obd_init_checks(void)
                 CWARN("LPD64 wrong length! strlen(%s)=%d != 2\n", buf, len);
                 ret = -EINVAL;
         }
-        if ((u64val & ~PAGE_MASK) >= PAGE_SIZE) {
-                CWARN("mask failed: u64val "LPU64" >= %lu\n", u64val,PAGE_SIZE);
+        if ((u64val & ~CFS_PAGE_MASK) >= CFS_PAGE_SIZE) {
+                CWARN("mask failed: u64val "LPU64" >= %lu\n", u64val,CFS_PAGE_SIZE);
                 ret = -EINVAL;
         }
 
index 62f937b..87d0554 100644 (file)
@@ -117,7 +117,7 @@ obd_class_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct proc *p)
        int err = 0;
        ENTRY;
 
-       if (suser(p->p_ucred, &p->p_acflag))
+       if (!is_suser())
                RETURN (-EPERM);
        if (obd_psdev_ops.p_ioctl != NULL)
                err = obd_psdev_ops.p_ioctl(NULL, cmd, (void *)arg);
index 645080c..d2ce8c1 100644 (file)
@@ -82,10 +82,10 @@ int proc_fail_loc SYSCTL_HANDLER_ARGS
        int old_fail_loc = obd_fail_loc;
        
        error = sysctl_handle_long(oidp, oidp->oid_arg1, oidp->oid_arg2, req); 
-       if (!error && req->newptr != NULL) {
+       if (!error && req->newptr != USER_ADDR_NULL) {
                if (old_fail_loc != obd_fail_loc) 
                        cfs_waitq_signal(&obd_race_waitq);
-       } else  if (req->newptr != NULL) { 
+       } else  if (req->newptr != USER_ADDR_NULL) { 
                /* Something was wrong with the write request */ 
                printf ("sysctl fail loc fault: %d.\n", error);
        } else { 
index fd4db0c..19a6096 100644 (file)
        <string>1.0.0</string>
        <key>OSBundleLibraries</key>
        <dict> 
-               <key>com.apple.kernel.bsd</key> 
-               <string>1.1</string> 
-               <key>com.apple.kernel.iokit</key> 
-               <string>1.0.0b1</string> 
-               <key>com.apple.kernel.mach</key> 
-               <string>1.0.0b1</string> 
+               <key>com.apple.kpi.bsd</key>
+               <string>8.0.0b1</string>
+               <key>com.apple.kpi.libkern</key>
+               <string>8.0.0b1</string>
+               <key>com.apple.kpi.mach</key>
+               <string>8.0.0b1</string>
+                <key>com.apple.kpi.unsupported</key>
+               <string>8.0.0b1</string>
                <key>com.clusterfs.lustre.libcfs</key> 
-               <string>1.0.0</string> 
-               <key>com.clusterfs.lustre.lnet</key> 
-               <string>1.0.0</string> 
+               <string>1.0.0</string>
                <key>com.clusterfs.lustre.lvfs</key> 
                <string>1.0.0</string>
                <key>com.clusterfs.lustre.obdclass</key> 
index b1489b6..d08aa57 100644 (file)
@@ -28,10 +28,13 @@ obdecho_LDADD := $(EXTRA_KLIBS)
 
 plist_DATA := Info.plist
 
-#install-data-hook: fix-kext-ownership
+install_data_hook := fix-kext-ownership
+
 endif # darwin
 
 endif # MODULES
 
+install-data-hook: $(install_data_hook)
+
 MOSTLYCLEANFILES := @MOSTLYCLEANFILES@ 
 DIST_SOURCES = $(obdecho-objs:%.o=%.c)
index cb3f391..727980d 100644 (file)
        <string>1.0.0</string>
        <key>OSBundleLibraries</key>
        <dict> 
-               <key>com.apple.kernel.bsd</key> 
-               <string>1.1</string> 
-               <key>com.apple.kernel.iokit</key> 
-               <string>1.0.0b1</string> 
-               <key>com.apple.kernel.mach</key> 
-               <string>1.0.0b1</string> 
+                <key>com.apple.kpi.bsd</key>
+               <string>8.0.0b1</string>
+               <key>com.apple.kpi.libkern</key>
+               <string>8.0.0b1</string>
+               <key>com.apple.kpi.mach</key>
+               <string>8.0.0b1</string>
+               <key>com.apple.kpi.unsupported</key>
+               <string>8.0.0b1</string>
                <key>com.clusterfs.lustre.libcfs</key> 
-               <string>1.0.0</string> 
-               <key>com.clusterfs.lustre.lnet</key> 
-               <string>1.0.0</string> 
+               <string>1.0.0</string>
                <key>com.clusterfs.lustre.lvfs</key> 
                <string>1.0.0</string>
                <key>com.clusterfs.lustre.obdclass</key> 
index 2bef826..c9f2fbb 100644 (file)
@@ -29,10 +29,13 @@ osc_LDADD := $(EXTRA_KLIBS)
 
 plist_DATA := Info.plist
 
-#install-data-hook: fix-kext-ownership
+install_data_hook := fix-kext-ownership
+
 endif # Darwin
 
 endif
 
+install-data-hook: $(install_data_hook)
+
 MOSTLYCLEANFILES := @MOSTLYCLEANFILES@ 
 DIST_SOURCES = $(osc-objs:%.o=%.c) osc_internal.h
index 19be08f..557e036 100644 (file)
@@ -180,7 +180,8 @@ int osc_create(struct obd_export *exp, struct obdo *oa,
                         CDEBUG(D_HA,"%p: oscc recovery in progress, waiting\n",
                                oscc);
 
-                        lwi = LWI_TIMEOUT(MAX(obd_timeout*HZ/4, 1), NULL, NULL);
+                        lwi = LWI_TIMEOUT(cfs_timeout_cap(cfs_time_seconds(obd_timeout/4)),
+                                          NULL, NULL);
                         rc = l_wait_event(oscc->oscc_waitq,
                                           !oscc_recovering(oscc), &lwi);
                         LASSERT(rc == 0 || rc == -ETIMEDOUT);
index 1382be4..667da17 100644 (file)
@@ -57,10 +57,6 @@ int osc_real_create(struct obd_export *exp, struct obdo *oa,
 void oscc_init(struct obd_device *obd);
 void osc_wake_cache_waiters(struct client_obd *cli);
 
-
-/* Quota stuff */
-extern quota_interface_t *quota_interface;
-
 #ifdef LPROCFS
 int lproc_osc_attach_seqstat(struct obd_device *dev);
 #else
index 1724794..0f80243 100644 (file)
@@ -57,6 +57,9 @@
 #include <lustre_debug.h>
 #include "osc_internal.h"
 
+static quota_interface_t *quota_interface = NULL;
+extern quota_interface_t osc_quota_interface;
+
 /* Pack OSC object metadata for disk storage (LE byte order). */
 static int osc_packmd(struct obd_export *exp, struct lov_mds_md **lmmp,
                       struct lov_stripe_md *lsm)
@@ -558,7 +561,7 @@ static void osc_announce_cached(struct client_obd *cli, struct obdo *oa,
                        cli->cl_dirty, cli->cl_dirty_max);
                 oa->o_undirty = 0;
         } else {
-                long max_in_flight = (cli->cl_max_pages_per_rpc << PAGE_SHIFT)*
+                long max_in_flight = (cli->cl_max_pages_per_rpc << CFS_PAGE_SHIFT)*
                                 (cli->cl_max_rpcs_in_flight + 1);
                 oa->o_undirty = max(cli->cl_dirty_max, max_in_flight);
         }
@@ -574,10 +577,10 @@ static void osc_announce_cached(struct client_obd *cli, struct obdo *oa,
 static void osc_consume_write_grant(struct client_obd *cli,
                                     struct osc_async_page *oap)
 {
-        cli->cl_dirty += PAGE_SIZE;
-        cli->cl_avail_grant -= PAGE_SIZE;
+        cli->cl_dirty += CFS_PAGE_SIZE;
+        cli->cl_avail_grant -= CFS_PAGE_SIZE;
         oap->oap_brw_flags |= OBD_BRW_FROM_GRANT;
-        CDEBUG(D_CACHE, "using %lu grant credits for oap %p\n", PAGE_SIZE, oap);
+        CDEBUG(D_CACHE, "using %lu grant credits for oap %p\n", CFS_PAGE_SIZE, oap);
         LASSERT(cli->cl_avail_grant >= 0);
 }
 
@@ -595,7 +598,7 @@ void osc_wake_cache_waiters(struct client_obd *cli)
         ENTRY;
         list_for_each_safe(l, tmp, &cli->cl_cache_waiters) {
                 /* if we can't dirty more, we must wait until some is written */
-                if (cli->cl_dirty + PAGE_SIZE > cli->cl_dirty_max) {
+                if (cli->cl_dirty + CFS_PAGE_SIZE > cli->cl_dirty_max) {
                         CDEBUG(D_CACHE, "no dirty room: dirty: %ld max %ld\n",
                                cli->cl_dirty, cli->cl_dirty_max);
                         return;
@@ -603,7 +606,7 @@ void osc_wake_cache_waiters(struct client_obd *cli)
 
                 /* if still dirty cache but no grant wait for pending RPCs that
                  * may yet return us some grant before doing sync writes */
-                if (cli->cl_w_in_flight && cli->cl_avail_grant < PAGE_SIZE) {
+                if (cli->cl_w_in_flight && cli->cl_avail_grant < CFS_PAGE_SIZE) {
                         CDEBUG(D_CACHE, "%u BRW writes in flight, no grant\n",
                                cli->cl_w_in_flight);
                         return;
@@ -611,7 +614,7 @@ void osc_wake_cache_waiters(struct client_obd *cli)
 
                 ocw = list_entry(l, struct osc_cache_waiter, ocw_entry);
                 list_del_init(&ocw->ocw_entry);
-                if (cli->cl_avail_grant < PAGE_SIZE) {
+                if (cli->cl_avail_grant < CFS_PAGE_SIZE) {
                         /* no more RPCs in flight to return grant, do sync IO */
                         ocw->ocw_rc = -EDQUOT;
                         CDEBUG(D_INODE, "wake oap %p for sync\n", ocw->ocw_oap);
@@ -649,7 +652,7 @@ static void handle_short_read(int nob_read, obd_count page_count,
 
                 if (pga->count > nob_read) {
                         /* EOF inside this page */
-                        ptr = cfs_kmap(pga->pg) + (pga->off & ~PAGE_MASK);
+                        ptr = cfs_kmap(pga->pg) + (pga->off & ~CFS_PAGE_MASK);
                         memset(ptr + nob_read, 0, pga->count - nob_read);
                         cfs_kunmap(pga->pg);
                         page_count--;
@@ -664,7 +667,7 @@ static void handle_short_read(int nob_read, obd_count page_count,
 
         /* zero remaining pages */
         while (page_count-- > 0) {
-                ptr = cfs_kmap(pga->pg) + (pga->off & ~PAGE_MASK);
+                ptr = cfs_kmap(pga->pg) + (pga->off & ~CFS_PAGE_MASK);
                 memset(ptr, 0, pga->count);
                 cfs_kunmap(pga->pg);
                 pga++;
@@ -732,7 +735,7 @@ static obd_count osc_checksum_bulk(int nob, obd_count pg_count,
         LASSERT (pg_count > 0);
         while (nob > 0 && pg_count > 0) {
                 char *ptr = cfs_kmap(pga->pg);
-                int off = pga->off & ~PAGE_MASK;
+                int off = pga->off & ~CFS_PAGE_MASK;
                 int count = pga->count > nob ? nob : pga->count;
 
                 cksum = crc32_le(cksum, ptr + off, count);
@@ -809,7 +812,7 @@ static int osc_brw_prep_request(int cmd, struct obd_import *imp,struct obdo *oa,
                 struct brw_page *pg_prev = pg - 1;
 
                 LASSERT(pg->count > 0);
-                LASSERTF((pg->off & ~PAGE_MASK) + pg->count <= PAGE_SIZE,
+                LASSERTF((pg->off & ~CFS_PAGE_MASK) + pg->count <= CFS_PAGE_SIZE,
                          "i: %d pg: %p off: "LPU64", count: %u\n", i, pg,
                          pg->off, pg->count);
 #ifdef __LINUX__
@@ -827,7 +830,7 @@ static int osc_brw_prep_request(int cmd, struct obd_import *imp,struct obdo *oa,
                 LASSERT((pga[0].flag & OBD_BRW_SRVLOCK) ==
                         (pg->flag & OBD_BRW_SRVLOCK));
 
-                ptlrpc_prep_bulk_page(desc, pg->pg, pg->off & ~PAGE_MASK,
+                ptlrpc_prep_bulk_page(desc, pg->pg, pg->off & ~CFS_PAGE_MASK,
                                       pg->count);
                 requested_nob += pg->count;
 
@@ -1136,18 +1139,18 @@ static obd_count max_unfragmented_pages(struct brw_page *pg, obd_count pages)
         int offset;
 
        LASSERT (pages > 0);
-        offset = pg->off & (PAGE_SIZE - 1);
+        offset = pg->off & (CFS_PAGE_SIZE - 1);
 
        for (;;) {
                pages--;
                if (pages == 0)         /* that's all */
                         return count;
 
-                if (offset + pg->count < PAGE_SIZE)
+                if (offset + pg->count < CFS_PAGE_SIZE)
                        return count;   /* doesn't end on page boundary */
 
                pg++;
-                offset = pg->off & (PAGE_SIZE - 1);
+                offset = pg->off & (CFS_PAGE_SIZE - 1);
                if (offset != 0)        /* doesn't start on page boundary */
                        return count;
 
@@ -1666,7 +1669,7 @@ static int osc_send_oap_rpc(struct client_obd *cli, struct lov_oinfo *loi,
                 /* If there is a gap at the end of this page, it can't merge
                  * with any subsequent pages, so we'll hand the network a
                  * "fragmented" page array that it can't transfer in 1 RDMA */
-                if (oap->oap_page_off + oap->oap_count < PAGE_SIZE)
+                if (oap->oap_page_off + oap->oap_count < CFS_PAGE_SIZE)
                         break;
         }
 
@@ -1721,13 +1724,13 @@ static int osc_send_oap_rpc(struct client_obd *cli, struct lov_oinfo *loi,
                 lprocfs_oh_tally_log2(&cli->cl_read_page_hist, page_count);
                 lprocfs_oh_tally(&cli->cl_read_rpc_hist, cli->cl_r_in_flight);
                 lprocfs_oh_tally_log2(&cli->cl_read_offset_hist,
-                                      starting_offset/PAGE_SIZE + 1);
+                                      starting_offset/CFS_PAGE_SIZE + 1);
         } else {
                 lprocfs_oh_tally_log2(&cli->cl_write_page_hist, page_count);
                 lprocfs_oh_tally(&cli->cl_write_rpc_hist,
                                  cli->cl_w_in_flight);
                 lprocfs_oh_tally_log2(&cli->cl_write_offset_hist,
-                                      starting_offset/PAGE_SIZE + 1);
+                                      starting_offset/CFS_PAGE_SIZE + 1);
         }
 
         client_obd_list_lock(&cli->cl_loi_list_lock);
@@ -1894,13 +1897,13 @@ static int osc_enter_cache(struct client_obd *cli, struct lov_oinfo *loi,
 
         /* force the caller to try sync io.  this can jump the list
          * of queued writes and create a discontiguous rpc stream */
-        if (cli->cl_dirty_max < PAGE_SIZE || cli->cl_ar.ar_force_sync ||
+        if (cli->cl_dirty_max < CFS_PAGE_SIZE || cli->cl_ar.ar_force_sync ||
             loi->loi_ar.ar_force_sync)
                 RETURN(-EDQUOT);
 
         /* Hopefully normal case - cache space and write credits available */
-        if (cli->cl_dirty + PAGE_SIZE <= cli->cl_dirty_max &&
-            cli->cl_avail_grant >= PAGE_SIZE) {
+        if (cli->cl_dirty + CFS_PAGE_SIZE <= cli->cl_dirty_max &&
+            cli->cl_avail_grant >= CFS_PAGE_SIZE) {
                 /* account for ourselves */
                 osc_consume_write_grant(cli, oap);
                 RETURN(0);
@@ -1948,24 +1951,24 @@ static void osc_exit_cache(struct client_obd *cli, struct osc_async_page *oap,
         }
 
         oap->oap_brw_flags &= ~OBD_BRW_FROM_GRANT;
-        cli->cl_dirty -= PAGE_SIZE;
+        cli->cl_dirty -= CFS_PAGE_SIZE;
         if (!sent) {
-                cli->cl_lost_grant += PAGE_SIZE;
+                cli->cl_lost_grant += CFS_PAGE_SIZE;
                 CDEBUG(D_CACHE, "lost grant: %lu avail grant: %lu dirty: %lu\n",
                        cli->cl_lost_grant, cli->cl_avail_grant, cli->cl_dirty);
-        } else if (PAGE_SIZE != blocksize && oap->oap_count != PAGE_SIZE) {
+        } else if (CFS_PAGE_SIZE != blocksize && oap->oap_count != CFS_PAGE_SIZE) {
                 /* For short writes we shouldn't count parts of pages that
                  * span a whole block on the OST side, or our accounting goes
                  * wrong.  Should match the code in filter_grant_check. */
-                int offset = (oap->oap_obj_off +oap->oap_page_off) & ~PAGE_MASK;
+                int offset = (oap->oap_obj_off +oap->oap_page_off) & ~CFS_PAGE_MASK;
                 int count = oap->oap_count + (offset & (blocksize - 1));
                 int end = (offset + oap->oap_count) & (blocksize - 1);
                 if (end)
                         count += blocksize - end;
 
-                cli->cl_lost_grant += PAGE_SIZE - count;
+                cli->cl_lost_grant += CFS_PAGE_SIZE - count;
                 CDEBUG(D_CACHE, "lost %lu grant: %lu avail: %lu dirty: %lu\n",
-                       PAGE_SIZE - count, cli->cl_lost_grant,
+                       CFS_PAGE_SIZE - count, cli->cl_lost_grant,
                        cli->cl_avail_grant, cli->cl_dirty);
         }
 
@@ -1973,7 +1976,7 @@ static void osc_exit_cache(struct client_obd *cli, struct osc_async_page *oap,
 }
 
 int osc_prep_async_page(struct obd_export *exp, struct lov_stripe_md *lsm,
-                        struct lov_oinfo *loi, struct page *page,
+                        struct lov_oinfo *loi, cfs_page_t *page,
                         obd_off offset, struct obd_async_page_ops *ops,
                         void *data, void **res)
 {
@@ -2384,12 +2387,12 @@ static int sanosc_brw_read(struct obd_export *exp, struct obdo *oa,
                         CDEBUG(D_PAGE, "hole at ino %lu; index %ld\n",
                                         page->mapping->host->i_ino,
                                         page->index);
-                        memset(page_address(page), 0, PAGE_SIZE);
+                        memset(page_address(page), 0, CFS_PAGE_SIZE);
                         continue;
                 }
 
                 if (!page->buffers) {
-                        create_empty_buffers(page, dev, PAGE_SIZE);
+                        create_empty_buffers(page, dev, CFS_PAGE_SIZE);
                         bh = page->buffers;
 
                         clear_bit(BH_New, &bh->b_state);
@@ -2501,7 +2504,7 @@ static int sanosc_brw_write(struct obd_export *exp, struct obdo *oa,
                 dev = exp->exp_obd->u.cli.cl_sandev;
 
                 if (!page->buffers) {
-                        create_empty_buffers(page, dev, PAGE_SIZE);
+                        create_empty_buffers(page, dev, CFS_PAGE_SIZE);
                 } else {
                         /* checking */
                         LASSERT(!test_bit(BH_New, &page->buffers->b_state));
@@ -2634,8 +2637,8 @@ static int osc_enqueue(struct obd_export *exp, struct lov_stripe_md *lsm,
 
         /* Filesystem lock extents are extended to page boundaries so that
          * dealing with the page cache is a little smoother.  */
-        policy->l_extent.start -= policy->l_extent.start & ~PAGE_MASK;
-        policy->l_extent.end |= ~PAGE_MASK;
+        policy->l_extent.start -= policy->l_extent.start & ~CFS_PAGE_MASK;
+        policy->l_extent.end |= ~CFS_PAGE_MASK;
 
         if (lsm->lsm_oinfo->loi_kms_valid == 0)
                 goto no_match;
@@ -2733,8 +2736,8 @@ static int osc_match(struct obd_export *exp, struct lov_stripe_md *lsm,
 
         /* Filesystem lock extents are extended to page boundaries so that
          * dealing with the page cache is a little smoother */
-        policy->l_extent.start -= policy->l_extent.start & ~PAGE_MASK;
-        policy->l_extent.end |= ~PAGE_MASK;
+        policy->l_extent.start -= policy->l_extent.start & ~CFS_PAGE_MASK;
+        policy->l_extent.end |= ~CFS_PAGE_MASK;
 
         /* Next, search for already existing extent locks that will cover us */
         rc = ldlm_lock_match(obd->obd_namespace, *flags, &res_id, type,
@@ -3360,9 +3363,6 @@ struct obd_ops sanosc_obd_ops = {
 };
 #endif
 
-static quota_interface_t *quota_interface = NULL;
-extern quota_interface_t osc_quota_interface;
-
 int __init osc_init(void)
 {
         struct lprocfs_static_vars lvars;
index 51b70ed..2b7d35f 100644 (file)
@@ -5,11 +5,11 @@
        <key>CFBundleDevelopmentRegion</key>
        <string>English</string>
        <key>CFBundleExecutable</key>
-       <string>lvfs</string>
+       <string>ptlrpc</string>
        <key>CFBundleIconFile</key>
        <string></string>
        <key>CFBundleIdentifier</key>
-       <string>com.clusterfs.lustre.lvfs</string>
+       <string>com.clusterfs.lustre.ptlrpc</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundlePackageType</key>
        <string>1.0.0</string>
        <key>OSBundleLibraries</key>
        <dict> 
-               <key>com.apple.kernel.bsd</key> 
-               <string>1.1</string> 
-               <key>com.apple.kernel.iokit</key> 
-               <string>1.0.0b1</string> 
-               <key>com.apple.kernel.mach</key> 
-               <string>1.0.0b1</string> 
                <key>com.clusterfs.lustre.libcfs</key> 
                <string>1.0.0</string> 
                <key>com.clusterfs.lustre.lnet</key> 
                <string>1.0.0</string>
+               <key>com.clusterfs.lustre.obdclass</key> 
+               <string>1.0.0</string>
        </dict>
 </dict>
 </plist>
index 37803a9..9fd2781 100644 (file)
@@ -64,10 +64,13 @@ ptlrpc_LDADD := $(EXTRA_KLIBS)
 
 plist_DATA := Info.plist
 
-#install-data-hook: fix-kext-ownership
+install_data_hook := fix-kext-ownership
+
 endif # DARWIN
 
 endif # MODULES
 
+install-data-hook: $(install_data_hook)
+
 MOSTLYCLEANFILES := @MOSTLYCLEANFILES@  ldlm_*.c l_lock.c
 DIST_SOURCES = $(ptlrpc_objs:.o=.c) ptlrpc_internal.h
index dbb03f7..fa233e0 100644 (file)
@@ -1560,7 +1560,7 @@ restart:
         rc = ptl_send_rpc(req);
         if (rc) {
                 DEBUG_REQ(D_HA, req, "send failed (%d); recovering", rc);
-                timeout = cfs_time_minimal_timeout();
+                timeout = CFS_TICK;
         } else {
                 timeout = cfs_timeout_cap(cfs_time_seconds(req->rq_timeout));
                 DEBUG_REQ(D_NET, req, 
index ce5dad0..71c839f 100644 (file)
@@ -288,7 +288,7 @@ void ptlrpc_unregister_bulk (struct ptlrpc_request *req)
         for (;;) {
                 /* Network access will complete in finite time but the HUGE
                  * timeout lets us CWARN for visibility of sluggish NALs */
-                lwi = LWI_TIMEOUT (300 * HZ, NULL, NULL);
+                lwi = LWI_TIMEOUT (cfs_time_seconds(300), NULL, NULL);
                 rc = l_wait_event(*wq, !ptlrpc_bulk_active(desc), &lwi);
                 if (rc == 0)
                         return;
index 9471c85..dd4063f 100644 (file)
@@ -137,7 +137,7 @@ static struct ptlrpc_reply_state *lustre_get_emerg_rs(struct ptlrpc_service *svc
                 spin_unlock_irqrestore(&svc->srv_lock, flags);
                 /* If we cannot get anything for some long time, we better
                    bail out instead of waiting infinitely */
-                lwi = LWI_TIMEOUT(10 * HZ, NULL, NULL);
+                lwi = LWI_TIMEOUT(cfs_time_seconds(10), NULL, NULL);
                 rc = l_wait_event(svc->srv_free_rs_waitq,
                                   !list_empty(&svc->srv_free_rs_list), &lwi);
                 if (rc)
index a231f92..05c4a96 100644 (file)
@@ -192,7 +192,7 @@ static int ptlrpc_pinger_main(void *arg)
                             /* if the next ping is within, say, 5 jiffies from
                                now, go ahead and ping. See note below. */
                             cfs_time_aftereq(this_ping, 
-                                             imp->imp_next_ping - 5 * CFS_MIN_DELAY)) {
+                                             imp->imp_next_ping - 5 * CFS_TICK)) {
                                 if (level == LUSTRE_IMP_DISCON &&
                                     !imp->imp_deactive) {
                                         /* wait at least a timeout before
@@ -447,7 +447,7 @@ static int pinger_check_rpcs(void *arg)
                 unsigned long flags;
 
                 if (cfs_time_aftereq(pd->pd_this_ping, 
-                                     imp->imp_next_ping - 5 * CFS_MIN_DELAY)) {
+                                     imp->imp_next_ping - 5 * CFS_TICK)) {
                         /* Add a ping. */
                         spin_lock_irqsave(&imp->imp_lock, flags);
                         generation = imp->imp_generation;
index 9563334..3c17b11 100644 (file)
@@ -37,7 +37,7 @@ wirecheck_SOURCES = wirecheck.c
 wirecheck_CPPFLAGS = -DCC="\"$(CC)\""
 wiretest_SOURCES = wiretest.c
 
-lctl_SOURCES = parser.c obd.c lustre_cfg.c lctl.c parser.h obdctl.h 
+lctl_SOURCES = parser.c obd.c lustre_cfg.c lctl.c parser.h obdctl.h platform.h
 lload_SOURCES = lload.c 
 obdio_SOURCES = obdio.c obdiolib.c obdiolib.h
 obdbarrier_SOURCES = obdbarrier.c obdiolib.c obdiolib.h
index 9c23e77..513a5d7 100644 (file)
 #include <sys/param.h>
 #include <assert.h>
 
-#ifdef HAVE_LIBREADLINE
-#define READLINE_LIBRARY
-#include <readline/readline.h>
-
-/* completion_matches() is #if 0-ed out in modern glibc */
-#ifndef completion_matches
-#  define completion_matches rl_completion_matches
-#endif
-extern void using_history(void);
-extern void stifle_history(int);
-extern void add_history(char *);
-#endif
-
+#include "platform.h"
 #include "parser.h"
 
 static command_t * top_level;           /* Top level of commands, initialized by
diff --git a/lustre/utils/platform.h b/lustre/utils/platform.h
new file mode 100644 (file)
index 0000000..2a11e0f
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef __LUSTRE_UTILS_PLATFORM_H
+#define __LUSTRE_UTILS_PLATFORM_H
+
+#ifdef HAVE_LIBREADLINE
+# define READLINE_LIBRARY
+# include <readline/readline.h>
+
+/* completion_matches() is #if 0-ed out in modern glibc */
+# ifdef __linux__
+# ifndef completion_matches
+#   define completion_matches rl_completion_matches
+# endif
+  extern void using_history(void);
+  extern void stifle_history(int);
+  extern void add_history(char *);
+# elif __APPLE__
+  typedef VFunction       rl_vintfunc_t;
+  typedef VFunction       rl_voidfunc_t;
+# else
+# endif /* __linux__ */
+
+#endif /* HAVE_LIBREADLINE */
+
+#endif