xref: /freebsd/sys/compat/linux/linux_file.h (revision f39bffc62c1395bde25d152c7f68fdf7cbaab414)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3  *
4  * Copyright (c) 2007 Roman Divacky
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  *
28  * $FreeBSD$
29  */
30 
31 #ifndef _LINUX_FILE_H_
32 #define	_LINUX_FILE_H_
33 
34 #define	LINUX_AT_FDCWD			-100
35 #define	LINUX_AT_SYMLINK_NOFOLLOW	0x100
36 #define	LINUX_AT_EACCESS		0x200
37 #define	LINUX_AT_REMOVEDIR		0x200
38 #define	LINUX_AT_SYMLINK_FOLLOW		0x400
39 
40 /*
41  * posix_fadvise advice
42  */
43 #define	LINUX_POSIX_FADV_NORMAL		0
44 #define	LINUX_POSIX_FADV_RANDOM		1
45 #define	LINUX_POSIX_FADV_SEQUENTIAL	2
46 #define	LINUX_POSIX_FADV_WILLNEED	3
47 #define	LINUX_POSIX_FADV_DONTNEED	4
48 #define	LINUX_POSIX_FADV_NOREUSE	5
49 
50 /*
51  * mount flags
52  */
53 #define	LINUX_MS_RDONLY		0x0001
54 #define	LINUX_MS_NOSUID		0x0002
55 #define	LINUX_MS_NODEV		0x0004
56 #define	LINUX_MS_NOEXEC		0x0008
57 #define	LINUX_MS_REMOUNT	0x0020
58 
59 /*
60  * common open/fcntl flags
61  */
62 #define	LINUX_O_RDONLY		00000000
63 #define	LINUX_O_WRONLY		00000001
64 #define	LINUX_O_RDWR		00000002
65 #define	LINUX_O_ACCMODE		00000003
66 #define	LINUX_O_CREAT		00000100
67 #define	LINUX_O_EXCL		00000200
68 #define	LINUX_O_NOCTTY		00000400
69 #define	LINUX_O_TRUNC		00001000
70 #define	LINUX_O_APPEND		00002000
71 #define	LINUX_O_NONBLOCK	00004000
72 #define	LINUX_O_NDELAY		LINUX_O_NONBLOCK
73 #define	LINUX_O_SYNC		00010000
74 #define	LINUX_FASYNC		00020000
75 #define	LINUX_O_DIRECT		00040000	/* Direct disk access hint */
76 #define	LINUX_O_LARGEFILE	00100000
77 #define	LINUX_O_DIRECTORY	00200000	/* Must be a directory */
78 #define	LINUX_O_NOFOLLOW	00400000	/* Do not follow links */
79 #define	LINUX_O_NOATIME		01000000
80 #define	LINUX_O_CLOEXEC		02000000
81 
82 #define	LINUX_F_DUPFD		0
83 #define	LINUX_F_GETFD		1
84 #define	LINUX_F_SETFD		2
85 #define	LINUX_F_GETFL		3
86 #define	LINUX_F_SETFL		4
87 #ifndef LINUX_F_GETLK
88 #define	LINUX_F_GETLK		5
89 #define	LINUX_F_SETLK		6
90 #define	LINUX_F_SETLKW		7
91 #endif
92 #ifndef LINUX_F_SETOWN
93 #define	LINUX_F_SETOWN		8
94 #define	LINUX_F_GETOWN		9
95 #endif
96 #ifndef LINUX_F_SETSIG
97 #define	LINUX_F_SETSIG		10
98 #define	LINUX_F_GETSIG		11
99 #endif
100 #ifndef LINUX_F_SETOWN_EX
101 #define	LINUX_F_SETOWN_EX	15
102 #define	LINUX_F_GETOWN_EX	16
103 #define	LINUX_F_GETOWNER_UIDS	17
104 #endif
105 
106 #define	LINUX_F_SPECIFIC_BASE	1024
107 
108 #define	LINUX_F_SETLEASE	(LINUX_F_SPECIFIC_BASE + 0)
109 #define	LINUX_F_GETLEASE	(LINUX_F_SPECIFIC_BASE + 1)
110 #define	LINUX_F_CANCELLK	(LINUX_F_SPECIFIC_BASE + 5)
111 #define	LINUX_F_DUPFD_CLOEXEC	(LINUX_F_SPECIFIC_BASE + 6)
112 #define	LINUX_F_NOTIFY		(LINUX_F_SPECIFIC_BASE + 2)
113 #define	LINUX_F_SETPIPE_SZ	(LINUX_F_SPECIFIC_BASE + 7)
114 #define	LINUX_F_GETPIPE_SZ	(LINUX_F_SPECIFIC_BASE + 8)
115 
116 #define	LINUX_F_GETLKP		36
117 #define	LINUX_F_SETLKP		37
118 #define	LINUX_F_SETLKPW		38
119 
120 #define	LINUX_F_OWNER_TID	0
121 #define	LINUX_F_OWNER_PID	1
122 #define	LINUX_F_OWNER_PGRP	2
123 
124 #ifndef LINUX_F_RDLCK
125 #define	LINUX_F_RDLCK		0
126 #define	LINUX_F_WRLCK		1
127 #define	LINUX_F_UNLCK		2
128 #endif
129 
130 #endif	/* !_LINUX_FILE_H_ */
131