shm: add sealing API
[pandora-kernel.git] / include / linux / fcntl.h
1 #ifndef _LINUX_FCNTL_H
2 #define _LINUX_FCNTL_H
3
4 #include <asm/fcntl.h>
5
6 #define F_SETLEASE      (F_LINUX_SPECIFIC_BASE + 0)
7 #define F_GETLEASE      (F_LINUX_SPECIFIC_BASE + 1)
8
9 /*
10  * Cancel a blocking posix lock; internal use only until we expose an
11  * asynchronous lock api to userspace:
12  */
13 #define F_CANCELLK      (F_LINUX_SPECIFIC_BASE + 5)
14
15 /* Create a file descriptor with FD_CLOEXEC set. */
16 #define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6)
17
18 /*
19  * Request nofications on a directory.
20  * See below for events that may be notified.
21  */
22 #define F_NOTIFY        (F_LINUX_SPECIFIC_BASE+2)
23
24 /*
25  * Set and get of pipe page size array
26  */
27 #define F_SETPIPE_SZ    (F_LINUX_SPECIFIC_BASE + 7)
28 #define F_GETPIPE_SZ    (F_LINUX_SPECIFIC_BASE + 8)
29
30 /*
31  * Set/Get seals
32  */
33 #define F_ADD_SEALS     (F_LINUX_SPECIFIC_BASE + 9)
34 #define F_GET_SEALS     (F_LINUX_SPECIFIC_BASE + 10)
35
36 /*
37  * Types of seals
38  */
39 #define F_SEAL_SEAL     0x0001  /* prevent further seals from being set */
40 #define F_SEAL_SHRINK   0x0002  /* prevent file from shrinking */
41 #define F_SEAL_GROW     0x0004  /* prevent file from growing */
42 #define F_SEAL_WRITE    0x0008  /* prevent writes */
43 /* (1U << 31) is reserved for signed error codes */
44
45 /*
46  * Types of directory notifications that may be requested.
47  */
48 #define DN_ACCESS       0x00000001      /* File accessed */
49 #define DN_MODIFY       0x00000002      /* File modified */
50 #define DN_CREATE       0x00000004      /* File created */
51 #define DN_DELETE       0x00000008      /* File removed */
52 #define DN_RENAME       0x00000010      /* File renamed */
53 #define DN_ATTRIB       0x00000020      /* File changed attibutes */
54 #define DN_MULTISHOT    0x80000000      /* Don't remove notifier */
55
56 #define AT_FDCWD                -100    /* Special value used to indicate
57                                            openat should use the current
58                                            working directory. */
59 #define AT_SYMLINK_NOFOLLOW     0x100   /* Do not follow symbolic links.  */
60 #define AT_REMOVEDIR            0x200   /* Remove directory instead of
61                                            unlinking file.  */
62 #define AT_SYMLINK_FOLLOW       0x400   /* Follow symbolic links.  */
63 #define AT_NO_AUTOMOUNT         0x800   /* Suppress terminal automount traversal */
64 #define AT_EMPTY_PATH           0x1000  /* Allow empty relative pathname */
65
66 #ifdef __KERNEL__
67
68 #ifndef force_o_largefile
69 #define force_o_largefile() (BITS_PER_LONG != 32)
70 #endif
71
72 #if BITS_PER_LONG == 32
73 #define IS_GETLK32(cmd)         ((cmd) == F_GETLK)
74 #define IS_SETLK32(cmd)         ((cmd) == F_SETLK)
75 #define IS_SETLKW32(cmd)        ((cmd) == F_SETLKW)
76 #define IS_GETLK64(cmd)         ((cmd) == F_GETLK64)
77 #define IS_SETLK64(cmd)         ((cmd) == F_SETLK64)
78 #define IS_SETLKW64(cmd)        ((cmd) == F_SETLKW64)
79 #else
80 #define IS_GETLK32(cmd)         (0)
81 #define IS_SETLK32(cmd)         (0)
82 #define IS_SETLKW32(cmd)        (0)
83 #define IS_GETLK64(cmd)         ((cmd) == F_GETLK)
84 #define IS_SETLK64(cmd)         ((cmd) == F_SETLK)
85 #define IS_SETLKW64(cmd)        ((cmd) == F_SETLKW)
86 #endif /* BITS_PER_LONG == 32 */
87
88 #define IS_GETLK(cmd)   (IS_GETLK32(cmd)  || IS_GETLK64(cmd))
89 #define IS_SETLK(cmd)   (IS_SETLK32(cmd)  || IS_SETLK64(cmd))
90 #define IS_SETLKW(cmd)  (IS_SETLKW32(cmd) || IS_SETLKW64(cmd))
91
92 #endif /* __KERNEL__ */
93
94 #endif