From 74cecb5aad2243d1173405dc0063f4b46396f92f Mon Sep 17 00:00:00 2001 From: James Simmons Date: Thu, 25 Aug 2016 16:16:02 -0400 Subject: [PATCH] LU-6245 libcfs: move uid handling to linux directory Simple patch to move the uid handling added to handle older kernels to the linux directory. The linux directory is where we handle APIs of newer kernels with older distribution kernels. Test-Parameters: trivial Change-Id: Ie3676d33ce33ebc0f98ffa460cba37ab55928617 Signed-off-by: James Simmons Reviewed-on: http://review.whamcloud.com/22139 Tested-by: Jenkins Reviewed-by: Andreas Dilger Reviewed-by: Frank Zago Tested-by: Maloo Reviewed-by: Oleg Drokin --- libcfs/include/libcfs/curproc.h | 64 -------------------------------- libcfs/include/libcfs/linux/linux-misc.h | 64 ++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 64 deletions(-) diff --git a/libcfs/include/libcfs/curproc.h b/libcfs/include/libcfs/curproc.h index 6568ccb..d1bda93 100644 --- a/libcfs/include/libcfs/curproc.h +++ b/libcfs/include/libcfs/curproc.h @@ -43,70 +43,6 @@ #ifndef __LIBCFS_CURPROC_H__ #define __LIBCFS_CURPROC_H__ -#ifndef HAVE_UIDGID_HEADER - -#ifndef _LINUX_UIDGID_H -#define _LINUX_UIDGID_H - -typedef uid_t kuid_t; -typedef gid_t kgid_t; - -#define INVALID_UID -1 -#define INVALID_GID -1 - -#define GLOBAL_ROOT_UID 0 -#define GLOBAL_ROOT_GID 0 - -static inline uid_t __kuid_val(kuid_t uid) -{ - return uid; -} - -static inline gid_t __kgid_val(kgid_t gid) -{ - return gid; -} - -static inline kuid_t make_kuid(struct user_namespace *from, uid_t uid) -{ - return uid; -} - -static inline kgid_t make_kgid(struct user_namespace *from, gid_t gid) -{ - return gid; -} - -static inline uid_t from_kuid(struct user_namespace *to, kuid_t uid) -{ - return uid; -} - -static inline gid_t from_kgid(struct user_namespace *to, kgid_t gid) -{ - return gid; -} - -static inline bool uid_eq(kuid_t left, kuid_t right) -{ - return left == right; -} - -static inline bool uid_valid(kuid_t uid) -{ - return uid != (typeof(uid))INVALID_UID; -} - -static inline bool gid_valid(kgid_t gid) -{ - return gid != (typeof(gid))INVALID_GID; -} -#endif /* _LINUX_UIDGID_H */ - -#endif - -int cfs_get_environ(const char *key, char *value, int *val_len); - typedef __u32 cfs_cap_t; #define CFS_CAP_CHOWN 0 diff --git a/libcfs/include/libcfs/linux/linux-misc.h b/libcfs/include/libcfs/linux/linux-misc.h index cb7c4cb..706ccba 100644 --- a/libcfs/include/libcfs/linux/linux-misc.h +++ b/libcfs/include/libcfs/linux/linux-misc.h @@ -45,6 +45,70 @@ #define INIT_STRATEGY #endif +#ifndef HAVE_UIDGID_HEADER + +#ifndef _LINUX_UIDGID_H +#define _LINUX_UIDGID_H + +typedef uid_t kuid_t; +typedef gid_t kgid_t; + +#define INVALID_UID -1 +#define INVALID_GID -1 + +#define GLOBAL_ROOT_UID 0 +#define GLOBAL_ROOT_GID 0 + +static inline uid_t __kuid_val(kuid_t uid) +{ + return uid; +} + +static inline gid_t __kgid_val(kgid_t gid) +{ + return gid; +} + +static inline kuid_t make_kuid(struct user_namespace *from, uid_t uid) +{ + return uid; +} + +static inline kgid_t make_kgid(struct user_namespace *from, gid_t gid) +{ + return gid; +} + +static inline uid_t from_kuid(struct user_namespace *to, kuid_t uid) +{ + return uid; +} + +static inline gid_t from_kgid(struct user_namespace *to, kgid_t gid) +{ + return gid; +} + +static inline bool uid_eq(kuid_t left, kuid_t right) +{ + return left == right; +} + +static inline bool uid_valid(kuid_t uid) +{ + return uid != (typeof(uid))INVALID_UID; +} + +static inline bool gid_valid(kgid_t gid) +{ + return gid != (typeof(gid))INVALID_GID; +} +#endif /* _LINUX_UIDGID_H */ + +#endif + +int cfs_get_environ(const char *key, char *value, int *val_len); + #ifndef HAVE_KSTRTOUL static inline int kstrtoul(const char *s, unsigned int base, unsigned long *res) { -- 1.8.3.1