From 055e2abe682260c3bd89cb00f5394de7b740ef8f Mon Sep 17 00:00:00 2001 From: rodrigc Date: Fri, 26 May 2006 00:32:21 +0000 Subject: Remove calls to vfs_export() for exporting a filesystem for NFS mounting from individual filesystems. Call it instead in vfs_mount.c, after we call VFS_MOUNT() for a specific filesystem. --- sys/fs/cd9660/cd9660_vfsops.c | 14 ++++---------- sys/fs/msdosfs/msdosfs_vfsops.c | 15 +++++---------- sys/fs/ntfs/ntfs_vfsops.c | 19 ++++++------------- sys/gnu/fs/ext2fs/ext2_vfsops.c | 11 +++-------- sys/isofs/cd9660/cd9660_vfsops.c | 14 ++++---------- sys/kern/vfs_mount.c | 12 ++++++++++++ sys/ufs/ffs/ffs_vfsops.c | 18 ------------------ 7 files changed, 34 insertions(+), 69 deletions(-) (limited to 'sys') diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index b68e59e..30aba51 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/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; @@ -145,15 +144,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/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index 93a58fc..a07b567 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -243,7 +243,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; @@ -261,16 +260,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 b670318..31f1a0b 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/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c index 1bccb61..38f9e25 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/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c index b68e59e..30aba51 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; @@ -145,15 +144,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 2f60942..23becc3 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -777,6 +777,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; @@ -933,6 +934,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 7c021e7..a42a217 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)) @@ -181,13 +180,6 @@ ffs_mount(struct mount *mp, struct thread *td) if (vfs_getopt(mp->mnt_optnew, "update", NULL, NULL) == 0) mp->mnt_flag |= MNT_UPDATE; - export.ex_root = -2; /* DEFAULT_ROOTID */ - - if (mp->mnt_flag & MNT_RDONLY) - export.ex_flags = MNT_EXRDONLY; - else - export.ex_flags = 0; - /* * If updating, check whether changing from read-only to * read/write; if there is no device name, that's all we do. @@ -329,17 +321,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 = 0; - if (vfs_getopt(mp->mnt_optnew, "export", NULL, NULL) == 0) { - 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. */ -- cgit v1.1