On Sat, Apr 06, 2024 at 07:16:04AM +0100, Al Viro wrote: > On Sat, Apr 06, 2024 at 07:10:02AM +0100, Al Viro wrote: > > On Thu, Mar 28, 2024 at 01:27:24PM +0100, Christian Brauner wrote: > > > There's a bunch of flags that are purely based on what the file > > > operations support while also never being conditionally set or unset. > > > IOW, they're not subject to change for individual files. Imho, such > > > flags don't need to live in f_mode they might as well live in the fops > > > structs itself. And the fops struct already has that lonely > > > mmap_supported_flags member. We might as well turn that into a generic > > > fop_flags member and move a few flags from FMODE_* space into FOP_* > > > space. That gets us four FMODE_* bits back and the ability for new > > > static flags that are about file ops to not have to live in FMODE_* > > > space but in their own FOP_* space. It's not the most beautiful thing > > > ever but it gets the job done. Yes, there'll be an additional pointer > > > chase but hopefully that won't matter for these flags. > > > > > > I suspect there's a few more we can move into there and that we can also > > > redirect a bunch of new flag suggestions that follow this pattern into > > > the fop_flags field instead of f_mode. > > > > Looks sane; one suggestion, though - if we are going to try and free > > bits, etc., it might be a good idea to use e.g. > > #define FMODE_NOACCOUNT ((__force fmode_t)BIT(29)) > > instead of hex constants. IME it's easier to keep track of, especially > > if we have comments between the definitions. > > ... or (1u << 29), for that matter; the point is that counting zeroes > visually is error-prone, so seeing the binary logarithm of the value > somewhere would be a good idea. Sounds good. I've converted all FMODE_* flags to use <<.