All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] exportfs: drop unused is_export parameter from xtab_read() and xtab_write()
@ 2026-05-14 19:40 Jeff Layton
  2026-05-14 19:46 ` Jeff Layton
  2026-05-15 12:52 ` Steve Dickson
  0 siblings, 2 replies; 3+ messages in thread
From: Jeff Layton @ 2026-05-14 19:40 UTC (permalink / raw)
  To: Steve Dickson; +Cc: linux-nfs, Jeff Layton

The is_export parameter is always passed as 1. Remove it and simplify
both functions by eliminating the dead is_export == 0 code paths.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 support/export/xtab.c | 39 +++++++++++++--------------------------
 1 file changed, 13 insertions(+), 26 deletions(-)

diff --git a/support/export/xtab.c b/support/export/xtab.c
index 282f15bc79cd..0a9660512b26 100644
--- a/support/export/xtab.c
+++ b/support/export/xtab.c
@@ -33,11 +33,8 @@ int v4root_needed;
 static void cond_rename(char *newfile, char *oldfile);
 
 static int
-xtab_read(char *xtab, char *lockfn, int is_export)
+xtab_read(char *xtab, char *lockfn)
 {
-    /* 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
-     */
 	struct exportent	*xp;
 	nfs_export		*exp;
 	int			lockid;
@@ -45,11 +42,10 @@ xtab_read(char *xtab, char *lockfn, int is_export)
 	if ((lockid = xflock(lockfn, "r")) < 0)
 		return 0;
 	setexportent(xtab, "r");
-	if (is_export == 1)
-		v4root_needed = 1;
-	while ((xp = getexportent(is_export==0)) != NULL) {
-		if (!(exp = export_lookup(xp->e_hostname, xp->e_path, is_export != 1)) &&
-		    !(exp = export_create(xp, is_export!=1))) {
+	v4root_needed = 1;
+	while ((xp = getexportent(0)) != NULL) {
+		if (!(exp = export_lookup(xp->e_hostname, xp->e_path, 0)) &&
+		    !(exp = export_create(xp, 0))) {
                         if(xp->e_hostname) {
                             free(xp->e_hostname);
                             xp->e_hostname=NULL;
@@ -60,17 +56,10 @@ xtab_read(char *xtab, char *lockfn, int is_export)
                         }
 			continue;
 		}
-		switch (is_export) {
-		case 0:
-			exp->m_exported = 1;
-			break;
-		case 1:
-			exp->m_xtabent = 1;
-			exp->m_mayexport = 1;
-			if ((xp->e_flags & NFSEXP_FSID) && xp->e_fsid == 0)
-				v4root_needed = 0;
-			break;
-		}  
+		exp->m_xtabent = 1;
+		exp->m_mayexport = 1;
+		if ((xp->e_flags & NFSEXP_FSID) && xp->e_fsid == 0)
+			v4root_needed = 0;
                 if(xp->e_hostname) {
                     free(xp->e_hostname);
                     xp->e_hostname=NULL;
@@ -90,7 +79,7 @@ xtab_read(char *xtab, char *lockfn, int is_export)
 int
 xtab_export_read(void)
 {
-	return xtab_read(etab.statefn, etab.lockfn, 1);
+	return xtab_read(etab.statefn, etab.lockfn);
 }
 
 /*
@@ -100,7 +89,7 @@ xtab_export_read(void)
  * fix the auth_reload logic as well...
  */
 static int
-xtab_write(char *xtab, char *xtabtmp, char *lockfn, int is_export)
+xtab_write(char *xtab, char *xtabtmp, char *lockfn)
 {
 	struct exportent	xe;
 	nfs_export		*exp;
@@ -114,9 +103,7 @@ xtab_write(char *xtab, char *xtabtmp, char *lockfn, int is_export)
 
 	for (i = 0; i < MCL_MAXTYPES; i++) {
 		for (exp = exportlist[i].p_head; exp; exp = exp->m_next) {
-			if (is_export && !exp->m_xtabent)
-				continue;
-			if (!is_export && ! exp->m_exported)
+			if (!exp->m_xtabent)
 				continue;
 
 			/* write out the export entry using the FQDN */
@@ -137,7 +124,7 @@ xtab_write(char *xtab, char *xtabtmp, char *lockfn, int is_export)
 int
 xtab_export_write(void)
 {
-	return xtab_write(etab.statefn, etab.tmpfn, etab.lockfn, 1);
+	return xtab_write(etab.statefn, etab.tmpfn, etab.lockfn);
 }
 
 /*

---
base-commit: cbbf618b31b64198de06a350c4f5744c76e51ecb
change-id: 20260514-exportd-ceb123e6fff2

Best regards,
-- 
Jeff Layton <jlayton@kernel.org>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-15 12:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-14 19:40 [PATCH] exportfs: drop unused is_export parameter from xtab_read() and xtab_write() Jeff Layton
2026-05-14 19:46 ` Jeff Layton
2026-05-15 12:52 ` Steve Dickson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.