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