]> git.proxmox.com Git - mirror_lxc.git/blame - src/lxc/mount_utils.h
cgroups: use zalloc
[mirror_lxc.git] / src / lxc / mount_utils.h
CommitLineData
7f88a1a2
CB
1/* SPDX-License-Identifier: LGPL-2.1+ */
2
3#ifndef __LXC_MOUNT_UTILS_H
4#define __LXC_MOUNT_UTILS_H
5
6#include <stdio.h>
7#include <stdlib.h>
8#include <sys/mount.h>
9
10#include "compiler.h"
11
12/* open_tree() flags */
13#ifndef OPEN_TREE_CLONE
14#define OPEN_TREE_CLONE 1
15#endif
16
17#ifndef OPEN_TREE_CLOEXEC
18#define OPEN_TREE_CLOEXEC O_CLOEXEC
19#endif
20
21/* move_mount() flags */
22#ifndef MOVE_MOUNT_F_SYMLINKS
23#define MOVE_MOUNT_F_SYMLINKS 0x00000001 /* Follow symlinks on from path */
24#endif
25
26#ifndef MOVE_MOUNT_F_AUTOMOUNTS
27#define MOVE_MOUNT_F_AUTOMOUNTS 0x00000002 /* Follow automounts on from path */
28#endif
29
30#ifndef MOVE_MOUNT_F_EMPTY_PATH
31#define MOVE_MOUNT_F_EMPTY_PATH 0x00000004 /* Empty from path permitted */
32#endif
33
34#ifndef MOVE_MOUNT_T_SYMLINKS
35#define MOVE_MOUNT_T_SYMLINKS 0x00000010 /* Follow symlinks on to path */
36#endif
37
38#ifndef MOVE_MOUNT_T_AUTOMOUNTS
39#define MOVE_MOUNT_T_AUTOMOUNTS 0x00000020 /* Follow automounts on to path */
40#endif
41
42#ifndef MOVE_MOUNT_T_EMPTY_PATH
43#define MOVE_MOUNT_T_EMPTY_PATH 0x00000040 /* Empty to path permitted */
44#endif
45
46#ifndef MOVE_MOUNT__MASK
47#define MOVE_MOUNT__MASK 0x00000077
48#endif
49
50/* fsopen() flags */
51#ifndef FSOPEN_CLOEXEC
52#define FSOPEN_CLOEXEC 0x00000001
53#endif
54
55/* fspick() flags */
56#ifndef FSPICK_CLOEXEC
57#define FSPICK_CLOEXEC 0x00000001
58#endif
59
60#ifndef FSPICK_SYMLINK_NOFOLLOW
61#define FSPICK_SYMLINK_NOFOLLOW 0x00000002
62#endif
63
64#ifndef FSPICK_NO_AUTOMOUNT
65#define FSPICK_NO_AUTOMOUNT 0x00000004
66#endif
67
68#ifndef FSPICK_EMPTY_PATH
69#define FSPICK_EMPTY_PATH 0x00000008
70#endif
71
72/* fsconfig() commands */
73#ifndef FSCONFIG_SET_FLAG
74#define FSCONFIG_SET_FLAG 0 /* Set parameter, supplying no value */
75#endif
76
77#ifndef FSCONFIG_SET_STRING
78#define FSCONFIG_SET_STRING 1 /* Set parameter, supplying a string value */
79#endif
80
81#ifndef FSCONFIG_SET_BINARY
82#define FSCONFIG_SET_BINARY 2 /* Set parameter, supplying a binary blob value */
83#endif
84
85#ifndef FSCONFIG_SET_PATH
86#define FSCONFIG_SET_PATH 3 /* Set parameter, supplying an object by path */
87#endif
88
89#ifndef FSCONFIG_SET_PATH_EMPTY
90#define FSCONFIG_SET_PATH_EMPTY 4 /* Set parameter, supplying an object by (empty) path */
91#endif
92
93#ifndef FSCONFIG_SET_FD
94#define FSCONFIG_SET_FD 5 /* Set parameter, supplying an object by fd */
95#endif
96
97#ifndef FSCONFIG_CMD_CREATE
98#define FSCONFIG_CMD_CREATE 6 /* Invoke superblock creation */
99#endif
100
101#ifndef FSCONFIG_CMD_RECONFIGURE
102#define FSCONFIG_CMD_RECONFIGURE 7 /* Invoke superblock reconfiguration */
103#endif
104
105/* fsmount() flags */
106#ifndef FSMOUNT_CLOEXEC
107#define FSMOUNT_CLOEXEC 0x00000001
108#endif
109
110/* mount attributes */
111#ifndef MOUNT_ATTR_RDONLY
112#define MOUNT_ATTR_RDONLY 0x00000001 /* Mount read-only */
113#endif
114
115#ifndef MOUNT_ATTR_NOSUID
116#define MOUNT_ATTR_NOSUID 0x00000002 /* Ignore suid and sgid bits */
117#endif
118
119#ifndef MOUNT_ATTR_NODEV
120#define MOUNT_ATTR_NODEV 0x00000004 /* Disallow access to device special files */
121#endif
122
123#ifndef MOUNT_ATTR_NOEXEC
124#define MOUNT_ATTR_NOEXEC 0x00000008 /* Disallow program execution */
125#endif
126
127#ifndef MOUNT_ATTR__ATIME
128#define MOUNT_ATTR__ATIME 0x00000070 /* Setting on how atime should be updated */
129#endif
130
131#ifndef MOUNT_ATTR_RELATIME
132#define MOUNT_ATTR_RELATIME 0x00000000 /* - Update atime relative to mtime/ctime. */
133#endif
134
135#ifndef MOUNT_ATTR_NOATIME
136#define MOUNT_ATTR_NOATIME 0x00000010 /* - Do not update access times. */
137#endif
138
139#ifndef MOUNT_ATTR_STRICTATIME
140#define MOUNT_ATTR_STRICTATIME 0x00000020 /* - Always perform atime updates */
141#endif
142
143#ifndef MOUNT_ATTR_NODIRATIME
144#define MOUNT_ATTR_NODIRATIME 0x00000080 /* Do not update directory access times */
145#endif
146
147__hidden extern int mnt_attributes_new(unsigned int old_flags, unsigned int *new_flags);
148
149__hidden extern int mnt_attributes_old(unsigned int new_flags, unsigned int *old_flags);
150
14df7021
CB
151__hidden extern int mount_filesystem(const char *fs_name, const char *path, unsigned int attr_flags);
152
7f88a1a2 153#endif /* __LXC_MOUNT_UTILS_H */