X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fexportfs%2Fexportfs.c;h=593a8ebd467e1081b4f7ed4110df89712bc8c248;hp=18dfe5ad8046c124b7e2cb8fb76da6800eeb8dba;hb=9ccfe0fa5a43dfc4453b09e328565a6c8f999fe4;hpb=173ac3ccb45cc407336dd363fc15c90bbfdecf6f diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c index 18dfe5a..593a8eb 100644 --- a/utils/exportfs/exportfs.c +++ b/utils/exportfs/exportfs.c @@ -12,6 +12,7 @@ #include #endif +#include #include #include #include @@ -110,7 +111,6 @@ main(int argc, char **argv) return 0; } } - if (f_export && ! f_ignore) export_read(_PATH_EXPORTS); if (f_export) { @@ -192,10 +192,10 @@ exports_update(int verbose) { nfs_export *exp; - for (exp = exportlist[MCL_FQDN]; exp; exp=exp->m_next) { + for (exp = exportlist[MCL_FQDN].p_head; exp; exp=exp->m_next) { exports_update_one(exp, verbose); } - for (exp = exportlist[MCL_GSS]; exp; exp=exp->m_next) { + for (exp = exportlist[MCL_GSS].p_head; exp; exp=exp->m_next) { exports_update_one(exp, verbose); } } @@ -211,7 +211,7 @@ export_all(int verbose) int i; for (i = 0; i < MCL_MAXTYPES; i++) { - for (exp = exportlist[i]; exp; exp = exp->m_next) { + for (exp = exportlist[i].p_head; exp; exp = exp->m_next) { if (verbose) printf("exporting %s:%s\n", exp->m_client->m_hostname, @@ -307,7 +307,7 @@ unexportfs(char *arg, int verbose) } } - for (exp = exportlist[htype]; exp; exp = exp->m_next) { + for (exp = exportlist[htype].p_head; exp; exp = exp->m_next) { if (path && strcmp(path, exp->m_export.e_path)) continue; if (htype != exp->m_client->m_type) @@ -388,6 +388,8 @@ validate_export(nfs_export *exp) */ struct stat stb; char *path = exp->m_export.e_path; + struct statfs64 stf; + int fs_has_fsid = 0; if (stat(path, &stb) < 0) { fprintf(stderr, "exportfs: Warning: %s does not exist\n", @@ -403,7 +405,12 @@ validate_export(nfs_export *exp) if (!can_test()) return; - if ((exp->m_export.e_flags & NFSEXP_FSID) || exp->m_export.e_uuid) { + if (!statfs64(path, &stf) && + (stf.f_fsid.__val[0] || stf.f_fsid.__val[1])) + fs_has_fsid = 1; + + if ((exp->m_export.e_flags & NFSEXP_FSID) || exp->m_export.e_uuid || + fs_has_fsid) { if ( !test_export(path, 1)) { fprintf(stderr, "exportfs: Warning: %s does not " "support NFS export.\n", @@ -445,7 +452,7 @@ dump(int verbose) char *hname, c; for (htype = 0; htype < MCL_MAXTYPES; htype++) { - for (exp = exportlist[htype]; exp; exp = exp->m_next) { + for (exp = exportlist[htype].p_head; exp; exp = exp->m_next) { ep = &exp->m_export; if (!exp->m_xtabent) continue; /* neilb */