diff options
author | Ryan Moeller <freqlabs@FreeBSD.org> | 2020-05-21 01:55:35 +0000 |
---|---|---|
committer | Ryan Moeller <freqlabs@FreeBSD.org> | 2020-05-21 01:55:35 +0000 |
commit | 245bfd34da590e12884bd1a5677f3227a36d4bcf (patch) | |
tree | bd3f30b09ed71ce881641d920535207ad89d75dc /sbin | |
parent | 49caa483b3fafffd9cf5197eb30e8bb235aa7410 (diff) | |
download | src-245bfd34da590e12884bd1a5677f3227a36d4bcf.tar.gz src-245bfd34da590e12884bd1a5677f3227a36d4bcf.zip |
Deduplicate fsid comparisons
Comparing fsid_t objects requires internal knowledge of the fsid structure
and yet this is duplicated across a number of places in the code.
Simplify by creating a fsidcmp function (macro).
Reviewed by: mjg, rmacklem
Approved by: mav (mentor)
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D24749
Notes
Notes:
svn path=/head/; revision=361313
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/mksnap_ffs/mksnap_ffs.c | 3 | ||||
-rw-r--r-- | sbin/umount/umount.c | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/sbin/mksnap_ffs/mksnap_ffs.c b/sbin/mksnap_ffs/mksnap_ffs.c index 374617bf50fd..5d230701de85 100644 --- a/sbin/mksnap_ffs/mksnap_ffs.c +++ b/sbin/mksnap_ffs/mksnap_ffs.c @@ -81,8 +81,7 @@ issamefs(const char *path, struct statfs *stfsp) return (-1); if (statfs(path, &stfsbuf) < 0) return (-1); - if ((stfsbuf.f_fsid.val[0] != stfsp->f_fsid.val[0]) || - (stfsbuf.f_fsid.val[1] != stfsp->f_fsid.val[1])) + if (fsidcmp(&stfsbuf.f_fsid, &stfsp->f_fsid) != 0) return (0); return (1); } diff --git a/sbin/umount/umount.c b/sbin/umount/umount.c index b936c9dc174a..6a58fdb5524e 100644 --- a/sbin/umount/umount.c +++ b/sbin/umount/umount.c @@ -505,8 +505,7 @@ getmntentry(const char *fromname, const char *onname, fsid_t *fsid, dowhat what) continue; if (onname != NULL && strcmp(sfs->f_mntonname, onname) != 0) continue; - if (fsid != NULL && bcmp(&sfs->f_fsid, fsid, - sizeof(*fsid)) != 0) + if (fsid != NULL && fsidcmp(&sfs->f_fsid, fsid) != 0) continue; switch (what) { |