Libcgroup should not mess up with systemd 'name=systemd' hierarchy. Let's
add ./configure option to ignore it on distros, which use it.

Only one hierarchy can be ignored, at least at this time, further
enhancement is possible.

Usage:
$ configure --enable-opaque-hierarchy="name=systemd"

Signed-off-by: Jan Safranek <jsafr...@redhat.com>
---

 configure.in |   13 +++++++++++++
 src/api.c    |    9 +++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/configure.in b/configure.in
index d1f19a2..69cf5d4 100644
--- a/configure.in
+++ b/configure.in
@@ -136,6 +136,19 @@ AC_ARG_ENABLE([pam-module-dir],
        ], [])
 AC_SUBST([pamlibdir],"$pam_module_dir")
 
+AC_ARG_ENABLE([opaque-hierarchy],
+       [AC_HELP_STRING([--enable-opaque-hierarchy=NAME],
+               [specify name of a hierarchy which libcgroup should ignore, 
e.g. name=systemd]
+               (default=none))],
+       [
+               if test "x$enableval" = xno -o "x$enableval" = xyes; then
+                       AC_MSG_ERROR([Provide name of a hierarchy.])
+               else
+                       AC_DEFINE_UNQUOTED([OPAQUE_HIERARCHY], "$enableval",
+                               [Define to ignore specific hierarchy.])
+               fi
+       ], [])
+
 # Checks for programs.
 AC_PROG_CXX
 AC_PROG_CC
diff --git a/src/api.c b/src/api.c
index 7233319..e2e7efe 100644
--- a/src/api.c
+++ b/src/api.c
@@ -984,6 +984,15 @@ int cgroup_init(void)
                         * Check if it is a duplicate
                         */
                        duplicate = 0;
+
+#ifdef OPAQUE_HIERARCHY
+                       /*
+                        * Ignore the opaque hierarchy.
+                        */
+                       if (strcmp(mntopt, OPAQUE_HIERARCHY) == 0)
+                                       continue;
+#endif
+
                        for (j = 0; j < found_mnt; j++) {
                                if (strncmp(mntopt, cg_mount_table[j].name,
                                                        FILENAME_MAX) == 0) {


------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to