From f64f12079c81236a413f603304b66f3b56ba6181 Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Mon, 9 Mar 2026 11:51:31 +1100 Subject: [PATCH] libspl/mnttab: remove getmntany() Only used for when the mount cache was disabled, but since its always enabled now, we don't need it. Sponsored-by: TrueNAS Reviewed-by: Ameer Hamza Reviewed-by: Brian Behlendorf Signed-off-by: Rob Norris Closes #18296 --- lib/libspl/include/os/freebsd/sys/mnttab.h | 1 - lib/libspl/include/os/linux/sys/mnttab.h | 1 - lib/libspl/os/freebsd/mnttab.c | 35 +--------------------- lib/libspl/os/linux/mnttab.c | 17 ----------- 4 files changed, 1 insertion(+), 53 deletions(-) diff --git a/lib/libspl/include/os/freebsd/sys/mnttab.h b/lib/libspl/include/os/freebsd/sys/mnttab.h index e520bf5ef..0d47f8e48 100644 --- a/lib/libspl/include/os/freebsd/sys/mnttab.h +++ b/lib/libspl/include/os/freebsd/sys/mnttab.h @@ -75,7 +75,6 @@ struct extmnttab { struct stat64; struct statfs; -extern int getmntany(FILE *fp, struct mnttab *mp, struct mnttab *mpref); extern int _sol_getmntent(FILE *fp, struct mnttab *mp); extern int getextmntent(const char *path, struct extmnttab *entry, struct stat64 *statbuf); diff --git a/lib/libspl/include/os/linux/sys/mnttab.h b/lib/libspl/include/os/linux/sys/mnttab.h index c1b7f3b38..d37172748 100644 --- a/lib/libspl/include/os/linux/sys/mnttab.h +++ b/lib/libspl/include/os/linux/sys/mnttab.h @@ -71,7 +71,6 @@ struct extmnttab { struct statfs; -extern int getmntany(FILE *fp, struct mnttab *mp, struct mnttab *mpref); extern int _sol_getmntent(FILE *fp, struct mnttab *mp); extern int getextmntent(const char *path, struct extmnttab *mp, struct stat64 *statbuf); diff --git a/lib/libspl/os/freebsd/mnttab.c b/lib/libspl/os/freebsd/mnttab.c index 5287da132..db7caba9f 100644 --- a/lib/libspl/os/freebsd/mnttab.c +++ b/lib/libspl/os/freebsd/mnttab.c @@ -26,8 +26,7 @@ */ /* - * This file implements Solaris compatible getmntany() and hasmntopt() - * functions. + * This file implements Solaris compatible hasmntopt() functions. */ #include @@ -176,38 +175,6 @@ fail: return (error); } -int -getmntany(FILE *fd __unused, struct mnttab *mgetp, struct mnttab *mrefp) -{ - int i, error; - - error = statfs_init(); - if (error != 0) - return (error); - - (void) pthread_rwlock_rdlock(&gsfs_lock); - - for (i = 0; i < allfs; i++) { - if (mrefp->mnt_special != NULL && - strcmp(mrefp->mnt_special, gsfs[i].f_mntfromname) != 0) { - continue; - } - if (mrefp->mnt_mountp != NULL && - strcmp(mrefp->mnt_mountp, gsfs[i].f_mntonname) != 0) { - continue; - } - if (mrefp->mnt_fstype != NULL && - strcmp(mrefp->mnt_fstype, gsfs[i].f_fstypename) != 0) { - continue; - } - statfs2mnttab(&gsfs[i], mgetp); - (void) pthread_rwlock_unlock(&gsfs_lock); - return (0); - } - (void) pthread_rwlock_unlock(&gsfs_lock); - return (-1); -} - int getmntent(FILE *fp, struct mnttab *mp) { diff --git a/lib/libspl/os/linux/mnttab.c b/lib/libspl/os/linux/mnttab.c index ee1cdf59b..ee103622c 100644 --- a/lib/libspl/os/linux/mnttab.c +++ b/lib/libspl/os/linux/mnttab.c @@ -45,23 +45,6 @@ static __thread char buf[BUFSIZE]; -#define DIFF(xx) ( \ - (mrefp->xx != NULL) && \ - (mgetp->xx == NULL || strcmp(mrefp->xx, mgetp->xx) != 0)) - -int -getmntany(FILE *fp, struct mnttab *mgetp, struct mnttab *mrefp) -{ - int ret; - - while ( - ((ret = _sol_getmntent(fp, mgetp)) == 0) && ( - DIFF(mnt_special) || DIFF(mnt_mountp) || - DIFF(mnt_fstype) || DIFF(mnt_mntopts))) { } - - return (ret); -} - int _sol_getmntent(FILE *fp, struct mnttab *mgetp) {