1 // SPDX-License-Identifier: CDDL-1.0 2 /* 3 * This file and its contents are supplied under the terms of the 4 * Common Development and Distribution License ("CDDL"), version 1.0. 5 * You may only use this file in accordance with the terms of version 6 * 1.0 of the CDDL. 7 * 8 * A full copy of the text of the CDDL should have accompanied this 9 * source. A copy of the CDDL is also available via the Internet at 10 * https://opensource.org/license/CDDL-1.0. 11 */ 12 /* 13 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 14 * Use is subject to license terms. 15 */ 16 17 18 #ifndef _LIBSPL_SYS_MOUNT_H 19 #define _LIBSPL_SYS_MOUNT_H 20 21 #if !defined(__linux__) || !defined(IN_BASE) 22 #undef _SYS_MOUNT_H_ 23 #include_next <sys/mount.h> 24 #endif 25 26 #include <assert.h> 27 #include <string.h> 28 #include <stdlib.h> 29 30 #if !defined(BLKGETSIZE64) 31 #define BLKGETSIZE64 DIOCGMEDIASIZE 32 #endif 33 34 /* 35 * Some old glibc headers don't correctly define MS_DIRSYNC and 36 * instead use the enum name S_WRITE. When using these older 37 * headers define MS_DIRSYNC to be S_WRITE. 38 */ 39 #if !defined(MS_DIRSYNC) 40 #define MS_DIRSYNC S_WRITE 41 #endif 42 43 /* 44 * Some old glibc headers don't correctly define MS_POSIXACL and 45 * instead leave it undefined. When using these older headers define 46 * MS_POSIXACL to the reserved value of (1<<16). 47 */ 48 #if !defined(MS_POSIXACL) 49 #define MS_POSIXACL (1<<16) 50 #endif 51 52 #define MS_NOSUID MNT_NOSUID 53 #define MS_NOEXEC MNT_NOEXEC 54 #define MS_NODEV 0 55 #define S_WRITE 0 56 #define MS_BIND 0 57 #define MS_REMOUNT 0 58 #define MS_SYNCHRONOUS MNT_SYNCHRONOUS 59 60 #define MS_USERS (MS_NOEXEC|MS_NOSUID|MS_NODEV) 61 #define MS_OWNER (MS_NOSUID|MS_NODEV) 62 #define MS_GROUP (MS_NOSUID|MS_NODEV) 63 #define MS_COMMENT 0 64 65 /* 66 * Older glibc <sys/mount.h> headers did not define all the available 67 * umount2(2) flags. Both MNT_FORCE and MNT_DETACH are supported in the 68 * kernel back to 2.4.11 so we define them correctly if they are missing. 69 */ 70 #ifdef MNT_FORCE 71 #define MS_FORCE MNT_FORCE 72 #else 73 #define MS_FORCE 0x00000001 74 #endif /* MNT_FORCE */ 75 76 #ifdef MNT_DETACH 77 #define MS_DETACH MNT_DETACH 78 #else 79 #define MS_DETACH 0x00000002 80 #endif /* MNT_DETACH */ 81 82 /* 83 * MS_OVERLAY (-O: allow mounting over a non-empty directory) and MS_CRYPT 84 * (load/unload encryption keys with the (un)mount) are libzfs-internal flags, 85 * never passed to the kernel. They use high bits that do_unmount() masks 86 * off before unmount(2); do_mount() builds its iovec from named options. 87 */ 88 #define MS_OVERLAY 0x20000000 89 #define MS_CRYPT 0x40000000 90 91 #endif /* _LIBSPL_SYS_MOUNT_H */ 92