X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=utils%2Fmountd%2Fcache.c;h=85e89753c760b81044a2b5b9d535ba3c7d467d6c;hb=4f7fc41f6324daad94c37e9327567d27a0d50afe;hp=fb2a8e7281c5832264e545ed18fe4f908ad1e856;hpb=be73b5afb50ecfda9d85aaac247792b1b7d7dc62;p=nfs-utils.git diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c index fb2a8e7..85e8975 100644 --- a/utils/mountd/cache.c +++ b/utils/mountd/cache.c @@ -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) { @@ -461,7 +469,8 @@ void nfsd_fh(FILE *f) } if (found) - cache_export_ent(dom, found, found_path); + if (cache_export_ent(dom, found, found_path) < 0) + found = 0; qword_print(f, dom); qword_printint(f, fsidtype); @@ -517,6 +526,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 +537,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); } @@ -609,8 +620,10 @@ void nfsd_export(FILE *f) } if (found) { - dump_to_cache(f, dom, path, &found->m_export); - mountlist_add(dom, path); + if (dump_to_cache(f, dom, path, &found->m_export) < 0) + dump_to_cache(f, dom, path, NULL); + else + mountlist_add(dom, path); } else { dump_to_cache(f, dom, path, NULL); }