diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index 9390bc6a70a3..aff280ad0b7d 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -2485,9 +2485,17 @@ freebsd32_nmount(struct thread *td, } */ *uap) { struct uio *auio; + uint64_t flags; int error; - AUDIT_ARG_FFLAGS(uap->flags); + /* + * Mount flags are now 64-bits. On 32-bit archtectures only + * 32-bits are passed in, but from here on everything handles + * 64-bit flags correctly. + */ + flags = uap->flags; + + AUDIT_ARG_FFLAGS(flags); /* * Filter out MNT_ROOTFS. We do not want clients of nmount() in @@ -2496,7 +2504,7 @@ freebsd32_nmount(struct thread *td, * MNT_ROOTFS should only be set by the kernel when mounting its * root file system. */ - uap->flags &= ~MNT_ROOTFS; + flags &= ~MNT_ROOTFS; /* * check that we have an even number of iovec's @@ -2508,7 +2516,7 @@ freebsd32_nmount(struct thread *td, error = freebsd32_copyinuio(uap->iovp, uap->iovcnt, &auio); if (error) return (error); - error = vfs_donmount(td, uap->flags, auio); + error = vfs_donmount(td, flags, auio); free(auio, M_IOV); return error; diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index 0ad57ecb785f..d3e360d2ae94 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -95,7 +95,7 @@ static int iso_mountfs(struct vnode *devvp, struct mount *mp); */ static int -cd9660_cmount(struct mntarg *ma, void *data, int flags) +cd9660_cmount(struct mntarg *ma, void *data, uint64_t flags) { struct iso_args args; struct export_args exp; diff --git a/sys/fs/fdescfs/fdesc_vfsops.c b/sys/fs/fdescfs/fdesc_vfsops.c index ade38fe2869a..2f29f686d448 100644 --- a/sys/fs/fdescfs/fdesc_vfsops.c +++ b/sys/fs/fdescfs/fdesc_vfsops.c @@ -65,7 +65,7 @@ static vfs_root_t fdesc_root; * Compatibility shim for old mount(2) system call. */ int -fdesc_cmount(struct mntarg *ma, void *data, int flags) +fdesc_cmount(struct mntarg *ma, void *data, uint64_t flags) { return kernel_mount(ma, flags); } diff --git a/sys/fs/hpfs/hpfs_vfsops.c b/sys/fs/hpfs/hpfs_vfsops.c index 866004eeb549..c0564adf6d2c 100644 --- a/sys/fs/hpfs/hpfs_vfsops.c +++ b/sys/fs/hpfs/hpfs_vfsops.c @@ -73,7 +73,7 @@ static int hpfs_cmount ( struct mntarg *ma, void *data, - int flags) + uint64_t flags) { struct hpfs_args args; struct export_args exp; diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index 5e93c2927b5b..5bd97d930aca 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -197,7 +197,7 @@ update_mp(struct mount *mp, struct thread *td) } static int -msdosfs_cmount(struct mntarg *ma, void *data, int flags) +msdosfs_cmount(struct mntarg *ma, void *data, uint64_t flags) { struct msdosfs_args args; struct export_args exp; diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c index 461980ed845d..ccb35f178bec 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -1131,7 +1131,7 @@ nfs_mount(struct mount *mp) */ /* ARGSUSED */ static int -nfs_cmount(struct mntarg *ma, void *data, int flags) +nfs_cmount(struct mntarg *ma, void *data, uint64_t flags) { int error; struct nfs_args args; diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c index d3468af2f022..8ec5fe6d158e 100644 --- a/sys/fs/ntfs/ntfs_vfsops.c +++ b/sys/fs/ntfs/ntfs_vfsops.c @@ -117,7 +117,7 @@ static int ntfs_cmount ( struct mntarg *ma, void *data, - int flags) + uint64_t flags) { struct ntfs_args args; struct export_args exp; diff --git a/sys/fs/nwfs/nwfs_vfsops.c b/sys/fs/nwfs/nwfs_vfsops.c index 697f9d1221b5..f319fb501e62 100644 --- a/sys/fs/nwfs/nwfs_vfsops.c +++ b/sys/fs/nwfs/nwfs_vfsops.c @@ -123,7 +123,7 @@ nwfs_initnls(struct nwmount *nmp) { return 0; } -static int nwfs_cmount(struct mntarg *ma, void *data, int flags) +static int nwfs_cmount(struct mntarg *ma, void *data, uint64_t flags) { struct nwfs_args args; /* will hold data from mount request */ int error; diff --git a/sys/fs/portalfs/portal_vfsops.c b/sys/fs/portalfs/portal_vfsops.c index 04e7a3d22500..65420907e9c3 100644 --- a/sys/fs/portalfs/portal_vfsops.c +++ b/sys/fs/portalfs/portal_vfsops.c @@ -69,7 +69,7 @@ static const char *portal_opts[] = { }; static int -portal_cmount(struct mntarg *ma, void *data, int flags) +portal_cmount(struct mntarg *ma, void *data, uint64_t flags) { struct portal_args args; int error; diff --git a/sys/fs/pseudofs/pseudofs.c b/sys/fs/pseudofs/pseudofs.c index 2d147d4a2c81..145aaeff5e74 100644 --- a/sys/fs/pseudofs/pseudofs.c +++ b/sys/fs/pseudofs/pseudofs.c @@ -330,7 +330,7 @@ pfs_mount(struct pfs_info *pi, struct mount *mp) * Compatibility shim for old mount(2) system call */ int -pfs_cmount(struct mntarg *ma, void *data, int flags) +pfs_cmount(struct mntarg *ma, void *data, uint64_t flags) { int error; diff --git a/sys/fs/pseudofs/pseudofs.h b/sys/fs/pseudofs/pseudofs.h index 1755da3b6b40..f2c29d4a0ba2 100644 --- a/sys/fs/pseudofs/pseudofs.h +++ b/sys/fs/pseudofs/pseudofs.h @@ -242,7 +242,7 @@ struct pfs_node { * VFS interface */ int pfs_mount (struct pfs_info *pi, struct mount *mp); -int pfs_cmount (struct mntarg *ma, void *data, int flags); +int pfs_cmount (struct mntarg *ma, void *data, uint64_t flags); int pfs_unmount (struct mount *mp, int mntflags); int pfs_root (struct mount *mp, int flags, struct vnode **vpp); diff --git a/sys/fs/smbfs/smbfs_vfsops.c b/sys/fs/smbfs/smbfs_vfsops.c index eb2e7f92418f..f5460b5596b0 100644 --- a/sys/fs/smbfs/smbfs_vfsops.c +++ b/sys/fs/smbfs/smbfs_vfsops.c @@ -98,7 +98,7 @@ MODULE_DEPEND(smbfs, libmchain, 1, 1, 1); int smbfs_pbuf_freecnt = -1; /* start out unlimited */ static int -smbfs_cmount(struct mntarg *ma, void * data, int flags) +smbfs_cmount(struct mntarg *ma, void * data, uint64_t flags) { struct smbfs_args args; int error; diff --git a/sys/gnu/fs/reiserfs/reiserfs_vfsops.c b/sys/gnu/fs/reiserfs/reiserfs_vfsops.c index 15483f546559..ecec3ada2da3 100644 --- a/sys/gnu/fs/reiserfs/reiserfs_vfsops.c +++ b/sys/gnu/fs/reiserfs/reiserfs_vfsops.c @@ -49,7 +49,7 @@ MALLOC_DEFINE(M_REISERFSNODE, "reiserfs_node", "ReiserFS vnode private part"); * -------------------------------------------------------------------*/ static int -reiserfs_cmount(struct mntarg *ma, void *data, int flags) +reiserfs_cmount(struct mntarg *ma, void *data, uint64_t flags) { struct reiserfs_args args; struct export_args exp; diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 9100a9cff392..5fa086cf944b 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -72,8 +72,8 @@ __FBSDID("$FreeBSD$"); #define VFS_MOUNTARG_SIZE_MAX (1024 * 64) -static int vfs_domount(struct thread *td, const char *fstype, - char *fspath, int fsflags, struct vfsoptlist **optlist); +static int vfs_domount(struct thread *td, const char *fstype, char *fspath, + uint64_t fsflags, struct vfsoptlist **optlist); static void free_mntarg(struct mntarg *ma); static int usermount = 0; @@ -378,10 +378,18 @@ sys_nmount(td, uap) struct uio *auio; int error; u_int iovcnt; + uint64_t flags; - AUDIT_ARG_FFLAGS(uap->flags); + /* + * Mount flags are now 64-bits. On 32-bit archtectures only + * 32-bits are passed in, but from here on everything handles + * 64-bit flags correctly. + */ + flags = uap->flags; + + AUDIT_ARG_FFLAGS(flags); CTR4(KTR_VFS, "%s: iovp %p with iovcnt %d and flags %d", __func__, - uap->iovp, uap->iovcnt, uap->flags); + uap->iovp, uap->iovcnt, flags); /* * Filter out MNT_ROOTFS. We do not want clients of nmount() in @@ -390,7 +398,7 @@ sys_nmount(td, uap) * MNT_ROOTFS should only be set by the kernel when mounting its * root file system. */ - uap->flags &= ~MNT_ROOTFS; + flags &= ~MNT_ROOTFS; iovcnt = uap->iovcnt; /* @@ -409,7 +417,7 @@ sys_nmount(td, uap) __func__, error); return (error); } - error = vfs_donmount(td, uap->flags, auio); + error = vfs_donmount(td, flags, auio); free(auio, M_IOV); return (error); @@ -520,7 +528,7 @@ vfs_mount_destroy(struct mount *mp) } int -vfs_donmount(struct thread *td, int fsflags, struct uio *fsoptions) +vfs_donmount(struct thread *td, uint64_t fsflags, struct uio *fsoptions) { struct vfsoptlist *optlist; struct vfsopt *opt, *tmp_opt; @@ -696,9 +704,17 @@ sys_mount(td, uap) char *fstype; struct vfsconf *vfsp = NULL; struct mntarg *ma = NULL; + uint64_t flags; int error; - AUDIT_ARG_FFLAGS(uap->flags); + /* + * Mount flags are now 64-bits. On 32-bit archtectures only + * 32-bits are passed in, but from here on everything handles + * 64-bit flags correctly. + */ + flags = uap->flags; + + AUDIT_ARG_FFLAGS(flags); /* * Filter out MNT_ROOTFS. We do not want clients of mount() in @@ -707,7 +723,7 @@ sys_mount(td, uap) * MNT_ROOTFS should only be set by the kernel when mounting its * root file system. */ - uap->flags &= ~MNT_ROOTFS; + flags &= ~MNT_ROOTFS; fstype = malloc(MFSNAMELEN, M_TEMP, M_WAITOK); error = copyinstr(uap->type, fstype, MFSNAMELEN, NULL); @@ -731,11 +747,11 @@ sys_mount(td, uap) ma = mount_argsu(ma, "fstype", uap->type, MNAMELEN); ma = mount_argsu(ma, "fspath", uap->path, MNAMELEN); - ma = mount_argb(ma, uap->flags & MNT_RDONLY, "noro"); - ma = mount_argb(ma, !(uap->flags & MNT_NOSUID), "nosuid"); - ma = mount_argb(ma, !(uap->flags & MNT_NOEXEC), "noexec"); + ma = mount_argb(ma, flags & MNT_RDONLY, "noro"); + ma = mount_argb(ma, !(flags & MNT_NOSUID), "nosuid"); + ma = mount_argb(ma, !(flags & MNT_NOEXEC), "noexec"); - error = vfsp->vfc_vfsops->vfs_cmount(ma, uap->data, uap->flags); + error = vfsp->vfc_vfsops->vfs_cmount(ma, uap->data, flags); mtx_unlock(&Giant); return (error); } @@ -749,7 +765,7 @@ vfs_domount_first( struct vfsconf *vfsp, /* File system type. */ char *fspath, /* Mount path. */ struct vnode *vp, /* Vnode to be covered. */ - int fsflags, /* Flags common to all filesystems. */ + uint64_t fsflags, /* Flags common to all filesystems. */ struct vfsoptlist **optlist /* Options local to the filesystem. */ ) { @@ -871,14 +887,15 @@ static int vfs_domount_update( struct thread *td, /* Calling thread. */ struct vnode *vp, /* Mount point vnode. */ - int fsflags, /* Flags common to all filesystems. */ + uint64_t fsflags, /* Flags common to all filesystems. */ struct vfsoptlist **optlist /* Options local to the filesystem. */ ) { struct oexport_args oexport; struct export_args export; struct mount *mp; - int error, export_error, flag; + int error, export_error; + uint64_t flag; mtx_assert(&Giant, MA_OWNED); ASSERT_VOP_ELOCKED(vp, __func__); @@ -1015,7 +1032,7 @@ vfs_domount( struct thread *td, /* Calling thread. */ const char *fstype, /* Filesystem type. */ char *fspath, /* Mount path. */ - int fsflags, /* Flags common to all filesystems. */ + uint64_t fsflags, /* Flags common to all filesystems. */ struct vfsoptlist **optlist /* Options local to the filesystem. */ ) { @@ -1216,7 +1233,7 @@ dounmount(mp, flags, td) { struct vnode *coveredvp, *fsrootvp; int error; - int async_flag; + uint64_t async_flag; int mnt_gen_r; mtx_assert(&Giant, MA_OWNED); @@ -1925,7 +1942,7 @@ free_mntarg(struct mntarg *ma) * Mount a filesystem */ int -kernel_mount(struct mntarg *ma, int flags) +kernel_mount(struct mntarg *ma, uint64_t flags) { struct uio auio; int error; diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 307aec3f2567..ee383ee4107e 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -2836,6 +2836,7 @@ DB_SHOW_COMMAND(mount, db_show_mount) struct statfs *sp; struct vnode *vp; char buf[512]; + uint64_t mflags; u_int flags; if (!have_addr) { @@ -2857,13 +2858,13 @@ DB_SHOW_COMMAND(mount, db_show_mount) mp->mnt_stat.f_mntonname, mp->mnt_stat.f_fstypename); buf[0] = '\0'; - flags = mp->mnt_flag; + mflags = mp->mnt_flag; #define MNT_FLAG(flag) do { \ - if (flags & (flag)) { \ + if (mflags & (flag)) { \ if (buf[0] != '\0') \ strlcat(buf, ", ", sizeof(buf)); \ strlcat(buf, (#flag) + 4, sizeof(buf)); \ - flags &= ~(flag); \ + mflags &= ~(flag); \ } \ } while (0) MNT_FLAG(MNT_RDONLY); @@ -2901,11 +2902,11 @@ DB_SHOW_COMMAND(mount, db_show_mount) MNT_FLAG(MNT_SNAPSHOT); MNT_FLAG(MNT_BYFSID); #undef MNT_FLAG - if (flags != 0) { + if (mflags != 0) { if (buf[0] != '\0') strlcat(buf, ", ", sizeof(buf)); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), - "0x%08x", flags); + "0x%016jx", mflags); } db_printf(" mnt_flag = %s\n", buf); diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c index 42895d037c2a..fafc2537ba6f 100644 --- a/sys/nfsclient/nfs_vfsops.c +++ b/sys/nfsclient/nfs_vfsops.c @@ -1187,7 +1187,7 @@ nfs_mount(struct mount *mp) */ /* ARGSUSED */ static int -nfs_cmount(struct mntarg *ma, void *data, int flags) +nfs_cmount(struct mntarg *ma, void *data, uint64_t flags) { int error; struct nfs_args args; diff --git a/sys/sys/mount.h b/sys/sys/mount.h index ecaf7b888b07..f68a046ba8a2 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -557,7 +557,7 @@ struct nameidata; struct sysctl_req; struct mntarg; -typedef int vfs_cmount_t(struct mntarg *ma, void *data, int flags); +typedef int vfs_cmount_t(struct mntarg *ma, void *data, uint64_t flags); typedef int vfs_unmount_t(struct mount *mp, int mntflags); typedef int vfs_root_t(struct mount *mp, int flags, struct vnode **vpp); typedef int vfs_quotactl_t(struct mount *mp, int cmds, uid_t uid, void *arg); @@ -700,7 +700,7 @@ extern char *mountrootfsname; int dounmount(struct mount *, int, struct thread *); -int kernel_mount(struct mntarg *ma, int flags); +int kernel_mount(struct mntarg *ma, uint64_t flags); int kernel_vmount(int flags, ...); struct mntarg *mount_arg(struct mntarg *ma, const char *name, const void *val, int len); struct mntarg *mount_argb(struct mntarg *ma, int flag, const char *name); @@ -737,7 +737,8 @@ int vfs_export /* process mount export info */ (struct mount *, struct export_args *); void vfs_allocate_syncvnode(struct mount *); void vfs_deallocate_syncvnode(struct mount *); -int vfs_donmount(struct thread *td, int fsflags, struct uio *fsoptions); +int vfs_donmount(struct thread *td, uint64_t fsflags, + struct uio *fsoptions); void vfs_getnewfsid(struct mount *); struct cdev *vfs_getrootfsid(struct mount *); struct mount *vfs_getvfs(fsid_t *); /* return vfs given fsid */ diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 902476f35a0e..a97d23a07ec0 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -144,7 +144,7 @@ ffs_mount(struct mount *mp) struct fs *fs; pid_t fsckpid = 0; int error, flags; - u_int mntorflags; + uint64_t mntorflags; accmode_t accmode; struct nameidata ndp; char *fspec; @@ -571,7 +571,7 @@ ffs_mount(struct mount *mp) */ static int -ffs_cmount(struct mntarg *ma, void *data, int flags) +ffs_cmount(struct mntarg *ma, void *data, uint64_t flags) { struct ufs_args args; struct export_args exp;