Whamcloud - gitweb
LU-6245 libcfs: Remove kp30.h 60/19460/2
authorJames Simmons <uja.ornl@yahoo.com>
Mon, 11 Apr 2016 21:42:00 +0000 (17:42 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 4 May 2016 15:01:03 +0000 (15:01 +0000)
The header kp30.h contains various wrappers to handle things
like module parameter handling. We can now remove this
abstraction.

Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Change-Id: I7f5fec4372023146215c740e287529a05dfceba6
Reviewed-on: http://review.whamcloud.com/19460
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Frank Zago <fzago@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
libcfs/include/libcfs/libcfs_private.h
libcfs/include/libcfs/linux/Makefile.am
libcfs/include/libcfs/linux/kp30.h [deleted file]
libcfs/include/libcfs/linux/libcfs.h
libcfs/include/libcfs/linux/linux-misc.h [new file with mode: 0644]
lustre/llite/llite_lib.c
lustre/osc/osc_io.c

index 44704ea..47197b3 100644 (file)
@@ -434,10 +434,6 @@ do {                                                            \
 /* logical equivalence */
 #define equi(a, b) (!!(a) == !!(b))
 
 /* logical equivalence */
 #define equi(a, b) (!!(a) == !!(b))
 
-#ifndef CFS_CURRENT_TIME
-# define CFS_CURRENT_TIME time(0)
-#endif
-
 /* what used to be in portals_lib.h */
 #ifndef MIN
 # define MIN(a,b) (((a)<(b)) ? (a): (b))
 /* what used to be in portals_lib.h */
 #ifndef MIN
 # define MIN(a,b) (((a)<(b)) ? (a): (b))
index b1aa817..f19c8c5 100644 (file)
@@ -1,2 +1,2 @@
-EXTRA_DIST = kp30.h libcfs.h linux-fs.h linux-mem.h linux-time.h linux-cpu.h \
+EXTRA_DIST = libcfs.h linux-misc.h linux-fs.h linux-mem.h linux-time.h linux-cpu.h \
             linux-crypto.h
             linux-crypto.h
diff --git a/libcfs/include/libcfs/linux/kp30.h b/libcfs/include/libcfs/linux/kp30.h
deleted file mode 100644 (file)
index f5036e2..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * 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.
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2011, 2014, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- */
-
-#ifndef __LIBCFS_LINUX_KP30_H__
-#define __LIBCFS_LINUX_KP30_H__
-
-
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/string.h>
-#include <linux/stat.h>
-#include <linux/init.h>
-#include <linux/errno.h>
-#include <linux/unistd.h>
-#include <linux/kmod.h>
-#include <linux/notifier.h>
-#include <linux/fs.h>
-#include <linux/miscdevice.h>
-#include <linux/vmalloc.h>
-#include <linux/time.h>
-#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/highmem.h>
-#include <linux/module.h>
-#include <linux/version.h>
-#include <asm/atomic.h>
-#include <asm/uaccess.h>
-#include <linux/rwsem.h>
-#include <linux/proc_fs.h>
-#include <linux/file.h>
-#include <linux/smp.h>
-#include <linux/ctype.h>
-#include <linux/compiler.h>
-#ifdef HAVE_MM_INLINE
-# include <linux/mm_inline.h>
-#endif
-#include <linux/kallsyms.h>
-#include <linux/moduleparam.h>
-#include <linux/scatterlist.h>
-
-/******************************************************************************/
-/* Module parameter support */
-#define CFS_MODULE_PARM(name, t, type, perm, desc) \
-        module_param(name, type, perm);\
-        MODULE_PARM_DESC(name, desc)
-
-#define CFS_SYSFS_MODULE_PARM  1 /* module parameters accessible via sysfs */
-
-/******************************************************************************/
-
-#if (__GNUC__)
-/* Use the special GNU C __attribute__ hack to have the compiler check the
- * printf style argument string against the actual argument count and
- * types.
- */
-#ifdef printf
-# warning printf has been defined as a macro...
-# undef printf
-#endif
-
-#endif /* __GNUC__ */
-
-# define fprintf(a, format, b...) CDEBUG(D_OTHER, format , ## b)
-# define printf(format, b...) CDEBUG(D_OTHER, format , ## b)
-# define time(a) CURRENT_TIME
-
-#ifdef HAVE_SYSCTL_CTLNAME
-#define INIT_CTL_NAME  .ctl_name = CTL_UNNUMBERED,
-#define INIT_STRATEGY  .strategy = &sysctl_intvec,
-#else
-#define INIT_CTL_NAME
-#define INIT_STRATEGY
-#endif
-
-#endif
index c939ba1..2bfa8f2 100644 (file)
 #error This include is only for kernel use.
 #endif
 
 #error This include is only for kernel use.
 #endif
 
-
+#include <linux/bitops.h>
+#include <linux/compiler.h>
+#include <linux/ctype.h>
+#include <linux/errno.h>
+#include <linux/file.h>
+#include <linux/fs.h>
+#include <linux/highmem.h>
+#include <linux/interrupt.h>
+#include <linux/kallsyms.h>
+#include <linux/kernel.h>
+#include <linux/kmod.h>
+#include <linux/kthread.h>
+#include <linux/miscdevice.h>
+#include <linux/mm.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/mutex.h>
+#include <linux/notifier.h>
+#include <linux/random.h>
+#include <linux/rbtree.h>
+#include <linux/rwsem.h>
+#include <linux/scatterlist.h>
+#include <linux/sched.h>
+#include <linux/signal.h>
+#include <linux/slab.h>
+#include <linux/smp.h>
+#include <linux/stat.h>
+#include <linux/string.h>
+#include <linux/time.h>
+#include <linux/timer.h>
+#include <linux/types.h>
+#include <linux/unistd.h>
+#include <linux/vmalloc.h>
+#include <net/sock.h>
+#include <linux/atomic.h>
+#include <asm/div64.h>
+#include <linux/timex.h>
+#include <linux/uaccess.h>
 #include <stdarg.h>
 #include <stdarg.h>
+
 #include <libcfs/linux/linux-cpu.h>
 #include <libcfs/linux/linux-time.h>
 #include <libcfs/linux/linux-mem.h>
 #include <libcfs/linux/linux-cpu.h>
 #include <libcfs/linux/linux-time.h>
 #include <libcfs/linux/linux-mem.h>
+#include <libcfs/linux/linux-misc.h>
 #include <libcfs/linux/linux-fs.h>
 #include <libcfs/linux/linux-fs.h>
-#include <libcfs/linux/kp30.h>
-
-#ifdef HAVE_ASM_TYPES_H
-#include <asm/types.h>
-#endif
-#include <linux/types.h>
-#include <asm/timex.h>
-#include <linux/sched.h> /* THREAD_SIZE */
-#include <linux/rbtree.h>
-#include <linux/bitops.h>
-#include <linux/capability.h>
 
 #if !defined(__x86_64__)
 # ifdef  __ia64__
 
 #if !defined(__x86_64__)
 # ifdef  __ia64__
@@ -107,18 +135,6 @@ int lprocfs_call_handler(void *data, int write, loff_t *ppos,
                         int (*handler)(void *data, int write,
                         loff_t pos, void __user *buffer, int len));
 
                         int (*handler)(void *data, int write,
                         loff_t pos, void __user *buffer, int len));
 
-#ifndef HAVE_KSTRTOUL
-static inline int kstrtoul(const char *s, unsigned int base, unsigned long *res)
-{
-       char *end = (char *)s;
-
-       *res = simple_strtoul(s, &end, base);
-       if (end - s == 0)
-               return -EINVAL;
-       return 0;
-}
-#endif /* !HAVE_KSTRTOUL */
-
 #ifndef WITH_WATCHDOG
 #define WITH_WATCHDOG
 #endif
 #ifndef WITH_WATCHDOG
 #define WITH_WATCHDOG
 #endif
diff --git a/libcfs/include/libcfs/linux/linux-misc.h b/libcfs/include/libcfs/linux/linux-misc.h
new file mode 100644 (file)
index 0000000..cb7c4cb
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * GPL HEADER START
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
+ *
+ * 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.
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Use is subject to license terms.
+ *
+ * Copyright (c) 2011, 2014, Intel Corporation.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
+ */
+
+#ifndef __LIBCFS_LINUX_MISC_H__
+#define __LIBCFS_LINUX_MISC_H__
+
+#ifdef HAVE_SYSCTL_CTLNAME
+#define INIT_CTL_NAME  .ctl_name = CTL_UNNUMBERED,
+#define INIT_STRATEGY  .strategy = &sysctl_intvec,
+#else
+#define INIT_CTL_NAME
+#define INIT_STRATEGY
+#endif
+
+#ifndef HAVE_KSTRTOUL
+static inline int kstrtoul(const char *s, unsigned int base, unsigned long *res)
+{
+       char *end = (char *)s;
+
+       *res = simple_strtoul(s, &end, base);
+       if (end - s == 0)
+               return -EINVAL;
+       return 0;
+}
+#endif /* !HAVE_KSTRTOUL */
+
+#endif
index 23b1bf5..6bf0865 100644 (file)
@@ -42,6 +42,7 @@
 
 #include <linux/module.h>
 #include <linux/statfs.h>
 
 #include <linux/module.h>
 #include <linux/statfs.h>
+#include <linux/time.h>
 #include <linux/types.h>
 #include <linux/version.h>
 #include <linux/mm.h>
 #include <linux/types.h>
 #include <linux/version.h>
 #include <linux/mm.h>
@@ -1621,17 +1622,17 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
         /* We mark all of the fields "set" so MDS/OST does not re-set them */
        if (!(attr->ia_valid & ATTR_CTIME_SET) &&
            (attr->ia_valid & ATTR_CTIME)) {
         /* We mark all of the fields "set" so MDS/OST does not re-set them */
        if (!(attr->ia_valid & ATTR_CTIME_SET) &&
            (attr->ia_valid & ATTR_CTIME)) {
-                attr->ia_ctime = CFS_CURRENT_TIME;
+               attr->ia_ctime = CURRENT_TIME;
                 attr->ia_valid |= ATTR_CTIME_SET;
         }
        if (!(attr->ia_valid & ATTR_ATIME_SET) &&
            (attr->ia_valid & ATTR_ATIME)) {
                 attr->ia_valid |= ATTR_CTIME_SET;
         }
        if (!(attr->ia_valid & ATTR_ATIME_SET) &&
            (attr->ia_valid & ATTR_ATIME)) {
-                attr->ia_atime = CFS_CURRENT_TIME;
+               attr->ia_atime = CURRENT_TIME;
                 attr->ia_valid |= ATTR_ATIME_SET;
         }
        if (!(attr->ia_valid & ATTR_MTIME_SET) &&
            (attr->ia_valid & ATTR_MTIME)) {
                 attr->ia_valid |= ATTR_ATIME_SET;
         }
        if (!(attr->ia_valid & ATTR_MTIME_SET) &&
            (attr->ia_valid & ATTR_MTIME)) {
-                attr->ia_mtime = CFS_CURRENT_TIME;
+               attr->ia_mtime = CURRENT_TIME;
                 attr->ia_valid |= ATTR_MTIME_SET;
         }
 
                 attr->ia_valid |= ATTR_MTIME_SET;
         }
 
index 06af63f..0a2a3dd 100644 (file)
@@ -247,7 +247,7 @@ static void osc_page_touch_at(const struct lu_env *env,
                kms > loi->loi_kms ? "" : "not ", loi->loi_kms, kms,
                loi->loi_lvb.lvb_size);
 
                kms > loi->loi_kms ? "" : "not ", loi->loi_kms, kms,
                loi->loi_lvb.lvb_size);
 
-       attr->cat_mtime = attr->cat_ctime = LTIME_S(CFS_CURRENT_TIME);
+       attr->cat_mtime = attr->cat_ctime = LTIME_S(CURRENT_TIME);
        valid = CAT_MTIME | CAT_CTIME;
        if (kms > loi->loi_kms) {
                attr->cat_kms = kms;
        valid = CAT_MTIME | CAT_CTIME;
        if (kms > loi->loi_kms) {
                attr->cat_kms = kms;
@@ -725,7 +725,7 @@ static int osc_io_read_start(const struct lu_env *env,
 
        if (!slice->cis_io->ci_noatime) {
                cl_object_attr_lock(obj);
 
        if (!slice->cis_io->ci_noatime) {
                cl_object_attr_lock(obj);
-               attr->cat_atime = LTIME_S(CFS_CURRENT_TIME);
+               attr->cat_atime = LTIME_S(CURRENT_TIME);
                rc = cl_object_attr_update(env, obj, attr, CAT_ATIME);
                cl_object_attr_unlock(obj);
        }
                rc = cl_object_attr_update(env, obj, attr, CAT_ATIME);
                cl_object_attr_unlock(obj);
        }
@@ -743,7 +743,7 @@ static int osc_io_write_start(const struct lu_env *env,
 
        OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_DELAY_SETTIME, 1);
        cl_object_attr_lock(obj);
 
        OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_DELAY_SETTIME, 1);
        cl_object_attr_lock(obj);
-       attr->cat_mtime = attr->cat_ctime = LTIME_S(CFS_CURRENT_TIME);
+       attr->cat_mtime = attr->cat_ctime = LTIME_S(CURRENT_TIME);
        rc = cl_object_attr_update(env, obj, attr, CAT_MTIME | CAT_CTIME);
        cl_object_attr_unlock(obj);
 
        rc = cl_object_attr_update(env, obj, attr, CAT_MTIME | CAT_CTIME);
        cl_object_attr_unlock(obj);