Re: [systemd-devel] [RFC 1/4] use libmount to enumerate /proc/self/mountinfo
On Sat, Nov 15, 2014 at 02:09:26PM +0100, Tom Gundersen wrote: > Usually we don't do this kind of fallback, but rather disable the relevant > functionality if the lib is not available. > > In this case I guess it means making support for .mount units optional. I > could imagine someone doing that in very specialised use cases, but maybe > it makes more sense to make the library a hard dependency for now... OK, I was following the optional lead from libblkid and I guess thinking about non util-linux/libmount mount implementations (busybox?). But I see that util-linux is listed as a hard dependency anyway, so I'll remove the fallback code and send updated patches. - Chris ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [RFC 1/4] use libmount to enumerate /proc/self/mountinfo
Usually we don't do this kind of fallback, but rather disable the relevant functionality if the lib is not available. In this case I guess it means making support for .mount units optional. I could imagine someone doing that in very specialised use cases, but maybe it makes more sense to make the library a hard dependency for now... Cheers, Tom On 7 Nov 2014 06:11, "Chris Leech" wrote: > This lets libmount add in user options from /run/mount/utab, like > _netdev which is needed to get proper ordering against remote-fs.target > --- > .travis.yml | 2 +- > Makefile.am | 4 +++- > README | 1 + > configure.ac | 13 > src/core/build.h | 7 +++ > src/core/mount.c | 62 > > 6 files changed, 87 insertions(+), 2 deletions(-) > > diff --git a/.travis.yml b/.travis.yml > index 7e5251c..4ea2bc2 100644 > --- a/.travis.yml > +++ b/.travis.yml > @@ -3,7 +3,7 @@ compiler: >- gcc > before_install: > - sudo apt-get update -qq > - - sudo apt-get install autotools-dev automake autoconf libtool > libdbus-1-dev libcap-dev libblkid-dev libpam-dev libcryptsetup-dev > libaudit-dev libacl1-dev libattr1-dev libselinux-dev liblzma-dev > libgcrypt-dev libqrencode-dev libmicrohttpd-dev gtk-doc-tools gperf > python2.7-dev > + - sudo apt-get install autotools-dev automake autoconf libtool > libdbus-1-dev libcap-dev libblkid-dev libmount-dev libpam-dev > libcryptsetup-dev libaudit-dev libacl1-dev libattr1-dev libselinux-dev > liblzma-dev libgcrypt-dev libqrencode-dev libmicrohttpd-dev gtk-doc-tools > gperf python2.7-dev > script: ./autogen.sh && ./configure --enable-gtk-doc --enable-gtk-doc-pdf > && make V=1 && sudo ./systemd-machine-id-setup && make check && make > distcheck > after_failure: cat test-suite.log > notifications: > diff --git a/Makefile.am b/Makefile.am > index 461ffa9..3deffe8 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -1163,6 +1163,7 @@ libsystemd_core_la_CFLAGS = \ > $(KMOD_CFLAGS) \ > $(APPARMOR_CFLAGS) \ > $(SECCOMP_CFLAGS) \ > + $(MOUNT_CFLAGS) \ > -pthread > > libsystemd_core_la_LIBADD = \ > @@ -1177,7 +1178,8 @@ libsystemd_core_la_LIBADD = \ > $(CAP_LIBS) \ > $(KMOD_LIBS) \ > $(APPARMOR_LIBS) \ > - $(SECCOMP_LIBS) > + $(SECCOMP_LIBS) \ > + $(MOUNT_LIBS) > > if HAVE_SECCOMP > libsystemd_core_la_LIBADD += \ > diff --git a/README b/README > index aefb349..89abc3e 100644 > --- a/README > +++ b/README > @@ -108,6 +108,7 @@ REQUIREMENTS: > libcap > libseccomp >= 1.0.0 (optional) > libblkid >= 2.20 (from util-linux) (optional) > +libmount >= 2.20 (from util-linux) (optional) > libkmod >= 15 (optional) > PAM >= 1.1.2 (optional) > libcryptsetup (optional) > diff --git a/configure.ac b/configure.ac > index 05fc00d..85ff053 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -426,6 +426,18 @@ fi > AM_CONDITIONAL(HAVE_BLKID, [test "$have_blkid" = "yes"]) > > # > -- > +have_libmount=no > +AC_ARG_ENABLE(libmount, AS_HELP_STRING([--disable-libmount], [disable > libmount support])) > +if test "x$enable_libmount" != "xno"; then > +PKG_CHECK_MODULES(MOUNT, [ mount >= 2.20 ], > +[AC_DEFINE(HAVE_LIBMOUNT, 1, [Define if libmount is > available]) have_libmount=yes], have_libmount=no) > +if test "x$have_libmount" = xno -a "x$enable_libmount" = xyes; > then > +AC_MSG_ERROR([*** libmount support requested but > libraries not found]) > +fi > +fi > +AM_CONDITIONAL(HAVE_LIBMOUNT, [test "$have_libmount" = "yes"]) > + > +# > -- > have_seccomp=no > AC_ARG_ENABLE(seccomp, AS_HELP_STRING([--disable-seccomp], [Disable > optional SECCOMP support])) > if test "x$enable_seccomp" != "xno"; then > @@ -1374,6 +1386,7 @@ AC_MSG_RESULT([ > efi: ${have_efi} > kmod:${have_kmod} > blkid: ${have_blkid} > +libmount:${have_libmount} > dbus:${have_dbus} > nss-myhostname: ${have_myhostname} > gudev: ${enable_gudev} > diff --git a/src/core/build.h b/src/core/build.h > index d5e5550..5644693 100644 > --- a/src/core/build.h > +++ b/src/core/build.h > @@ -117,6 +117,12 @@ > #define _BLKID_FEATURE_ "-BLKID" > #endif > > +#ifdef HAVE_LIBMOUNT > +#define _LIBMOUNT_FEATURE_ "+LIBMOUNT" > +#else > +#define _LIBMOUNT_FEATURE_ "-LIBMOUNT" > +#endif > + > #ifdef HAVE_ELFUTILS > #define _ELFUTILS_FEATURE_ "+ELFUTILS" > #else > @@ -152,6 +158,7 @@ > _LZ4_FEATURE_ " " \ > _SECCOMP_FEATURE_ " " \ > _BLKID
[systemd-devel] [RFC 1/4] use libmount to enumerate /proc/self/mountinfo
This lets libmount add in user options from /run/mount/utab, like _netdev which is needed to get proper ordering against remote-fs.target --- .travis.yml | 2 +- Makefile.am | 4 +++- README | 1 + configure.ac | 13 src/core/build.h | 7 +++ src/core/mount.c | 62 6 files changed, 87 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7e5251c..4ea2bc2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ compiler: - gcc before_install: - sudo apt-get update -qq - - sudo apt-get install autotools-dev automake autoconf libtool libdbus-1-dev libcap-dev libblkid-dev libpam-dev libcryptsetup-dev libaudit-dev libacl1-dev libattr1-dev libselinux-dev liblzma-dev libgcrypt-dev libqrencode-dev libmicrohttpd-dev gtk-doc-tools gperf python2.7-dev + - sudo apt-get install autotools-dev automake autoconf libtool libdbus-1-dev libcap-dev libblkid-dev libmount-dev libpam-dev libcryptsetup-dev libaudit-dev libacl1-dev libattr1-dev libselinux-dev liblzma-dev libgcrypt-dev libqrencode-dev libmicrohttpd-dev gtk-doc-tools gperf python2.7-dev script: ./autogen.sh && ./configure --enable-gtk-doc --enable-gtk-doc-pdf && make V=1 && sudo ./systemd-machine-id-setup && make check && make distcheck after_failure: cat test-suite.log notifications: diff --git a/Makefile.am b/Makefile.am index 461ffa9..3deffe8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1163,6 +1163,7 @@ libsystemd_core_la_CFLAGS = \ $(KMOD_CFLAGS) \ $(APPARMOR_CFLAGS) \ $(SECCOMP_CFLAGS) \ + $(MOUNT_CFLAGS) \ -pthread libsystemd_core_la_LIBADD = \ @@ -1177,7 +1178,8 @@ libsystemd_core_la_LIBADD = \ $(CAP_LIBS) \ $(KMOD_LIBS) \ $(APPARMOR_LIBS) \ - $(SECCOMP_LIBS) + $(SECCOMP_LIBS) \ + $(MOUNT_LIBS) if HAVE_SECCOMP libsystemd_core_la_LIBADD += \ diff --git a/README b/README index aefb349..89abc3e 100644 --- a/README +++ b/README @@ -108,6 +108,7 @@ REQUIREMENTS: libcap libseccomp >= 1.0.0 (optional) libblkid >= 2.20 (from util-linux) (optional) +libmount >= 2.20 (from util-linux) (optional) libkmod >= 15 (optional) PAM >= 1.1.2 (optional) libcryptsetup (optional) diff --git a/configure.ac b/configure.ac index 05fc00d..85ff053 100644 --- a/configure.ac +++ b/configure.ac @@ -426,6 +426,18 @@ fi AM_CONDITIONAL(HAVE_BLKID, [test "$have_blkid" = "yes"]) # -- +have_libmount=no +AC_ARG_ENABLE(libmount, AS_HELP_STRING([--disable-libmount], [disable libmount support])) +if test "x$enable_libmount" != "xno"; then +PKG_CHECK_MODULES(MOUNT, [ mount >= 2.20 ], +[AC_DEFINE(HAVE_LIBMOUNT, 1, [Define if libmount is available]) have_libmount=yes], have_libmount=no) +if test "x$have_libmount" = xno -a "x$enable_libmount" = xyes; then +AC_MSG_ERROR([*** libmount support requested but libraries not found]) +fi +fi +AM_CONDITIONAL(HAVE_LIBMOUNT, [test "$have_libmount" = "yes"]) + +# -- have_seccomp=no AC_ARG_ENABLE(seccomp, AS_HELP_STRING([--disable-seccomp], [Disable optional SECCOMP support])) if test "x$enable_seccomp" != "xno"; then @@ -1374,6 +1386,7 @@ AC_MSG_RESULT([ efi: ${have_efi} kmod:${have_kmod} blkid: ${have_blkid} +libmount:${have_libmount} dbus:${have_dbus} nss-myhostname: ${have_myhostname} gudev: ${enable_gudev} diff --git a/src/core/build.h b/src/core/build.h index d5e5550..5644693 100644 --- a/src/core/build.h +++ b/src/core/build.h @@ -117,6 +117,12 @@ #define _BLKID_FEATURE_ "-BLKID" #endif +#ifdef HAVE_LIBMOUNT +#define _LIBMOUNT_FEATURE_ "+LIBMOUNT" +#else +#define _LIBMOUNT_FEATURE_ "-LIBMOUNT" +#endif + #ifdef HAVE_ELFUTILS #define _ELFUTILS_FEATURE_ "+ELFUTILS" #else @@ -152,6 +158,7 @@ _LZ4_FEATURE_ " " \ _SECCOMP_FEATURE_ " " \ _BLKID_FEATURE_ " " \ +_LIBMOUNT_FEATURE_ " " \ _ELFUTILS_FEATURE_ " " \ _KMOD_FEATURE_ " " \ _IDN_FEATURE_ " " diff --git a/src/core/mount.c b/src/core/mount.c index 8b787f6..a639515 100644 --- a/src/core/mount.c +++ b/src/core/mount.c @@ -25,6 +25,12 @@ #include #include +#ifdef HAVE_LIBMOUNT +#include +#else +#define mnt_init_debug(m) do {} while (0) +#endif + #include "manager.h" #include "unit.h" #include "mou