mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
libspl/mnttab: remove struct extmnttab
The two additional fields are never used by calling code, and we can replace their sole internal use with an extra stack param. Sponsored-by: TrueNAS Reviewed-by: Ameer Hamza <ahamza@ixsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rob Norris <rob.norris@truenas.com> Closes #18296
This commit is contained in:
committed by
Brian Behlendorf
parent
f64f12079c
commit
a59e712d25
@@ -68,7 +68,7 @@ _sol_getmntent(FILE *fp, struct mnttab *mgetp)
|
||||
}
|
||||
|
||||
static int
|
||||
getextmntent_impl(FILE *fp, struct extmnttab *mp, uint64_t *mnt_id)
|
||||
getextmntent_impl(FILE *fp, struct mnttab *mp, uint64_t *mnt_id, dev_t *dev)
|
||||
{
|
||||
int ret;
|
||||
struct stat64 st;
|
||||
@@ -84,19 +84,17 @@ getextmntent_impl(FILE *fp, struct extmnttab *mp, uint64_t *mnt_id)
|
||||
*mnt_id = stx.stx_mnt_id;
|
||||
#endif
|
||||
if (stat64(mp->mnt_mountp, &st) != 0) {
|
||||
mp->mnt_major = 0;
|
||||
mp->mnt_minor = 0;
|
||||
*dev = 0;
|
||||
return (ret);
|
||||
}
|
||||
mp->mnt_major = major(st.st_dev);
|
||||
mp->mnt_minor = minor(st.st_dev);
|
||||
*dev = st.st_dev;
|
||||
}
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
||||
int
|
||||
getextmntent(const char *path, struct extmnttab *entry, struct stat64 *statbuf)
|
||||
getextmntent(const char *path, struct mnttab *entry, struct stat64 *statbuf)
|
||||
{
|
||||
struct stat64 st;
|
||||
FILE *fp;
|
||||
@@ -104,6 +102,7 @@ getextmntent(const char *path, struct extmnttab *entry, struct stat64 *statbuf)
|
||||
boolean_t have_mnt_id = B_FALSE;
|
||||
uint64_t target_mnt_id = 0;
|
||||
uint64_t entry_mnt_id;
|
||||
dev_t dev;
|
||||
#ifdef HAVE_STATX_MNT_ID
|
||||
struct statx stx;
|
||||
#endif
|
||||
@@ -143,12 +142,11 @@ getextmntent(const char *path, struct extmnttab *entry, struct stat64 *statbuf)
|
||||
*/
|
||||
|
||||
match = 0;
|
||||
while (getextmntent_impl(fp, entry, &entry_mnt_id) == 0) {
|
||||
while (getextmntent_impl(fp, entry, &entry_mnt_id, &dev) == 0) {
|
||||
if (have_mnt_id) {
|
||||
match = (entry_mnt_id == target_mnt_id);
|
||||
} else {
|
||||
match = makedev(entry->mnt_major, entry->mnt_minor) ==
|
||||
statbuf->st_dev;
|
||||
match = (dev == statbuf->st_dev);
|
||||
}
|
||||
if (match)
|
||||
break;
|
||||
@@ -161,11 +159,8 @@ getextmntent(const char *path, struct extmnttab *entry, struct stat64 *statbuf)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (stat64(entry->mnt_mountp, &st) != 0) {
|
||||
entry->mnt_major = 0;
|
||||
entry->mnt_minor = 0;
|
||||
if (stat64(entry->mnt_mountp, &st) != 0)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user