From 394e388e1e62d88f2771a3a65ed34c63c1e481bf Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 15 Nov 2016 12:03:24 -0500 Subject: Remove all use of /var/lib/nfs/xtab /var/lib/nfs/xtab is only used to find out what has been exported to the kernel. This is more reliably done by reading /proc/fs/nfs{,d}/export and nfs-utils uses that file if is available. So xtab is only need if you have an incredibly ancient kernel which doesn't have /proc/fs/nfs/export (and so which only supports NFSv2) or if /proc is not mounted. Neither of these are credible contexts to run a modern nfs-utils, so stop creating or reading the xtab file. Signed-off-by: NeilBrown Signed-off-by: Steve Dickson --- support/export/xtab.c | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) (limited to 'support/export/xtab.c') diff --git a/support/export/xtab.c b/support/export/xtab.c index e953071..10d9dbc 100644 --- a/support/export/xtab.c +++ b/support/export/xtab.c @@ -1,7 +1,7 @@ /* * support/export/xtab.c * - * Interface to the xtab file. + * Interface to the etab/exports file. * * Copyright (C) 1995, 1996 Olaf Kirch */ @@ -29,7 +29,6 @@ xtab_read(char *xtab, char *lockfn, int is_export) { /* is_export == 0 => reading /proc/fs/nfs/exports - we know these things are exported to kernel * is_export == 1 => reading /var/lib/nfs/etab - these things are allowed to be exported - * is_export == 2 => reading /var/lib/nfs/xtab - these things might be known to kernel */ struct exportent *xp; nfs_export *exp; @@ -55,9 +54,6 @@ xtab_read(char *xtab, char *lockfn, int is_export) if ((xp->e_flags & NFSEXP_FSID) && xp->e_fsid == 0) v4root_needed = 0; break; - case 2: - exp->m_exported = -1;/* may be exported */ - break; } } endexportent(); @@ -79,7 +75,7 @@ xtab_mount_read(void) return xtab_read(_PATH_PROC_EXPORTS_ALT, _PATH_PROC_EXPORTS_ALT, 0); } else - return xtab_read(_PATH_XTAB, _PATH_XTABLCK, 2); + return 0; } int @@ -135,29 +131,6 @@ xtab_export_write() return xtab_write(_PATH_ETAB, _PATH_ETABTMP, _PATH_ETABLCK, 1); } -int -xtab_mount_write() -{ - return xtab_write(_PATH_XTAB, _PATH_XTABTMP, _PATH_XTABLCK, 0); -} - -void -xtab_append(nfs_export *exp) -{ - struct exportent xe; - int lockid; - - if ((lockid = xflock(_PATH_XTABLCK, "w")) < 0) - return; - setexportent(_PATH_XTAB, "a"); - xe = exp->m_export; - xe.e_hostname = exp->m_client->m_hostname; - putexportent(&xe); - endexportent(); - xfunlock(lockid); - exp->m_xtabent = 1; -} - /* * rename newfile onto oldfile unless * they are identical -- cgit