]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
macro: coding style fixes
authorChristian Brauner <christian.brauner@ubuntu.com>
Sun, 26 Aug 2018 10:34:11 +0000 (12:34 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 28 Aug 2018 18:22:24 +0000 (20:22 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/macro.h

index c0af5a055a1042d969025c73095567cde5401146..e19b31632a662dc393e480c2009db928a23b71c6 100644 (file)
 #define __S_ISTYPE(mode, mask) (((mode)&S_IFMT) == (mask))
 #endif
 
-#if HAVE_LIBCAP
+/* capabilities */
+#ifndef CAP_SYS_ADMIN
+#define CAP_SYS_ADMIN 21
+#endif
+
 #ifndef CAP_SETFCAP
 #define CAP_SETFCAP 31
 #endif
 #ifndef CAP_MAC_ADMIN
 #define CAP_MAC_ADMIN 33
 #endif
-#endif
-
-#ifndef PR_CAPBSET_DROP
-#define PR_CAPBSET_DROP 24
-#endif
 
 #ifndef CAP_SETUID
 #define CAP_SETUID 7
 #define CAP_SETGID 6
 #endif
 
-/* needed for cgroup automount checks, regardless of whether we
- * have included linux/capability.h or not */
-#ifndef CAP_SYS_ADMIN
-#define CAP_SYS_ADMIN 21
-#endif
-
-#ifndef HAVE_DECL_PR_CAPBSET_DROP
+/* prctl */
+#ifndef PR_CAPBSET_DROP
 #define PR_CAPBSET_DROP 24
 #endif
 
-/* prctl */
-#ifndef HAVE_DECL_PR_SET_NO_NEW_PRIVS
+#ifndef PR_SET_NO_NEW_PRIVS
 #define PR_SET_NO_NEW_PRIVS 38
 #endif
 
-#ifndef HAVE_DECL_PR_GET_NO_NEW_PRIVS
+#ifndef PR_GET_NO_NEW_PRIVS
 #define PR_GET_NO_NEW_PRIVS 39
 #endif
 
+/* filesystem magic values */
 #ifndef CGROUP_SUPER_MAGIC
 #define CGROUP_SUPER_MAGIC 0x27e0eb
 #endif
 #define NSFS_MAGIC 0x6e736673
 #endif
 
-/* We have two different magic values for overlayfs, yay. */
-#ifndef OVERLAYFS_SUPER_MAGIC
-#define OVERLAYFS_SUPER_MAGIC 0x794c764f
-#endif
-
+/* current overlayfs */
 #ifndef OVERLAY_SUPER_MAGIC
 #define OVERLAY_SUPER_MAGIC 0x794c7630
 #endif
 
+/* legacy overlayfs */
+#ifndef OVERLAYFS_SUPER_MAGIC
+#define OVERLAYFS_SUPER_MAGIC 0x794c764f
+#endif
+
 /* Calculate the number of chars needed to represent a given integer as a C
  * string. Include room for '-' to indicate negative numbers and the \0 byte.
  * This is based on systemd.
  * though, hence the two different methods.
  */
 #ifndef __OPTIMIZE__
-#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
+#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2 * !!(condition)]))
 #else
 extern int __build_bug_on_failed;
-#define BUILD_BUG_ON(condition)                                        \
-       do {                                                    \
-               ((void)sizeof(char[1 - 2*!!(condition)]));      \
-               if (condition) __build_bug_on_failed = 1;       \
-       } while(0)
+#define BUILD_BUG_ON(condition)                              \
+       do {                                                 \
+               ((void)sizeof(char[1 - 2 * !!(condition)])); \
+               if (condition)                               \
+                       __build_bug_on_failed = 1;           \
+       } while (0)
 #endif
 
 #define lxc_iterate_parts(__iterator, __splitme, __separators)                  \