adding new O_* flags

看板DFBSD_kernel作者時間16年前 (2009/08/03 02:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/3 (看更多)
Hello, I'm trying to implement the new POSIX open(2) flags O_DIRECTORY, O_SEARCH and O_EXEC described here: http://www.opengroup.org/onlinepubs/9699919799/functions/openat.html#tag_16_414 I noticed that struct file.f_flags that stores the POSIX O_* flags and some kernel internal ones has only one bit left (0x08000000). I can see several options: 1/ Do not implement O_DIRECTORY, O_SEARCH and O_EXEC (it doesn't seem implemented (yet?) elsewhere). 2/ Use the single remaining bit for O_SEARCH and O_EXEC and overlay O_DIRECTORY with some kernel internal bit. Multiplexing O_SEARCH and O_EXEC is fine because both involves checking the x permission bit under the hood. Overlaying O_DIRECTORY is fine too as it is only used at open() time and does not need to be stored in f_flags. 3/ Extend f_flags to 64 bits, move all the kernel internal bits in the most significant 32 bits and use the lower 32-bit for POSIX flags. 4/ Add a new internal flags int to struct file and move all kernel internal bits here. I favor either (3) or (2). Do you have a preference? Cheers, Nicolas
文章代碼(AID): #1ATTHhoG (DFBSD_kernel)
文章代碼(AID): #1ATTHhoG (DFBSD_kernel)