]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
Allow disabling of libblkid usage.
authorNeil Brown <neilb@suse.de>
Tue, 20 Mar 2007 00:47:28 +0000 (11:47 +1100)
committerNeil Brown <neilb@suse.de>
Tue, 20 Mar 2007 00:47:28 +0000 (11:47 +1100)
Some versions of libblkid have a terrible memory leak which makes
mounted grow toooo big.  So support
   --disable-uuid
to remove the uuid functionality and liblkid with it.

configure.in
utils/mountd/cache.c

index 124065632cc13e1d34051b2349aedaa29dac3196..ce5e2a0174ccae5ff893f2fdd53eaea023a4407b 100644 (file)
@@ -125,6 +125,11 @@ AC_ARG_WITH(rpcgen,
        RPCGEN_PATH= )
        AC_SUBST(RPCGEN_PATH)
        AM_CONDITIONAL(CONFIG_RPCGEN, [test "$RPCGEN_PATH" == ""])
+AC_ARG_ENABLE(uuid,
+       [AC_HELP_STRING([--without-uuid], [Exclude uuid support and so avoid possibly buggy libblkid])],
+       if test "$enableval" = "yes" ; then use_blkid=1; else use_blkid=0; fi,
+       use_blkid=1)
+       AC_DEFINE_UNQUOTED(USE_BLKID, $use_blkid, [Define if you want to use blkid to find uuid of filesystems])
 AC_ARG_ENABLE(mount,
        [AC_HELP_STRING([--enable-mount],
                        [Create mount.nfs and don't use the util-linux mount(8) functionality. @<:@default=no@:>@])],
@@ -196,8 +201,10 @@ fi
 if test "$knfsd_cv_glibc2" = no; then
     AC_CHECK_LIB(bsd, daemon, [LIBBSD="-lbsd"])
 fi
-AC_CHECK_LIB(blkid, blkid_get_cache, [LIBBLKID="-lblkid"], AC_MSG_ERROR([libblkid needed]))
-AC_CHECK_HEADER(blkid/blkid.h, , AC_MSG_ERROR([Cannot file libblkid header file blkid/blkid.h]))
+if test "$use_blkid" = 1; then
+   AC_CHECK_LIB(blkid, blkid_get_cache, [LIBBLKID="-lblkid"], AC_MSG_ERROR([libblkid needed]))
+   AC_CHECK_HEADER(blkid/blkid.h, , AC_MSG_ERROR([Cannot file libblkid header file blkid/blkid.h]))
+fi
 AC_SUBST(LIBSOCKET)
 AC_SUBST(LIBCRYPT)
 AC_SUBST(LIBBSD)
index fb2a8e7281c5832264e545ed18fe4f908ad1e856..e8d72fa0beb1bd366ad213e07e17128ec8c401e9 100644 (file)
@@ -31,7 +31,9 @@
 #include "xmalloc.h"
 #include "fsloc.h"
 
+#ifdef USE_BLKID
 #include "blkid/blkid.h"
+#endif
 
 
 enum nfsd_fsid {
@@ -152,6 +154,7 @@ void auth_unix_gid(FILE *f)
                free(groups);
 }
 
+#if USE_BLKID
 int get_uuid(char *path, char *uuid, int uuidlen, char *u)
 {
        /* extract hex digits from uuidstr and compose a uuid
@@ -216,6 +219,7 @@ int get_uuid(char *path, char *uuid, int uuidlen, char *u)
        }
        return 1;
 }
+#endif
 
 /* Iterate through /etc/mtab, finding mountpoints
  * at or below a given path
@@ -418,6 +422,7 @@ void nfsd_fh(FILE *f)
                                if (!is_mountpoint(path))
                                        continue;
                        check_uuid:
+#if USE_BLKID
                                if (exp->m_export.e_uuid)
                                        get_uuid(NULL, exp->m_export.e_uuid,
                                                 uuidlen, u);
@@ -428,6 +433,9 @@ void nfsd_fh(FILE *f)
                                if (memcmp(u, fhuuid, uuidlen) != 0)
                                        continue;
                                break;
+#else
+                               continue;
+#endif
                        }
                        /* It's a match !! */
                        if (!found) {
@@ -517,6 +525,7 @@ static int dump_to_cache(FILE *f, char *domain, char *path, struct exportent *ex
                qword_printint(f, exp->e_anongid);
                qword_printint(f, exp->e_fsid);
                write_fsloc(f, exp, path);
+#if USE_BLKID
                if (exp->e_uuid == NULL) {
                        char u[16];
                        if (get_uuid(path, NULL, 16, u)) {
@@ -527,6 +536,7 @@ static int dump_to_cache(FILE *f, char *domain, char *path, struct exportent *ex
                        qword_print(f, "uuid");
                        qword_printhex(f, exp->e_uuid, 16);
                }
+#endif
        }
        return qword_eol(f);
 }