Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeBSD cleanup #14136

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 8 additions & 18 deletions lib/libzfs/os/freebsd/libzfs_zmount.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,33 +73,30 @@ build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val,
*iovlen = ++i;
}

static int
do_mount_(const char *spec, const char *dir, int mflag,
char *dataptr, int datalen, const char *optptr, int optlen)
int
do_mount(zfs_handle_t *zhp, const char *mntpt, const char *opts, int flags)
{
struct iovec *iov;
char *optstr, *p, *tofree;
int iovlen, rv;
const char *spec = zfs_get_name(zhp);

assert(spec != NULL);
assert(dir != NULL);
assert(dataptr == NULL), (void) dataptr;
assert(datalen == 0), (void) datalen;
assert(optptr != NULL);
assert(optlen > 0), (void) optlen;
assert(mntpt != NULL);
assert(opts != NULL);

tofree = optstr = strdup(optptr);
tofree = optstr = strdup(opts);
assert(optstr != NULL);

iov = NULL;
iovlen = 0;
if (strstr(optstr, MNTOPT_REMOUNT) != NULL)
build_iovec(&iov, &iovlen, "update", NULL, 0);
if (mflag & MS_RDONLY)
if (flags & MS_RDONLY)
build_iovec(&iov, &iovlen, "ro", NULL, 0);
build_iovec(&iov, &iovlen, "fstype", __DECONST(char *, MNTTYPE_ZFS),
(size_t)-1);
build_iovec(&iov, &iovlen, "fspath", __DECONST(char *, dir),
build_iovec(&iov, &iovlen, "fspath", __DECONST(char *, mntpt),
(size_t)-1);
build_iovec(&iov, &iovlen, "from", __DECONST(char *, spec), (size_t)-1);
while ((p = strsep(&optstr, ",/")) != NULL)
Expand All @@ -109,14 +106,7 @@ do_mount_(const char *spec, const char *dir, int mflag,
if (rv < 0)
return (errno);
return (rv);
}

int
do_mount(zfs_handle_t *zhp, const char *mntpt, const char *opts, int flags)
{

return (do_mount_(zfs_get_name(zhp), mntpt, flags, NULL, 0,
opts, sizeof (mntpt)));
}

int
Expand Down
2 changes: 1 addition & 1 deletion lib/libzfs_core/os/freebsd/libzfs_core_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ get_zfs_ioctl_version(void)
int ver = ZFS_IOCVER_NONE;

ver_size = sizeof (ver);
sysctlbyname("vfs.zfs.version.ioctl", &ver, &ver_size, NULL, 0);
(void) sysctlbyname("vfs.zfs.version.ioctl", &ver, &ver_size, NULL, 0);

return (ver);
}
Expand Down