From b8bddf048483d3ed95201de06f2da0925c82cd54 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Mon, 11 Apr 2016 17:42:00 -0400 Subject: [PATCH 1/1] LU-6245 libcfs: Remove kp30.h 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 Change-Id: I7f5fec4372023146215c740e287529a05dfceba6 Reviewed-on: http://review.whamcloud.com/19460 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: Dmitry Eremin Reviewed-by: Frank Zago Reviewed-by: Oleg Drokin --- libcfs/include/libcfs/libcfs_private.h | 4 -- libcfs/include/libcfs/linux/Makefile.am | 2 +- libcfs/include/libcfs/linux/kp30.h | 108 ------------------------------- libcfs/include/libcfs/linux/libcfs.h | 64 +++++++++++------- libcfs/include/libcfs/linux/linux-misc.h | 60 +++++++++++++++++ lustre/llite/llite_lib.c | 7 +- lustre/osc/osc_io.c | 6 +- 7 files changed, 108 insertions(+), 143 deletions(-) delete mode 100644 libcfs/include/libcfs/linux/kp30.h create mode 100644 libcfs/include/libcfs/linux/linux-misc.h diff --git a/libcfs/include/libcfs/libcfs_private.h b/libcfs/include/libcfs/libcfs_private.h index 44704ea..47197b3 100644 --- a/libcfs/include/libcfs/libcfs_private.h +++ b/libcfs/include/libcfs/libcfs_private.h @@ -434,10 +434,6 @@ do { \ /* 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)) diff --git a/libcfs/include/libcfs/linux/Makefile.am b/libcfs/include/libcfs/linux/Makefile.am index b1aa817..f19c8c5 100644 --- a/libcfs/include/libcfs/linux/Makefile.am +++ b/libcfs/include/libcfs/linux/Makefile.am @@ -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 diff --git a/libcfs/include/libcfs/linux/kp30.h b/libcfs/include/libcfs/linux/kp30.h deleted file mode 100644 index f5036e2..0000000 --- a/libcfs/include/libcfs/linux/kp30.h +++ /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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef HAVE_MM_INLINE -# include -#endif -#include -#include -#include - -/******************************************************************************/ -/* 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 diff --git a/libcfs/include/libcfs/linux/libcfs.h b/libcfs/include/libcfs/linux/libcfs.h index c939ba1..2bfa8f2 100644 --- a/libcfs/include/libcfs/linux/libcfs.h +++ b/libcfs/include/libcfs/linux/libcfs.h @@ -45,23 +45,51 @@ #error This include is only for kernel use. #endif - +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include + #include #include #include +#include #include -#include - -#ifdef HAVE_ASM_TYPES_H -#include -#endif -#include -#include -#include /* THREAD_SIZE */ -#include -#include -#include #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)); -#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 diff --git a/libcfs/include/libcfs/linux/linux-misc.h b/libcfs/include/libcfs/linux/linux-misc.h new file mode 100644 index 0000000..cb7c4cb --- /dev/null +++ b/libcfs/include/libcfs/linux/linux-misc.h @@ -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 diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 23b1bf5..6bf0865 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -42,6 +42,7 @@ #include #include +#include #include #include #include @@ -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)) { - 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_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_mtime = CFS_CURRENT_TIME; + attr->ia_mtime = CURRENT_TIME; attr->ia_valid |= ATTR_MTIME_SET; } diff --git a/lustre/osc/osc_io.c b/lustre/osc/osc_io.c index 06af63f..0a2a3dd 100644 --- a/lustre/osc/osc_io.c +++ b/lustre/osc/osc_io.c @@ -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); - 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; @@ -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); - 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); } @@ -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); - 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); -- 1.8.3.1