From: Jeff Layton <jlayton@kernel.org>
To: Steve Dickson <steved@redhat.com>
Cc: linux-nfs@vger.kernel.org, Jeff Layton <jlayton@kernel.org>
Subject: [PATCH] exportfs: drop unused is_export parameter from xtab_read() and xtab_write()
Date: Thu, 14 May 2026 15:40:39 -0400 [thread overview]
Message-ID: <20260514-exportd-v1-1-be603d7fac41@kernel.org> (raw)
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>
next reply other threads:[~2026-05-14 19:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-14 19:40 Jeff Layton [this message]
2026-05-14 19:46 ` [PATCH] exportfs: drop unused is_export parameter from xtab_read() and xtab_write() Jeff Layton
2026-05-15 12:52 ` Steve Dickson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260514-exportd-v1-1-be603d7fac41@kernel.org \
--to=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=steved@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.