Commit 80f18379 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Al Viro

fs: add a VALID_OPEN_FLAGS

Add a central define for all valid open flags, and use it in the uniqueness
check.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 020c2833
...@@ -742,16 +742,10 @@ static int __init fcntl_init(void) ...@@ -742,16 +742,10 @@ static int __init fcntl_init(void)
* Exceptions: O_NONBLOCK is a two bit define on parisc; O_NDELAY * Exceptions: O_NONBLOCK is a two bit define on parisc; O_NDELAY
* is defined as O_NONBLOCK on some platforms and not on others. * is defined as O_NONBLOCK on some platforms and not on others.
*/ */
BUILD_BUG_ON(21 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( BUILD_BUG_ON(21 - 1 /* for O_RDONLY being 0 */ !=
O_RDONLY | O_WRONLY | O_RDWR | HWEIGHT32(
O_CREAT | O_EXCL | O_NOCTTY | (VALID_OPEN_FLAGS & ~(O_NONBLOCK | O_NDELAY)) |
O_TRUNC | O_APPEND | /* O_NONBLOCK | */ __FMODE_EXEC | __FMODE_NONOTIFY));
__O_SYNC | O_DSYNC | FASYNC |
O_DIRECT | O_LARGEFILE | O_DIRECTORY |
O_NOFOLLOW | O_NOATIME | O_CLOEXEC |
__FMODE_EXEC | O_PATH | __O_TMPFILE |
__FMODE_NONOTIFY
));
fasync_cache = kmem_cache_create("fasync_cache", fasync_cache = kmem_cache_create("fasync_cache",
sizeof(struct fasync_struct), 0, SLAB_PANIC, NULL); sizeof(struct fasync_struct), 0, SLAB_PANIC, NULL);
......
...@@ -3,6 +3,12 @@ ...@@ -3,6 +3,12 @@
#include <uapi/linux/fcntl.h> #include <uapi/linux/fcntl.h>
/* list of all valid flags for the open/openat flags argument: */
#define VALID_OPEN_FLAGS \
(O_RDONLY | O_WRONLY | O_RDWR | O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC | \
O_APPEND | O_NDELAY | O_NONBLOCK | O_NDELAY | __O_SYNC | O_DSYNC | \
FASYNC | O_DIRECT | O_LARGEFILE | O_DIRECTORY | O_NOFOLLOW | \
O_NOATIME | O_CLOEXEC | O_PATH | __O_TMPFILE)
#ifndef force_o_largefile #ifndef force_o_largefile
#define force_o_largefile() (BITS_PER_LONG != 32) #define force_o_largefile() (BITS_PER_LONG != 32)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment