[lxc-devel] [lxc/master] remove last pam_cgfs special-casing

brauner on Github lxc-bot at linuxcontainers.org
Wed Aug 22 13:58:59 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180822/d21742fa/attachment.bin>
-------------- next part --------------
From 1b0575412af6016170820de67b5655fc1d1ef750 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 22 Aug 2018 15:36:15 +0200
Subject: [PATCH 1/7] {file,string}_utils: remove NO_LOG

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/file_utils.c   | 2 --
 src/lxc/string_utils.c | 2 --
 2 files changed, 4 deletions(-)

diff --git a/src/lxc/file_utils.c b/src/lxc/file_utils.c
index 89d90c269..63e8322d6 100644
--- a/src/lxc/file_utils.c
+++ b/src/lxc/file_utils.c
@@ -31,9 +31,7 @@
 #include "macro.h"
 #include "string.h"
 
-#ifndef NO_LOG
 lxc_log_define(file_utils, lxc);
-#endif
 
 int lxc_write_to_file(const char *filename, const void *buf, size_t count,
 		      bool add_newline, mode_t mode)
diff --git a/src/lxc/string_utils.c b/src/lxc/string_utils.c
index e5e818373..e9136a2f2 100644
--- a/src/lxc/string_utils.c
+++ b/src/lxc/string_utils.c
@@ -56,9 +56,7 @@
 #include "include/strlcat.h"
 #endif
 
-#ifndef NO_LOG
 lxc_log_define(string_utils, lxc);
-#endif
 
 char **lxc_va_arg_list_to_argv(va_list ap, size_t skip, int do_strdup)
 {

From bcf6424544597e45add24cf83938ff37eea22b76 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 22 Aug 2018 15:37:04 +0200
Subject: [PATCH 2/7] initutils: remove useless comment

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/initutils.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/lxc/initutils.h b/src/lxc/initutils.h
index 902663f3d..6753956ce 100644
--- a/src/lxc/initutils.h
+++ b/src/lxc/initutils.h
@@ -70,7 +70,6 @@ struct prctl_mm_map {
 
 extern const char *lxc_global_config_value(const char *option_name);
 
-/* open a file with O_CLOEXEC */
 extern void remove_trailing_slashes(char *p);
 extern int setproctitle(char *title);
 

From 8018dce8c7f1933611490d1d7f0bbee7cec6bb0b Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 22 Aug 2018 15:37:41 +0200
Subject: [PATCH 3/7] string_utils: remove unnecessary include

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/string_utils.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/lxc/string_utils.c b/src/lxc/string_utils.c
index e9136a2f2..633255c5c 100644
--- a/src/lxc/string_utils.c
+++ b/src/lxc/string_utils.c
@@ -46,7 +46,6 @@
 #include "namespace.h"
 #include "parse.h"
 #include "string_utils.h"
-#include "utils.h"
 
 #ifndef HAVE_STRLCPY
 #include "include/strlcpy.h"

From 1f27e820654eaba8b17b07542f969ef412b7205c Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 22 Aug 2018 15:40:58 +0200
Subject: [PATCH 4/7] string_utils: remove unused headers

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/string_utils.h | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/src/lxc/string_utils.h b/src/lxc/string_utils.h
index c1155f64a..211c6c866 100644
--- a/src/lxc/string_utils.h
+++ b/src/lxc/string_utils.h
@@ -22,22 +22,6 @@
 
 #include "config.h"
 
-#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdbool.h>
-#include <unistd.h>
-#include <linux/loop.h>
-#include <linux/magic.h>
-#include <linux/types.h>
-#include <sys/syscall.h>
-#include <sys/types.h>
-#include <sys/vfs.h>
-
-#ifdef HAVE_LINUX_MEMFD_H
-#include <linux/memfd.h>
-#endif
-
 #include "initutils.h"
 #include "macro.h"
 

From dca12ddf8d40f0f56c417ad3f0056b8637c0d209 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 22 Aug 2018 15:45:33 +0200
Subject: [PATCH 5/7] string_utils: add remove_trailing_slashes()

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/initutils.c    | 7 -------
 src/lxc/initutils.h    | 7 ++++---
 src/lxc/string_utils.c | 7 +++++++
 src/lxc/string_utils.h | 1 +
 4 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/lxc/initutils.c b/src/lxc/initutils.c
index 9e5397aa6..c582b2d00 100644
--- a/src/lxc/initutils.c
+++ b/src/lxc/initutils.c
@@ -217,13 +217,6 @@ const char *lxc_global_config_value(const char *option_name)
 	return values[i];
 }
 
-extern void remove_trailing_slashes(char *p)
-{
-	int l = strlen(p);
-	while (--l >= 0 && (p[l] == '/' || p[l] == '\n'))
-		p[l] = '\0';
-}
-
 /*
  * Sets the process title to the specified title. Note that this may fail if
  * the kernel doesn't support PR_SET_MM_MAP (kernels <3.18).
diff --git a/src/lxc/initutils.h b/src/lxc/initutils.h
index 6753956ce..4af8c3e6c 100644
--- a/src/lxc/initutils.h
+++ b/src/lxc/initutils.h
@@ -24,6 +24,8 @@
 #ifndef __LXC_INITUTILS_H
 #define __LXC_INITUTILS_H
 
+#include "config.h"
+
 #include <errno.h>
 #include <fcntl.h>
 #include <inttypes.h>
@@ -31,12 +33,12 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include <sys/mount.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <unistd.h>
 
-#include "config.h"
+#include "string_utils.h"
 
 #define DEFAULT_VG "lxc"
 #define DEFAULT_THIN_POOL "lxc"
@@ -70,7 +72,6 @@ struct prctl_mm_map {
 
 extern const char *lxc_global_config_value(const char *option_name);
 
-extern void remove_trailing_slashes(char *p);
 extern int setproctitle(char *title);
 
 #endif /* __LXC_INITUTILS_H */
diff --git a/src/lxc/string_utils.c b/src/lxc/string_utils.c
index 633255c5c..74cea3c70 100644
--- a/src/lxc/string_utils.c
+++ b/src/lxc/string_utils.c
@@ -978,3 +978,10 @@ int lxc_is_line_empty(const char *line)
 			return 0;
 	return 1;
 }
+
+void remove_trailing_slashes(char *p)
+{
+	int l = strlen(p);
+	while (--l >= 0 && (p[l] == '/' || p[l] == '\n'))
+		p[l] = '\0';
+}
diff --git a/src/lxc/string_utils.h b/src/lxc/string_utils.h
index 211c6c866..d289d18e0 100644
--- a/src/lxc/string_utils.h
+++ b/src/lxc/string_utils.h
@@ -111,5 +111,6 @@ extern int lxc_char_right_gc(const char *buffer, size_t len);
 extern char *lxc_trim_whitespace_in_place(char *buffer);
 
 extern int lxc_is_line_empty(const char *line);
+extern void remove_trailing_slashes(char *p);
 
 #endif /* __LXC_STRING_UTILS_H */

From f4274ae8896474886063dc485331c3591cde52f4 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 22 Aug 2018 15:45:54 +0200
Subject: [PATCH 6/7] Makefile: remove last pam_cgfs special-casing

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/Makefile.am | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am
index 94886b23d..68311a90d 100644
--- a/src/lxc/Makefile.am
+++ b/src/lxc/Makefile.am
@@ -325,6 +325,7 @@ endif
 if ENABLE_COMMANDS
 # Binaries shipping with liblxc
 init_lxc_SOURCES = cmd/lxc_init.c \
+		   initutils.c initutils.h \
 		   string_utils.c string_utils.h
 lxc_monitord_SOURCES = cmd/lxc_monitord.c
 lxc_user_nic_SOURCES = cmd/lxc_user_nic.c \
@@ -389,8 +390,10 @@ if HAVE_PAM
 pam_LTLIBRARIES = pam_cgfs.la
 
 pam_cgfs_la_SOURCES = pam/pam_cgfs.c \
-		      macro.h \
+		      caps.c caps.h \
 		      file_utils.c file_utils.h \
+		      log.c log.h \
+		      macro.h \
 		      string_utils.c string_utils.h
 
 if !HAVE_STRLCAT
@@ -401,8 +404,7 @@ if !HAVE_STRLCPY
 pam_cgfs_la_SOURCES += ../include/strlcpy.c ../include/strlcpy.h
 endif
 
-pam_cgfs_la_CFLAGS = $(AM_CFLAGS) \
-		     -DNO_LOG
+pam_cgfs_la_CFLAGS = $(AM_CFLAGS) -DNO_LXC_CONF
 
 pam_cgfs_la_LIBADD = $(AM_LIBS) \
 		     $(PAM_LIBS) \

From 9e99997bd741e1bc7a525ca0c83fb889ff3ab361 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 22 Aug 2018 15:52:18 +0200
Subject: [PATCH 7/7] conf: add missing headers

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/conf.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/lxc/conf.h b/src/lxc/conf.h
index 2c70303a2..c68108d83 100644
--- a/src/lxc/conf.h
+++ b/src/lxc/conf.h
@@ -26,14 +26,17 @@
 #include "config.h"
 
 #include <stdio.h>
+#include <linux/magic.h>
 #include <net/if.h>
 #include <netinet/in.h>
 #include <sys/param.h>
 #include <sys/types.h>
+#include <stdbool.h>
+#include <sys/vfs.h>
+
 #if HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
 #endif
-#include <stdbool.h>
 
 #include "list.h"
 #include "ringbuf.h"


More information about the lxc-devel mailing list