aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/mountd/mountd.c
diff options
context:
space:
mode:
authorRyan Moeller <freqlabs@FreeBSD.org>2020-05-21 01:55:35 +0000
committerRyan Moeller <freqlabs@FreeBSD.org>2020-05-21 01:55:35 +0000
commit245bfd34da590e12884bd1a5677f3227a36d4bcf (patch)
treebd3f30b09ed71ce881641d920535207ad89d75dc /usr.sbin/mountd/mountd.c
parent49caa483b3fafffd9cf5197eb30e8bb235aa7410 (diff)
downloadsrc-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 'usr.sbin/mountd/mountd.c')
-rw-r--r--usr.sbin/mountd/mountd.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c
index 79d6ac7f5693..36b3659ea487 100644
--- a/usr.sbin/mountd/mountd.c
+++ b/usr.sbin/mountd/mountd.c
@@ -1568,10 +1568,8 @@ get_exportlist_one(int passno)
ep = get_exp();
} else {
if (ep) {
- if (ep->ex_fs.val[0] !=
- fsb.f_fsid.val[0] ||
- ep->ex_fs.val[1] !=
- fsb.f_fsid.val[1]) {
+ if (fsidcmp(&ep->ex_fs, &fsb.f_fsid)
+ != 0) {
getexp_err(ep, tgrp,
"fsid mismatch");
goto nextline;
@@ -2088,8 +2086,7 @@ compare_nmount_exportlist(struct iovec *iov, int iovlen, char *errmsg)
if ((oep->ex_flag & EX_DONE) == 0) {
LOGDEBUG("not done delete=%s", oep->ex_fsdir);
if (statfs(oep->ex_fsdir, &ofs) >= 0 &&
- oep->ex_fs.val[0] == ofs.f_fsid.val[0] &&
- oep->ex_fs.val[1] == ofs.f_fsid.val[1]) {
+ fsidcmp(&oep->ex_fs, &ofs.f_fsid) == 0) {
LOGDEBUG("do delete");
/*
* Clear has_publicfh if if was set
@@ -2353,8 +2350,7 @@ ex_search(fsid_t *fsid, struct exportlisthead *exhp)
i = EXPHASH(fsid);
SLIST_FOREACH(ep, &exhp[i], entries) {
- if (ep->ex_fs.val[0] == fsid->val[0] &&
- ep->ex_fs.val[1] == fsid->val[1])
+ if (fsidcmp(&ep->ex_fs, fsid) == 0)
return (ep);
}
@@ -3122,8 +3118,7 @@ do_mount(struct exportlist *ep, struct grouplist *grp, int exflags,
* filesystem.
*/
if (statfs(dirp, &fsb1) != 0 ||
- bcmp(&fsb1.f_fsid, &fsb->f_fsid,
- sizeof (fsb1.f_fsid)) != 0) {
+ fsidcmp(&fsb1.f_fsid, &fsb->f_fsid) != 0) {
*cp = savedc;
syslog(LOG_ERR,
"can't export %s %s", dirp,