summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/fs/msdosfs/msdosfs_vfsops.c15
-rw-r--r--sys/fs/ntfs/ntfs_vfsops.c19
-rw-r--r--sys/fs/udf/udf_vfsops.c10
-rw-r--r--sys/gnu/fs/ext2fs/ext2_vfsops.c11
-rw-r--r--sys/gnu/fs/reiserfs/reiserfs_vfsops.c6
-rw-r--r--sys/isofs/cd9660/cd9660_vfsops.c14
-rw-r--r--sys/kern/vfs_mount.c12
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c8
8 files changed, 34 insertions, 61 deletions
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
index 1ed074f41ddb..a29c2de402d9 100644
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -240,7 +240,6 @@ static int
msdosfs_mount(struct mount *mp, struct thread *td)
{
struct vnode *devvp; /* vnode for blk device to mount */
- struct export_args export;
/* msdosfs specific mount control block */
struct msdosfsmount *pmp = NULL;
struct nameidata ndp;
@@ -258,16 +257,12 @@ msdosfs_mount(struct mount *mp, struct thread *td)
if (mp->mnt_flag & MNT_UPDATE) {
pmp = VFSTOMSDOSFS(mp);
- error = vfs_copyopt(mp->mnt_optnew, "export",
- &export, sizeof export);
- if (error == 0 && export.ex_flags != 0) {
- /*
- * Process export requests.
- */
- if ((export.ex_flags & MNT_EXPORTED) != 0 &&
- (pmp->pm_flags & MSDOSFS_LARGEFS) != 0)
+ if (vfs_flagopt(mp->mnt_optnew, "export", NULL, 0)) {
+ /* Process export requests. */
+ if ((pmp->pm_flags & MSDOSFS_LARGEFS) != 0)
return (EOPNOTSUPP);
- return (vfs_export(mp, &export));
+ else
+ return (0);
}
if (!(pmp->pm_flags & MSDOSFSMNT_RONLY) &&
vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0)) {
diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c
index 5200440ed5f0..3309850d19c4 100644
--- a/sys/fs/ntfs/ntfs_vfsops.c
+++ b/sys/fs/ntfs/ntfs_vfsops.c
@@ -157,7 +157,6 @@ ntfs_mount (
struct vnode *devvp;
struct nameidata ndp;
char *from;
- struct export_args export;
if (vfs_filteropt(mp->mnt_optnew, ntfs_opts))
return (EINVAL);
@@ -171,20 +170,14 @@ ntfs_mount (
* read/write.
*/
if (mp->mnt_flag & MNT_UPDATE) {
- error = vfs_copyopt(mp->mnt_optnew, "export",
- &export, sizeof export);
- if ((error == 0) && export.ex_flags != 0) {
- /*
- * Process export requests. Jumping to "success"
- * will return the vfs_export() error code.
- */
- err = vfs_export(mp, &export);
+ if (vfs_flagopt(mp->mnt_optnew, "export", NULL, 0)) {
+ /* Process export requests in vfs_mount.c */
goto success;
+ } else {
+ printf("ntfs_mount(): MNT_UPDATE not supported\n");
+ err = EINVAL;
+ goto error_1;
}
-
- printf("ntfs_mount(): MNT_UPDATE not supported\n");
- err = EINVAL;
- goto error_1;
}
/*
diff --git a/sys/fs/udf/udf_vfsops.c b/sys/fs/udf/udf_vfsops.c
index df2f41cb0f06..8b90d951e62b 100644
--- a/sys/fs/udf/udf_vfsops.c
+++ b/sys/fs/udf/udf_vfsops.c
@@ -191,7 +191,6 @@ udf_mount(struct mount *mp, struct thread *td)
{
struct vnode *devvp; /* vnode of the mount device */
struct udf_mnt *imp = 0;
- struct export_args *export;
struct vfsoptlist *opts;
char *fspec, *cs_disk, *cs_local;
int error, len, *udf_flags;
@@ -215,14 +214,7 @@ udf_mount(struct mount *mp, struct thread *td)
return (EINVAL);
if (mp->mnt_flag & MNT_UPDATE) {
- imp = VFSTOUDFFS(mp);
- if (fspec == NULL) {
- error = vfs_getopt(opts, "export", (void **)&export,
- &len);
- if (error || len != sizeof(struct export_args))
- return (EINVAL);
- return (vfs_export(mp, export));
- }
+ return (0);
}
/* Check that the mount device exists */
diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c
index 0a288cd8679b..6b6e672e084d 100644
--- a/sys/gnu/fs/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c
@@ -129,7 +129,6 @@ ext2_mount(mp, td)
struct mount *mp;
struct thread *td;
{
- struct export_args *export;
struct vfsoptlist *opts;
struct vnode *devvp;
struct ext2mount *ump = 0;
@@ -233,13 +232,9 @@ ext2_mount(mp, td)
fs->s_rd_only = 0;
mp->mnt_flag &= ~MNT_RDONLY;
}
- if (fspec == NULL) {
- error = vfs_getopt(opts, "export", (void **)&export,
- &len);
- if (error || len != sizeof(struct export_args))
- return (EINVAL);
- /* Process export requests. */
- return (vfs_export(mp, export));
+ if (vfs_flagopt(opts, "export", NULL, 0)) {
+ /* Process export requests in vfs_mount.c. */
+ return (error);
}
}
/*
diff --git a/sys/gnu/fs/reiserfs/reiserfs_vfsops.c b/sys/gnu/fs/reiserfs/reiserfs_vfsops.c
index db9511260ee0..bbc669567206 100644
--- a/sys/gnu/fs/reiserfs/reiserfs_vfsops.c
+++ b/sys/gnu/fs/reiserfs/reiserfs_vfsops.c
@@ -79,7 +79,6 @@ reiserfs_mount(struct mount *mp, struct thread *td)
char *path, *fspec;
struct vnode *devvp;
struct vfsoptlist *opts;
- struct export_args *export;
struct reiserfs_mount *rmp;
struct reiserfs_sb_info *sbi;
struct nameidata nd, *ndp = &nd;
@@ -104,9 +103,8 @@ reiserfs_mount(struct mount *mp, struct thread *td)
/* Handle MNT_UPDATE (mp->mnt_flag) */
if (mp->mnt_flag & MNT_UPDATE) {
/* For now, only NFS export is supported. */
- error = vfs_getopt(opts, "export", (void **)&export, &len);
- if (error == 0 && len == sizeof(*export) && export->ex_flags)
- return (vfs_export(mp, export));
+ if (vfs_flagopt(opts, "export", NULL, 0))
+ return (0);
}
/* Not an update, or updating the name: look up the name
diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c
index 6b022aa09f9e..877dad0e8441 100644
--- a/sys/isofs/cd9660/cd9660_vfsops.c
+++ b/sys/isofs/cd9660/cd9660_vfsops.c
@@ -128,9 +128,8 @@ static int
cd9660_mount(struct mount *mp, struct thread *td)
{
struct vnode *devvp;
- struct export_args *export;
char *fspec;
- int error, len;
+ int error;
mode_t accessmode;
struct nameidata ndp;
struct iso_mnt *imp = 0;
@@ -143,15 +142,10 @@ cd9660_mount(struct mount *mp, struct thread *td)
return (error);
imp = VFSTOISOFS(mp);
- /*
- * If updating, check whether changing from read-only to
- * read/write; if there is no device name, that's all we do.
- */
+
if (mp->mnt_flag & MNT_UPDATE) {
- error = vfs_getopt(mp->mnt_optnew,
- "export", (void **)&export, &len);
- if (error == 0 && len == sizeof *export && export->ex_flags)
- return (vfs_export(mp, export));
+ if (vfs_flagopt(mp->mnt_optnew, "export", NULL, 0))
+ return (0);
}
/*
* Not an update, or updating the name: look up the name
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 607bdbee661a..c21bc529e86b 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -722,6 +722,7 @@ vfs_domount(
struct vnode *vp;
struct mount *mp;
struct vfsconf *vfsp;
+ struct export_args export;
int error, flag = 0, kern_flag = 0;
struct vattr va;
struct nameidata nd;
@@ -882,6 +883,17 @@ vfs_domount(
* get. No freeing of cn_pnbuf.
*/
error = VFS_MOUNT(mp, td);
+
+ /*
+ * Process the export option only if we are
+ * updating mount options.
+ */
+ if (!error && (fsflags & MNT_UPDATE)) {
+ if (vfs_copyopt(mp->mnt_optnew, "export", &export,
+ sizeof(export)) == 0)
+ error = vfs_export(mp, &export);
+ }
+
if (!error) {
if (mp->mnt_opt != NULL)
vfs_freeopts(mp->mnt_opt);
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 90cdeba208db..0def697f8546 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -130,7 +130,6 @@ ffs_mount(struct mount *mp, struct thread *td)
int error, flags;
mode_t accessmode;
struct nameidata ndp;
- struct export_args export;
char *fspec;
if (vfs_filteropt(mp->mnt_optnew, ffs_opts))
@@ -292,12 +291,7 @@ ffs_mount(struct mount *mp, struct thread *td)
*/
if ((fs->fs_flags & FS_ACLS) != 0)
mp->mnt_flag |= MNT_ACLS;
- /*
- * If not updating name, process export requests.
- */
- error = vfs_copyopt(mp->mnt_optnew, "export", &export, sizeof export);
- if (error == 0 && export.ex_flags != 0)
- return (vfs_export(mp, &export));
+
/*
* If this is a snapshot request, take the snapshot.
*/