From 63f98fcc6a46518f1e430026c32dd9c31dff0a84 Mon Sep 17 00:00:00 2001 From: jamie Date: Mon, 2 Mar 2009 23:26:30 +0000 Subject: Extend the "vfsopt" mount options for more general use. Make struct vfsopt and the vfs_buildopts function public, and add some new fields to struct vfsopt (pos and seen), and new functions vfs_getopt_pos and vfs_opterror. Further extend the interface to allow reading options from the kernel in addition to sending them to the kernel, with vfs_setopt and related functions. While this allows the "name=value" option interface to be used for more than just FS mounts (planned use is for jails), it retains the current "vfsopt" name and requirement. Approved by: bz (mentor) --- sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c | 25 +++------------------- 1 file changed, 3 insertions(+), 22 deletions(-) (limited to 'sys/cddl/compat') diff --git a/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c b/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c index f1bb4e2..045b8aa 100644 --- a/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c +++ b/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c @@ -39,14 +39,6 @@ __FBSDID("$FreeBSD$"); MALLOC_DECLARE(M_MOUNT); -TAILQ_HEAD(vfsoptlist, vfsopt); -struct vfsopt { - TAILQ_ENTRY(vfsopt) link; - char *name; - void *value; - int len; -}; - void vfs_setmntopt(vfs_t *vfsp, const char *name, const char *arg, int flags __unused) @@ -64,6 +56,8 @@ vfs_setmntopt(vfs_t *vfsp, const char *name, const char *arg, namesize = strlen(name) + 1; opt->name = malloc(namesize, M_MOUNT, M_WAITOK); strlcpy(opt->name, name, namesize); + opt->pos = -1; + opt->seen = 1; if (arg == NULL) { opt->value = NULL; @@ -80,22 +74,9 @@ vfs_setmntopt(vfs_t *vfsp, const char *name, const char *arg, void vfs_clearmntopt(vfs_t *vfsp, const char *name) { - struct vfsopt *opt; - if (vfsp->mnt_opt == NULL) - return; /* TODO: Locking. */ - TAILQ_FOREACH(opt, vfsp->mnt_opt, link) { - if (strcmp(opt->name, name) == 0) - break; - } - if (opt != NULL) { - TAILQ_REMOVE(vfsp->mnt_opt, opt, link); - free(opt->name, M_MOUNT); - if (opt->value != NULL) - free(opt->value, M_MOUNT); - free(opt, M_MOUNT); - } + vfs_deleteopt(vfsp->mnt_opt, name); } int -- cgit v1.1