mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-18 02:20:59 +03:00
3fb1fcdea1
By design the zfs utility is supposed to handle mounting and unmounting a zfs filesystem. We could allow zfs to do this directly. There are system calls available to mount/umount a filesystem. And there are library calls available to manipulate /etc/mtab. But there are a couple very good reasons not to take this appraoch... for now. Instead of directly calling the system and library calls to (u)mount the filesystem we fork and exec a (u)mount process. The principle reason for this is to delegate the responsibility for locking and updating /etc/mtab to (u)mount(8). This ensures maximum portability and ensures the right locking scheme for your version of (u)mount will be used. If we didn't do this we would have to resort to an autoconf test to determine what locking mechanism is used. The downside to using mount(8) instead of mount(2) is that we lose the exact errno which was returned by the kernel. The return code from mount(8) provides some insight in to what went wrong but it not quite as good. For the moment this is translated as a best guess in to a errno for the higher layers of zfs. In the long term a shared library called libmount is under development which provides a common API to address the locking and errno issues. Once the standard mount utility has been updated to use this library we can then leverage it. Until then this is the only safe solution. http://www.kernel.org/pub/linux/utils/util-linux/libmount-docs/index.html
103 lines
4.8 KiB
C
103 lines
4.8 KiB
C
/*
|
|
* 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 FSTAB "/etc/fstab"
|
|
#define MNTMAXSTR 128
|
|
|
|
#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 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 "user_xattr" /* enable extended attributes */
|
|
#define MNTOPT_NOXATTR "nouser_xattr" /* disable extended attributes */
|
|
#define MNTOPT_COMMENT "comment" /* comment */
|
|
#define MNTOPT_BOOTWAIT "bootwait"
|
|
#define MNTOPT_NOBOOTWAIT "nobootwait"
|
|
#define MNTOPT_OPTIONAL "optional"
|
|
#define MNTOPT_SHOWTHROUGH "showthrough"
|
|
#define MNTOPT_ZFSUTIL "zfsutil" /* called by zfs utility */
|
|
|
|
#endif /* _SYS_MNTENT_H */
|