Whamcloud - gitweb
LU-4423 libcfs: Merge linux-proc.c into module.c
[fs/lustre-release.git] / libcfs / include / libcfs / curproc.h
index fc18b12..6568ccb 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012, 2014, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
 #ifndef __LIBCFS_CURPROC_H__
 #define __LIBCFS_CURPROC_H__
 
-#if !defined(HAVE_UIDGID_HEADER) || !defined(__KERNEL__)
+#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
-
-#ifndef __KERNEL__
-struct user_namespace {
-       unsigned int pad;
-};
+#define INVALID_UID    -1
+#define INVALID_GID    -1
 
-extern struct user_namespace init_user_ns;
-#endif
+#define GLOBAL_ROOT_UID         0
+#define GLOBAL_ROOT_GID         0
 
 static inline uid_t __kuid_val(kuid_t uid)
 {
@@ -96,13 +94,15 @@ static inline bool uid_eq(kuid_t left, kuid_t right)
 
 static inline bool uid_valid(kuid_t uid)
 {
-       return (uid != INVALID_UID);
+       return uid != (typeof(uid))INVALID_UID;
 }
 
 static inline bool gid_valid(kgid_t gid)
 {
-       return (gid != INVALID_GID);
+       return gid != (typeof(gid))INVALID_GID;
 }
+#endif /* _LINUX_UIDGID_H */
+
 #endif
 
 int cfs_get_environ(const char *key, char *value, int *val_len);