1/*
2 * Copyright (C) 2008 The Android Open Source Project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *  * Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 *  * Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in
12 *    the documentation and/or other materials provided with the
13 *    distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28#ifndef _SYS_MOUNT_H
29#define _SYS_MOUNT_H
30
31#include <sys/cdefs.h>
32#include <sys/ioctl.h>
33
34__BEGIN_DECLS
35
36/*
37 * These are the fs-independent mount-flags: up to 32 flags are supported
38 */
39#define MS_RDONLY        1      /* Mount read-only */
40#define MS_NOSUID        2      /* Ignore suid and sgid bits */
41#define MS_NODEV         4      /* Disallow access to device special files */
42#define MS_NOEXEC        8      /* Disallow program execution */
43#define MS_SYNCHRONOUS  16      /* Writes are synced at once */
44#define MS_REMOUNT      32      /* Alter flags of a mounted FS */
45#define MS_MANDLOCK     64      /* Allow mandatory locks on an FS */
46#define MS_DIRSYNC      128     /* Directory modifications are synchronous */
47#define MS_NOATIME      1024    /* Do not update access times. */
48#define MS_NODIRATIME   2048    /* Do not update directory access times */
49#define MS_BIND         4096
50#define MS_MOVE         8192
51#define MS_REC          16384
52#define MS_VERBOSE      32768
53#define MS_POSIXACL     (1<<16) /* VFS does not apply the umask */
54#define MS_UNBINDABLE   (1<<17) /* change to unbindable */
55#define MS_PRIVATE      (1<<18) /* change to private */
56#define MS_SLAVE        (1<<19) /* change to slave */
57#define MS_SHARED       (1<<20) /* change to shared */
58#define MS_ACTIVE       (1<<30)
59#define MS_NOUSER       (1<<31)
60
61/*
62 * Superblock flags that can be altered by MS_REMOUNT
63 */
64#define MS_RMT_MASK     (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME|MS_NODIRATIME)
65
66/*
67 * Old magic mount flag and mask
68 */
69#define MS_MGC_VAL 0xC0ED0000
70#define MS_MGC_MSK 0xffff0000
71
72/*
73 * umount2() flags
74 */
75#define MNT_FORCE	1	/* Forcibly unmount */
76#define MNT_DETACH	2	/* Detach from tree only */
77#define MNT_EXPIRE	4	/* Mark for expiry */
78
79/*
80 * Block device ioctls
81 */
82#define BLKROSET   _IO(0x12, 93) /* Set device read-only (0 = read-write).  */
83#define BLKROGET   _IO(0x12, 94) /* Get read-only status (0 = read_write).  */
84#define BLKRRPART  _IO(0x12, 95) /* Re-read partition table.  */
85#define BLKGETSIZE _IO(0x12, 96) /* Return device size.  */
86#define BLKFLSBUF  _IO(0x12, 97) /* Flush buffer cache.  */
87#define BLKRASET   _IO(0x12, 98) /* Set read ahead for block device.  */
88#define BLKRAGET   _IO(0x12, 99) /* Get current read ahead setting.  */
89
90/*
91 * Prototypes
92 */
93extern int mount(const char *, const char *,
94		   const char *, unsigned long,
95		   const void *);
96extern int umount(const char *);
97extern int umount2(const char *, int);
98
99#if 0 /* MISSING FROM BIONIC */
100extern int pivot_root(const char *, const char *);
101#endif /* MISSING */
102
103__END_DECLS
104
105#endif /* _SYS_MOUNT_H */
106