]> git.proxmox.com Git - mirror_lxcfs.git/commitdiff
macro: add header for shared macros
authorChristian Brauner <christian.brauner@canonical.com>
Sun, 13 Nov 2016 05:06:54 +0000 (06:06 +0100)
committerChristian Brauner <christian.brauner@canonical.com>
Mon, 14 Nov 2016 06:02:29 +0000 (07:02 +0100)
Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
Makefile.am
bindings.h
macro.h [new file with mode: 0644]

index bd2604a6103399f366753dc3fef4a94fbff414dd..3ad276d8389fb609b7faa348ff612ec886e8fdae 100644 (file)
@@ -11,15 +11,15 @@ AM_LDFLAGS = $(FUSE_LIBS) -pthread
 
 AM_CFLAGS += -DRUNTIME_PATH=\"$(RUNTIME_PATH)\"
 
-liblxcfs_la_SOURCES = bindings.c cpuset.c bindings.h
+liblxcfs_la_SOURCES = macro.h bindings.c cpuset.c bindings.h
 liblxcfs_la_CFLAGS = $(AM_CFLAGS)
 liblxcfs_la_LDFLAGS = $(AM_CFLAGS) -module -avoid-version -shared
 
-liblxcfstest_la_SOURCES = bindings.c cpuset.c bindings.h
+liblxcfstest_la_SOURCES = bindings.c cpuset.c bindings.h macro.h
 liblxcfstest_la_CFLAGS = $(AM_CFLAGS) -DRELOADTEST
 liblxcfstest_la_LDFLAGS = $(AM_CFLAGS) -module -avoid-version -shared
 
-noinst_HEADERS = bindings.h
+noinst_HEADERS = bindings.h macro.h
 
 sodir=$(libdir)
 lib_LTLIBRARIES = liblxcfs.la
@@ -50,11 +50,11 @@ TEST_SYSCALLS: tests/test_syscalls.c
 
 if HAVE_PAM
 pam_LTLIBRARIES = pam_cgfs.la
-pam_cgfs_la_SOURCES = pam/pam_cgfs.c
+pam_cgfs_la_SOURCES = pam/pam_cgfs.c macro.h
 pam_cgfs_la_CFLAGS = $(AM_CFLAGS)
 pam_cgfs_la_LIBADD = $(AM_LIBS) $(PAM_LIBS) -L$(top_srcdir)
 pam_cgfs_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version -shared
-#pam_cgfs_la_CFLAGS += -DDEBUG
+# pam_cgfs_la_CFLAGS += -DDEBUG
 
 install-data-hook:     install-pamLTLIBRARIES
        rm -f "$(DESTDIR)$(pamdir)/pam_cgfs.la"
index 04d728c6b3a6f2608e920f164b03c6726b2ce094..c663287b15638f53a593bfe55823f0ef2b2df255 100644 (file)
@@ -1,24 +1,12 @@
 #ifndef __LXCFS_BINDINGS_H
 #define __LXCFS_BINDINGS_H
 
+#include "macro.h"
+
 /* directory under which we mount the controllers - /run/lxcfs/controllers */
 #define BASEDIR RUNTIME_PATH "/lxcfs/controllers"
 #define ROOTDIR RUNTIME_PATH "/lxcfs/root"
 
-#define lxcfs_debug_stream(stream, format, ...)                                \
-       do {                                                                   \
-               fprintf(stream, "%s: %d: %s: " format, __FILE__, __LINE__,     \
-                       __func__, __VA_ARGS__);                                \
-       } while (false)
-
-#define lxcfs_error(format, ...) lxcfs_debug_stream(stderr, format, __VA_ARGS__)
-
-#ifdef DEBUG
-#define lxcfs_debug(format, ...) lxcfs_error(format, __VA_ARGS__)
-#else
-#define lxcfs_debug(format, ...)
-#endif /* DEBUG */
-
 extern int cg_write(const char *path, const char *buf, size_t size, off_t offset,
             struct fuse_file_info *fi);
 extern int cg_mkdir(const char *path, mode_t mode);
@@ -45,4 +33,4 @@ extern int proc_read(const char *path, char *buf, size_t size, off_t offset,
                struct fuse_file_info *fi);
 extern int proc_access(const char *path, int mask);
 
-#endif /* __LXCFS__BINDINGS_H */
+#endif /* __LXCFS_BINDINGS_H */
diff --git a/macro.h b/macro.h
new file mode 100644 (file)
index 0000000..1763dc2
--- /dev/null
+++ b/macro.h
@@ -0,0 +1,18 @@
+#ifndef __LXCFS_MACRO_H
+#define __LXCFS_MACRO_H
+
+#define lxcfs_debug_stream(stream, format, ...)                                \
+       do {                                                                   \
+               fprintf(stream, "%s: %d: %s: " format, __FILE__, __LINE__,     \
+                       __func__, __VA_ARGS__);                                \
+       } while (false)
+
+#define lxcfs_error(format, ...) lxcfs_debug_stream(stderr, format, __VA_ARGS__)
+
+#ifdef DEBUG
+#define lxcfs_debug(format, ...) lxcfs_error(format, __VA_ARGS__)
+#else
+#define lxcfs_debug(format, ...)
+#endif /* DEBUG */
+
+#endif /* __LXCFS_MACRO_H */