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_ONE_SECOND   (1<<17) /* fs has 1 sec a/m/ctime resolution */
55#define MS_ACTIVE       (1<<30)
56#define MS_NOUSER       (1<<31)
57
58/*
59 * Superblock flags that can be altered by MS_REMOUNT
60 */
61#define MS_RMT_MASK     (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME|MS_NODIRATIME)
62
63/*
64 * Old magic mount flag and mask
65 */
66#define MS_MGC_VAL 0xC0ED0000
67#define MS_MGC_MSK 0xffff0000
68
69/*
70 * umount2() flags
71 */
72#define MNT_FORCE	1	/* Forcibly unmount */
73#define MNT_DETACH	2	/* Detach from tree only */
74#define MNT_EXPIRE	4	/* Mark for expiry */
75
76/*
77 * Block device ioctls
78 */
79#define BLKROSET   _IO(0x12, 93) /* Set device read-only (0 = read-write).  */
80#define BLKROGET   _IO(0x12, 94) /* Get read-only status (0 = read_write).  */
81#define BLKRRPART  _IO(0x12, 95) /* Re-read partition table.  */
82#define BLKGETSIZE _IO(0x12, 96) /* Return device size.  */
83#define BLKFLSBUF  _IO(0x12, 97) /* Flush buffer cache.  */
84#define BLKRASET   _IO(0x12, 98) /* Set read ahead for block device.  */
85#define BLKRAGET   _IO(0x12, 99) /* Get current read ahead setting.  */
86
87/*
88 * Prototypes
89 */
90extern int mount(const char *, const char *,
91		   const char *, unsigned long,
92		   const void *);
93extern int umount(const char *);
94extern int umount2(const char *, int);
95
96#if 0 /* MISSING FROM BIONIC */
97extern int pivot_root(const char *, const char *);
98#endif /* MISSING */
99
100__END_DECLS
101
102#endif /* _SYS_MOUNT_H */
103