The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxcfs/pull/344
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
From 668d1b5071914279339f63789f5f3ae76ff3fb19 Mon Sep 17 00:00:00 2001 From: Christian Brauner <christian.brau...@ubuntu.com> Date: Wed, 4 Mar 2020 14:35:59 +0100 Subject: [PATCH 1/2] lxcfs: use lxcfs_info() for help output Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com> --- lxcfs.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/lxcfs.c b/lxcfs.c index 1f4d902..9901901 100644 --- a/lxcfs.c +++ b/lxcfs.c @@ -957,22 +957,20 @@ const struct fuse_operations lxcfs_ops = { static void usage() { - fprintf(stderr, "Usage: lxcfs <directory>\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "lxcfs set up fuse- and cgroup-based virtualizing filesystem\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "Options :\n"); - fprintf(stderr, "-d, --debug Run lxcfs with debugging enabled\n"); - fprintf(stderr, "--disable-cfs Disable cpu virtualization via cpu shares\n"); - fprintf(stderr, "-f, --foreground Run lxcfs in the foreground\n"); - fprintf(stderr, "-n, --help Print help\n"); - fprintf(stderr, "-l, --enable-loadavg Enable loadavg virtualization\n"); - fprintf(stderr, "-o Options to pass directly through fuse\n"); - fprintf(stderr, "-p, --pidfile=FILE Path to use for storing lxcfs pid\n"); - fprintf(stderr, " Default pidfile is %s/lxcfs.pid\n", RUNTIME_PATH); - fprintf(stderr, "-u, --disable-swap Disable swap virtualization\n"); - fprintf(stderr, "-v, --version Print lxcfs version\n"); - fprintf(stderr, "--enable-pidfd Use pidfd for process tracking\n"); + lxcfs_info("Usage: lxcfs <directory>\n"); + lxcfs_info("lxcfs set up fuse- and cgroup-based virtualizing filesystem\n"); + lxcfs_info("Options :"); + lxcfs_info("-d, --debug Run lxcfs with debugging enabled"); + lxcfs_info("--disable-cfs Disable cpu virtualization via cpu shares"); + lxcfs_info("-f, --foreground Run lxcfs in the foreground"); + lxcfs_info("-n, --help Print help"); + lxcfs_info("-l, --enable-loadavg Enable loadavg virtualization"); + lxcfs_info("-o Options to pass directly through fuse"); + lxcfs_info("-p, --pidfile=FILE Path to use for storing lxcfs pid"); + lxcfs_info(" Default pidfile is %s/lxcfs.pid", RUNTIME_PATH); + lxcfs_info("-u, --disable-swap Disable swap virtualization"); + lxcfs_info("-v, --version Print lxcfs version"); + lxcfs_info("--enable-pidfd Use pidfd for process tracking"); exit(EXIT_FAILURE); } From 5fb0c5ef0d784aecd7b8acaefe4ff1aa486b3a25 Mon Sep 17 00:00:00 2001 From: Christian Brauner <christian.brau...@ubuntu.com> Date: Wed, 4 Mar 2020 14:36:33 +0100 Subject: [PATCH 2/2] tree-wide: move files into subdirectories Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com> --- Makefile.am | 147 +-------------------- configure.ac | 1 + lxcfs.man.add | 8 -- man/lxcfs.man.add | 7 + src/Makefile.am | 137 +++++++++++++++++++ api_extensions.h => src/api_extensions.h | 0 bindings.c => src/bindings.c | 0 bindings.h => src/bindings.h | 0 cgroup_fuse.c => src/cgroup_fuse.c | 0 cgroup_fuse.h => src/cgroup_fuse.h | 0 {cgroups => src/cgroups}/cgfsng.c | 0 {cgroups => src/cgroups}/cgroup.c | 0 {cgroups => src/cgroups}/cgroup.h | 0 {cgroups => src/cgroups}/cgroup2_devices.c | 0 {cgroups => src/cgroups}/cgroup2_devices.h | 0 {cgroups => src/cgroups}/cgroup_utils.c | 0 {cgroups => src/cgroups}/cgroup_utils.h | 0 cpuset_parse.c => src/cpuset_parse.c | 0 cpuset_parse.h => src/cpuset_parse.h | 0 lxcfs.c => src/lxcfs.c | 0 macro.h => src/macro.h | 0 memory_utils.h => src/memory_utils.h | 0 proc_cpuview.c => src/proc_cpuview.c | 0 proc_cpuview.h => src/proc_cpuview.h | 0 proc_fuse.c => src/proc_fuse.c | 0 proc_fuse.h => src/proc_fuse.h | 0 proc_loadavg.c => src/proc_loadavg.c | 0 proc_loadavg.h => src/proc_loadavg.h | 0 sysfs_fuse.c => src/sysfs_fuse.c | 0 sysfs_fuse.h => src/sysfs_fuse.h | 0 utils.c => src/utils.c | 0 utils.h => src/utils.h | 0 32 files changed, 150 insertions(+), 150 deletions(-) delete mode 100644 lxcfs.man.add create mode 100644 man/lxcfs.man.add create mode 100644 src/Makefile.am rename api_extensions.h => src/api_extensions.h (100%) rename bindings.c => src/bindings.c (100%) rename bindings.h => src/bindings.h (100%) rename cgroup_fuse.c => src/cgroup_fuse.c (100%) rename cgroup_fuse.h => src/cgroup_fuse.h (100%) rename {cgroups => src/cgroups}/cgfsng.c (100%) rename {cgroups => src/cgroups}/cgroup.c (100%) rename {cgroups => src/cgroups}/cgroup.h (100%) rename {cgroups => src/cgroups}/cgroup2_devices.c (100%) rename {cgroups => src/cgroups}/cgroup2_devices.h (100%) rename {cgroups => src/cgroups}/cgroup_utils.c (100%) rename {cgroups => src/cgroups}/cgroup_utils.h (100%) rename cpuset_parse.c => src/cpuset_parse.c (100%) rename cpuset_parse.h => src/cpuset_parse.h (100%) rename lxcfs.c => src/lxcfs.c (100%) rename macro.h => src/macro.h (100%) rename memory_utils.h => src/memory_utils.h (100%) rename proc_cpuview.c => src/proc_cpuview.c (100%) rename proc_cpuview.h => src/proc_cpuview.h (100%) rename proc_fuse.c => src/proc_fuse.c (100%) rename proc_fuse.h => src/proc_fuse.h (100%) rename proc_loadavg.c => src/proc_loadavg.c (100%) rename proc_loadavg.h => src/proc_loadavg.h (100%) rename sysfs_fuse.c => src/sysfs_fuse.c (100%) rename sysfs_fuse.h => src/sysfs_fuse.h (100%) rename utils.c => src/utils.c (100%) rename utils.h => src/utils.h (100%) diff --git a/Makefile.am b/Makefile.am index e6dc703..1aa2052 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,144 +1,7 @@ -ACLOCAL_AMFLAGS = -I m4 - -SUBDIRS = tests share config -DIST_SUBDIRS = tests share config - -AM_CFLAGS = -Wall -ggdb -D_GNU_SOURCE -DSBINDIR=\"$(SBINDIR)\" -pthread -AM_CFLAGS += $(FUSE_CFLAGS) -AM_CFLAGS += -DLIBDIR=\"$(LIBDIR)\" -AM_LDFLAGS = $(FUSE_LIBS) -pthread -#AM_CFLAGS += -DDEBUG -#AM_CFLAGS += -DVERBOSE - -AM_CFLAGS += -DRUNTIME_PATH=\"$(RUNTIME_PATH)\" - -liblxcfs_la_SOURCES = api_extension.h \ - bindings.c bindings.h \ - cgroup_fuse.c cgroup_fuse.h \ - cgroups/cgfsng.c \ - cgroups/cgroup.c cgroups/cgroup.h \ - cgroups/cgroup2_devices.c cgroups/cgroup2_devices.h \ - cgroups/cgroup_utils.c cgroups/cgroup_utils.h \ - cpuset_parse.c cpuset_parse.h \ - macro.h \ - memory_utils.h \ - proc_cpuview.c proc_cpuview.h \ - proc_fuse.c proc_fuse.h \ - proc_loadavg.c proc_loadavg.h \ - sysfs_fuse.c sysfs_fuse.h \ - utils.c utils.h -liblxcfs_la_CFLAGS = $(AM_CFLAGS) - -if ENABLE_ASAN -liblxcfs_la_CFLAGS += -fsanitize=address \ - -fno-omit-frame-pointer -endif - -if ENABLE_UBSAN -liblxcfs_la_CFLAGS += -fsanitize=undefined -endif - -liblxcfs_la_LDFLAGS = $(AM_CFLAGS) -module -avoid-version -shared - -liblxcfstest_la_SOURCES = api_extension.h \ - bindings.c bindings.h \ - cgroup_fuse.c cgroup_fuse.h \ - cgroups/cgfsng.c \ - cgroups/cgroup.c cgroups/cgroup.h \ - cgroups/cgroup2_devices.c cgroups/cgroup2_devices.h \ - cgroups/cgroup_utils.c cgroups/cgroup_utils.h \ - cpuset_parse.c cpuset_parse.h \ - macro.h \ - memory_utils.h \ - proc_cpuview.c proc_cpuview.h \ - proc_fuse.c proc_fuse.h \ - proc_loadavg.c proc_loadavg.h \ - sysfs_fuse.c sysfs_fuse.h \ - utils.c utils.h -liblxcfstest_la_CFLAGS = $(AM_CFLAGS) -DRELOADTEST - -if ENABLE_ASAN -liblxcfstest_la_CFLAGS += -fsanitize=address \ - -fno-omit-frame-pointer -endif +# Makefile.am -if ENABLE_UBSAN -liblxcfstest_la_CFLAGS += -fsanitize=undefined -endif - -liblxcfstest_la_LDFLAGS = $(AM_CFLAGS) -module -avoid-version -shared - -noinst_HEADERS = bindings.h \ - cgroup_fuse.h \ - cgroups/cgroup.h \ - cgroups/cgroup2_devices.h \ - cgroups/cgroup_utils.h \ - cpuset_parse.h \ - macro.h \ - memory_utils.h \ - proc_cpuview.h \ - proc_fuse.h \ - proc_loadavg.h \ - sysfs_fuse.h \ - utils.h - -sodir=$(libdir) -lxcfs_LTLIBRARIES = liblxcfs.la -EXTRA_LTLIBRARIES = liblxcfstest.la - -lxcfs_SOURCES = lxcfs.c -lxcfs_LDADD = -ldl -lxcfs_CFLAGS = $(AM_CFLAGS) -lxcfs_LDFLAGS = $(AM_LDFLAGS) -bin_PROGRAMS = lxcfs - -EXTRA_DIST = \ - lxcfs.man.add - lxcfs.spec - -if HAVE_HELP2MAN -man_MANS = lxcfs.1 - -lxcfs.1: lxcfs lxcfs.man.add - $(HELP2MAN) -n "Set up cgroup fs for containers" --no-discard-stderr -s 1 -I lxcfs.man.add -N ./lxcfs > lxcfs.1 -endif - -TEST_READ: tests/test-read.c - $(CC) -o tests/test-read \ - tests/test-read.c -TEST_CPUSET: tests/cpusetrange.c cpuset_parse.c - $(CC) -o tests/cpusetrange \ - tests/cpusetrange.c \ - cpuset_parse.c -TEST_SYSCALLS: tests/test_syscalls.c - $(CC) -o tests/test_syscalls \ - tests/test_syscalls.c -tests: TEST_READ TEST_CPUSET TEST_SYSCALLS +ACLOCAL_AMFLAGS = -I m4 -distclean: - rm -rf .deps/ \ - INSTALL \ - Makefile \ - Makefile.in \ - aclocal.m4 \ - autom4te.cache/ \ - compile \ - config.guess \ - config.h \ - config.h.in \ - config.log \ - config.status \ - config.sub \ - configure \ - depcomp \ - install-sh \ - libtool \ - ltmain.sh \ - lxcfs \ - lxcfs.1 \ - lxcfs.o \ - m4/ \ - missing \ - stamp-h1 \ - tests/test_syscalls \ - *.lo *.la +LIBTOOL_DEPS = @LIBTOOL_DEPS@ +SUBDIRS = config share src tests +DIST_SUBDIRS = config share src tests diff --git a/configure.ac b/configure.ac index b4b87df..082f1f8 100644 --- a/configure.ac +++ b/configure.ac @@ -24,6 +24,7 @@ AC_CONFIG_FILES([ share/00-lxcfs.conf share/lxc.mount.hook share/lxc.reboot.hook + src/Makefile tests/Makefile ]) LT_INIT diff --git a/lxcfs.man.add b/lxcfs.man.add deleted file mode 100644 index 490ccaa..0000000 --- a/lxcfs.man.add +++ /dev/null @@ -1,8 +0,0 @@ -[DESCRIPTION] - -lxcfs implements a FUSE fs which allows containers to have virtualized -cgroup filesystems and virtualized views of /proc/cpuinfo and /proc/meminfo. - -[SEE ALSO] -cgmanager(1), -lxc(1) diff --git a/man/lxcfs.man.add b/man/lxcfs.man.add new file mode 100644 index 0000000..862f41c --- /dev/null +++ b/man/lxcfs.man.add @@ -0,0 +1,7 @@ +[DESCRIPTION] + +LXCFS is a simple fuse- and cgroup-based filesystem virtualizing various aspects of the system to extend the useability of containers. + +[SEE ALSO] +lxc(1), +lxc.container.conf(5) diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..f7f4ef2 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,137 @@ +AM_CFLAGS = -Wall -ggdb -D_GNU_SOURCE -DSBINDIR=\"$(SBINDIR)\" -pthread +AM_CFLAGS += $(FUSE_CFLAGS) +AM_CFLAGS += -DLIBDIR=\"$(LIBDIR)\" +AM_LDFLAGS = $(FUSE_LIBS) -pthread +#AM_CFLAGS += -DDEBUG +#AM_CFLAGS += -DVERBOSE + +AM_CFLAGS += -DRUNTIME_PATH=\"$(RUNTIME_PATH)\" + +liblxcfs_la_SOURCES = api_extension.h \ + bindings.c bindings.h \ + cgroup_fuse.c cgroup_fuse.h \ + cgroups/cgfsng.c \ + cgroups/cgroup.c cgroups/cgroup.h \ + cgroups/cgroup2_devices.c cgroups/cgroup2_devices.h \ + cgroups/cgroup_utils.c cgroups/cgroup_utils.h \ + cpuset_parse.c cpuset_parse.h \ + macro.h \ + memory_utils.h \ + proc_cpuview.c proc_cpuview.h \ + proc_fuse.c proc_fuse.h \ + proc_loadavg.c proc_loadavg.h \ + sysfs_fuse.c sysfs_fuse.h \ + utils.c utils.h +liblxcfs_la_CFLAGS = $(AM_CFLAGS) + +if ENABLE_ASAN +liblxcfs_la_CFLAGS += -fsanitize=address \ + -fno-omit-frame-pointer +endif + +if ENABLE_UBSAN +liblxcfs_la_CFLAGS += -fsanitize=undefined +endif + +liblxcfs_la_LDFLAGS = $(AM_CFLAGS) -module -avoid-version -shared + +liblxcfstest_la_SOURCES = api_extension.h \ + bindings.c bindings.h \ + cgroup_fuse.c cgroup_fuse.h \ + cgroups/cgfsng.c \ + cgroups/cgroup.c cgroups/cgroup.h \ + cgroups/cgroup2_devices.c cgroups/cgroup2_devices.h \ + cgroups/cgroup_utils.c cgroups/cgroup_utils.h \ + cpuset_parse.c cpuset_parse.h \ + macro.h \ + memory_utils.h \ + proc_cpuview.c proc_cpuview.h \ + proc_fuse.c proc_fuse.h \ + proc_loadavg.c proc_loadavg.h \ + sysfs_fuse.c sysfs_fuse.h \ + utils.c utils.h +liblxcfstest_la_CFLAGS = $(AM_CFLAGS) -DRELOADTEST + +if ENABLE_ASAN +liblxcfstest_la_CFLAGS += -fsanitize=address \ + -fno-omit-frame-pointer +endif + +if ENABLE_UBSAN +liblxcfstest_la_CFLAGS += -fsanitize=undefined +endif + +liblxcfstest_la_LDFLAGS = $(AM_CFLAGS) -module -avoid-version -shared + +noinst_HEADERS = bindings.h \ + cgroup_fuse.h \ + cgroups/cgroup.h \ + cgroups/cgroup2_devices.h \ + cgroups/cgroup_utils.h \ + cpuset_parse.h \ + macro.h \ + memory_utils.h \ + proc_cpuview.h \ + proc_fuse.h \ + proc_loadavg.h \ + sysfs_fuse.h \ + utils.h + +sodir=$(libdir) +lxcfs_LTLIBRARIES = liblxcfs.la +EXTRA_LTLIBRARIES = liblxcfstest.la + +lxcfs_SOURCES = lxcfs.c +lxcfs_LDADD = -ldl +lxcfs_CFLAGS = $(AM_CFLAGS) +lxcfs_LDFLAGS = $(AM_LDFLAGS) +bin_PROGRAMS = lxcfs + +EXTRA_DIST = ../man/lxcfs.man.add ../lxcfs.spec + +if HAVE_HELP2MAN +man_MANS = lxcfs.1 + +lxcfs.1: lxcfs ../man/lxcfs.man.add + $(HELP2MAN) -n "System virtualization filesystem for containers" --no-discard-stderr -s 1 -I ../man/lxcfs.man.add -N ./lxcfs > ../man/lxcfs.1 +endif + +TEST_READ: tests/test-read.c + $(CC) -o tests/test-read \ + tests/test-read.c +TEST_CPUSET: tests/cpusetrange.c cpuset_parse.c + $(CC) -o tests/cpusetrange \ + tests/cpusetrange.c \ + cpuset_parse.c +TEST_SYSCALLS: tests/test_syscalls.c + $(CC) -o tests/test_syscalls \ + tests/test_syscalls.c +tests: TEST_READ TEST_CPUSET TEST_SYSCALLS + +distclean: + rm -rf .deps/ \ + INSTALL \ + Makefile \ + Makefile.in \ + aclocal.m4 \ + autom4te.cache/ \ + compile \ + config.guess \ + config.h \ + config.h.in \ + config.log \ + config.status \ + config.sub \ + configure \ + depcomp \ + install-sh \ + libtool \ + ltmain.sh \ + lxcfs \ + lxcfs.1 \ + lxcfs.o \ + m4/ \ + missing \ + stamp-h1 \ + tests/test_syscalls \ + *.lo *.la diff --git a/api_extensions.h b/src/api_extensions.h similarity index 100% rename from api_extensions.h rename to src/api_extensions.h diff --git a/bindings.c b/src/bindings.c similarity index 100% rename from bindings.c rename to src/bindings.c diff --git a/bindings.h b/src/bindings.h similarity index 100% rename from bindings.h rename to src/bindings.h diff --git a/cgroup_fuse.c b/src/cgroup_fuse.c similarity index 100% rename from cgroup_fuse.c rename to src/cgroup_fuse.c diff --git a/cgroup_fuse.h b/src/cgroup_fuse.h similarity index 100% rename from cgroup_fuse.h rename to src/cgroup_fuse.h diff --git a/cgroups/cgfsng.c b/src/cgroups/cgfsng.c similarity index 100% rename from cgroups/cgfsng.c rename to src/cgroups/cgfsng.c diff --git a/cgroups/cgroup.c b/src/cgroups/cgroup.c similarity index 100% rename from cgroups/cgroup.c rename to src/cgroups/cgroup.c diff --git a/cgroups/cgroup.h b/src/cgroups/cgroup.h similarity index 100% rename from cgroups/cgroup.h rename to src/cgroups/cgroup.h diff --git a/cgroups/cgroup2_devices.c b/src/cgroups/cgroup2_devices.c similarity index 100% rename from cgroups/cgroup2_devices.c rename to src/cgroups/cgroup2_devices.c diff --git a/cgroups/cgroup2_devices.h b/src/cgroups/cgroup2_devices.h similarity index 100% rename from cgroups/cgroup2_devices.h rename to src/cgroups/cgroup2_devices.h diff --git a/cgroups/cgroup_utils.c b/src/cgroups/cgroup_utils.c similarity index 100% rename from cgroups/cgroup_utils.c rename to src/cgroups/cgroup_utils.c diff --git a/cgroups/cgroup_utils.h b/src/cgroups/cgroup_utils.h similarity index 100% rename from cgroups/cgroup_utils.h rename to src/cgroups/cgroup_utils.h diff --git a/cpuset_parse.c b/src/cpuset_parse.c similarity index 100% rename from cpuset_parse.c rename to src/cpuset_parse.c diff --git a/cpuset_parse.h b/src/cpuset_parse.h similarity index 100% rename from cpuset_parse.h rename to src/cpuset_parse.h diff --git a/lxcfs.c b/src/lxcfs.c similarity index 100% rename from lxcfs.c rename to src/lxcfs.c diff --git a/macro.h b/src/macro.h similarity index 100% rename from macro.h rename to src/macro.h diff --git a/memory_utils.h b/src/memory_utils.h similarity index 100% rename from memory_utils.h rename to src/memory_utils.h diff --git a/proc_cpuview.c b/src/proc_cpuview.c similarity index 100% rename from proc_cpuview.c rename to src/proc_cpuview.c diff --git a/proc_cpuview.h b/src/proc_cpuview.h similarity index 100% rename from proc_cpuview.h rename to src/proc_cpuview.h diff --git a/proc_fuse.c b/src/proc_fuse.c similarity index 100% rename from proc_fuse.c rename to src/proc_fuse.c diff --git a/proc_fuse.h b/src/proc_fuse.h similarity index 100% rename from proc_fuse.h rename to src/proc_fuse.h diff --git a/proc_loadavg.c b/src/proc_loadavg.c similarity index 100% rename from proc_loadavg.c rename to src/proc_loadavg.c diff --git a/proc_loadavg.h b/src/proc_loadavg.h similarity index 100% rename from proc_loadavg.h rename to src/proc_loadavg.h diff --git a/sysfs_fuse.c b/src/sysfs_fuse.c similarity index 100% rename from sysfs_fuse.c rename to src/sysfs_fuse.c diff --git a/sysfs_fuse.h b/src/sysfs_fuse.h similarity index 100% rename from sysfs_fuse.h rename to src/sysfs_fuse.h diff --git a/utils.c b/src/utils.c similarity index 100% rename from utils.c rename to src/utils.c diff --git a/utils.h b/src/utils.h similarity index 100% rename from utils.h rename to src/utils.h
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel