diff options
author | Brian Behlendorf <[email protected]> | 2015-08-31 16:46:01 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-09-03 14:14:55 -0700 |
commit | 0282c4137e7409e6d85289f4955adf07fac834f5 (patch) | |
tree | faabc832933de17480f434489a98be3dc477648c /include/sys | |
parent | 69de34219af4a4d100cc5ed155a68ab03393fca4 (diff) |
Add temporary mount options
Add the required kernel side infrastructure to parse arbitrary
mount options. This enables us to support temporary mount
options in largely the same way it is handled on other platforms.
See the 'Temporary Mount Point Properties' section of zfs(8)
for complete details.
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #985
Closes #3351
Diffstat (limited to 'include/sys')
-rw-r--r-- | include/sys/Makefile.am | 1 | ||||
-rw-r--r-- | include/sys/mntent.h | 100 | ||||
-rw-r--r-- | include/sys/zfs_vfsops.h | 31 | ||||
-rw-r--r-- | include/sys/zpl.h | 7 |
4 files changed, 131 insertions, 8 deletions
diff --git a/include/sys/Makefile.am b/include/sys/Makefile.am index fd80b34ee..77ecfb2dc 100644 --- a/include/sys/Makefile.am +++ b/include/sys/Makefile.am @@ -33,6 +33,7 @@ COMMON_H = \ $(top_srcdir)/include/sys/efi_partition.h \ $(top_srcdir)/include/sys/metaslab.h \ $(top_srcdir)/include/sys/metaslab_impl.h \ + $(top_srcdir)/include/sys/mntent.h \ $(top_srcdir)/include/sys/multilist.h \ $(top_srcdir)/include/sys/nvpair.h \ $(top_srcdir)/include/sys/nvpair_impl.h \ diff --git a/include/sys/mntent.h b/include/sys/mntent.h new file mode 100644 index 000000000..e6ce11776 --- /dev/null +++ b/include/sys/mntent.h @@ -0,0 +1,100 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + * + * Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T + * All Rights Reserved + */ + +#ifndef _SYS_MNTENT_H +#define _SYS_MNTENT_H + +#define MNTTYPE_ZFS "zfs" /* ZFS file system */ + +#define MOUNT_SUCCESS 0x00 /* Success */ +#define MOUNT_USAGE 0x01 /* Invalid invocation or permissions */ +#define MOUNT_SYSERR 0x02 /* System error (ENOMEM, etc) */ +#define MOUNT_SOFTWARE 0x04 /* Internal mount bug */ +#define MOUNT_USER 0x08 /* Interrupted by user (EINTR) */ +#define MOUNT_FILEIO 0x10 /* Error updating/locking /etc/mtab */ +#define MOUNT_FAIL 0x20 /* Mount failed */ +#define MOUNT_SOMEOK 0x40 /* At least on mount succeeded */ +#define MOUNT_BUSY 0x80 /* Mount failed due to EBUSY */ + +#define MNTOPT_ASYNC "async" /* all I/O is asynchronous */ +#define MNTOPT_ATIME "atime" /* update atime for files */ +#define MNTOPT_NOATIME "noatime" /* do not update atime for files */ +#define MNTOPT_AUTO "auto" /* automount */ +#define MNTOPT_NOAUTO "noauto" /* do not automount */ +#define MNTOPT_CONTEXT "context" /* selinux context */ +#define MNTOPT_FSCONTEXT "fscontext" /* selinux fscontext */ +#define MNTOPT_DEFCONTEXT "defcontext" /* selinux defcontext */ +#define MNTOPT_ROOTCONTEXT "rootcontext" /* selinux rootcontext */ +#define MNTOPT_DEFAULTS "defaults" /* defaults */ +#define MNTOPT_DEVICES "dev" /* device-special allowed */ +#define MNTOPT_NODEVICES "nodev" /* device-special disallowed */ +#define MNTOPT_DIRATIME "diratime" /* update atime for dirs */ +#define MNTOPT_NODIRATIME "nodiratime" /* do not update atime for dirs */ +#define MNTOPT_DIRSYNC "dirsync" /* do dir updates synchronously */ +#define MNTOPT_EXEC "exec" /* enable executables */ +#define MNTOPT_NOEXEC "noexec" /* disable executables */ +#define MNTOPT_GROUP "group" /* allow group mount */ +#define MNTOPT_NOGROUP "nogroup" /* do not allow group mount */ +#define MNTOPT_IVERSION "iversion" /* update inode version */ +#define MNTOPT_NOIVERSION "noiversion" /* do not update inode version */ +#define MNTOPT_NBMAND "mand" /* allow non-blocking mandatory locks */ +#define MNTOPT_NONBMAND "nomand" /* deny non-blocking mandatory locks */ +#define MNTOPT_NETDEV "_netdev" /* network device */ +#define MNTOPT_NOFAIL "nofail" /* no failure */ +#define MNTOPT_RELATIME "relatime" /* allow relative time updates */ +#define MNTOPT_NORELATIME "norelatime" /* do not allow relative time updates */ +#define MNTOPT_DFRATIME "strictatime" /* Deferred access time updates */ +#define MNTOPT_NODFRATIME "nostrictatime" /* No Deferred access time updates */ +#define MNTOPT_SETUID "suid" /* Both setuid and devices allowed */ +#define MNTOPT_NOSETUID "nosuid" /* Neither setuid nor devices allowed */ +#define MNTOPT_OWNER "owner" /* allow owner mount */ +#define MNTOPT_NOOWNER "noowner" /* do not allow owner mount */ +#define MNTOPT_REMOUNT "remount" /* change mount options */ +#define MNTOPT_RO "ro" /* read only */ +#define MNTOPT_RW "rw" /* read/write */ +#define MNTOPT_SYNC "sync" /* all I/O is synchronous */ +#define MNTOPT_USER "user" /* allow user mount */ +#define MNTOPT_NOUSER "nouser" /* do not allow user mount */ +#define MNTOPT_USERS "users" /* allow user mount */ +#define MNTOPT_NOUSERS "nousers" /* do not allow user mount */ +#define MNTOPT_SUB "sub" /* allow mounts on subdirs */ +#define MNTOPT_NOSUB "nosub" /* do not allow mounts on subdirs */ +#define MNTOPT_QUIET "quiet" /* quiet mount */ +#define MNTOPT_LOUD "loud" /* verbose mount */ +#define MNTOPT_BIND "bind" /* remount part of a tree */ +#define MNTOPT_RBIND "rbind" /* include subtrees */ +#define MNTOPT_XATTR "xattr" /* enable extended attributes */ +#define MNTOPT_NOXATTR "noxattr" /* disable extended attributes */ +#define MNTOPT_COMMENT "comment" /* comment */ +#define MNTOPT_ZFSUTIL "zfsutil" /* called by zfs utility */ +#define MNTOPT_ACL "acl" /* passed by util-linux-2.24 mount */ +#define MNTOPT_NOACL "noacl" /* likewise */ +#define MNTOPT_POSIXACL "posixacl" /* likewise */ +#define MNTOPT_MNTPOINT "mntpoint" /* mount point hint */ + +#endif /* _SYS_MNTENT_H */ diff --git a/include/sys/zfs_vfsops.h b/include/sys/zfs_vfsops.h index af99686a6..3d2b249c9 100644 --- a/include/sys/zfs_vfsops.h +++ b/include/sys/zfs_vfsops.h @@ -41,11 +41,33 @@ extern "C" { struct zfs_sb; struct znode; +typedef struct zfs_mntopts { + char *z_osname; /* Objset name */ + char *z_mntpoint; /* Primary mount point */ + boolean_t z_readonly; + boolean_t z_do_readonly; + boolean_t z_setuid; + boolean_t z_do_setuid; + boolean_t z_exec; + boolean_t z_do_exec; + boolean_t z_devices; + boolean_t z_do_devices; + boolean_t z_xattr; + boolean_t z_do_xattr; + boolean_t z_atime; + boolean_t z_do_atime; + boolean_t z_relatime; + boolean_t z_do_relatime; + boolean_t z_nbmand; + boolean_t z_do_nbmand; +} zfs_mntopts_t; + typedef struct zfs_sb { struct super_block *z_sb; /* generic super_block */ struct backing_dev_info z_bdi; /* generic backing dev info */ struct zfs_sb *z_parent; /* parent fs */ objset_t *z_os; /* objset reference */ + zfs_mntopts_t *z_mntopts; /* passed mount options */ uint64_t z_flags; /* super_block flags */ uint64_t z_root; /* id of root znode */ uint64_t z_unlinkedobj; /* id of unlinked zapobj */ @@ -170,7 +192,10 @@ extern boolean_t zfs_fuid_overquota(zfs_sb_t *zsb, boolean_t isgroup, extern int zfs_set_version(zfs_sb_t *zsb, uint64_t newvers); extern int zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value); -extern int zfs_sb_create(const char *name, zfs_sb_t **zsbp); +extern zfs_mntopts_t *zfs_mntopts_alloc(void); +extern void zfs_mntopts_free(zfs_mntopts_t *zmo); +extern int zfs_sb_create(const char *name, zfs_mntopts_t *zmo, + zfs_sb_t **zsbp); extern int zfs_sb_setup(zfs_sb_t *zsb, boolean_t mounting); extern void zfs_sb_free(zfs_sb_t *zsb); extern int zfs_sb_prune(struct super_block *sb, unsigned long nr_to_scan, @@ -181,10 +206,10 @@ extern boolean_t zfs_is_readonly(zfs_sb_t *zsb); extern int zfs_register_callbacks(zfs_sb_t *zsb); extern void zfs_unregister_callbacks(zfs_sb_t *zsb); -extern int zfs_domount(struct super_block *sb, void *data, int silent); +extern int zfs_domount(struct super_block *sb, zfs_mntopts_t *zmo, int silent); extern void zfs_preumount(struct super_block *sb); extern int zfs_umount(struct super_block *sb); -extern int zfs_remount(struct super_block *sb, int *flags, char *data); +extern int zfs_remount(struct super_block *sb, int *flags, zfs_mntopts_t *zmo); extern int zfs_root(zfs_sb_t *zsb, struct inode **ipp); extern int zfs_statvfs(struct dentry *dentry, struct kstatfs *statp); extern int zfs_vget(struct super_block *sb, struct inode **ipp, fid_t *fidp); diff --git a/include/sys/zpl.h b/include/sys/zpl.h index c7701aae5..54b35e02d 100644 --- a/include/sys/zpl.h +++ b/include/sys/zpl.h @@ -25,12 +25,14 @@ #ifndef _SYS_ZPL_H #define _SYS_ZPL_H +#include <sys/mntent.h> #include <sys/vfs.h> #include <linux/aio.h> #include <linux/dcache_compat.h> #include <linux/exportfs.h> #include <linux/falloc.h> #include <linux/file_compat.h> +#include <linux/parser.h> #include <linux/task_io_accounting_ops.h> #include <linux/vfs_compat.h> #include <linux/writeback.h> @@ -65,11 +67,6 @@ extern const struct file_operations zpl_dir_file_operations; /* zpl_super.c */ extern void zpl_prune_sb(int64_t nr_to_scan, void *arg); -typedef struct zpl_mount_data { - const char *z_osname; /* Dataset name */ - void *z_data; /* Mount options string */ -} zpl_mount_data_t; - extern const struct super_operations zpl_super_operations; extern const struct export_operations zpl_export_operations; extern struct file_system_type zpl_fs_type; |