On Mon, Sep 24, 2018 at 01:37:45PM +0100, David Howells wrote: > Christian Brauner wrote: > > > I have thought a little more about splitting up the mount flags into > > sensible sets. I think the following four sets make sense: > > > > enum { > > MOUNT_ATTR_PROPAGATION = 1, > > MOUNT_ATTR_SECURITY, > > MOUNT_ATTR_SYNC, > > MOUNT_ATTR_TIME, > > }; > > Al (I think it was) has been against splitting them up before (I've previously > proposed splitting the topology propagation flags from the mount attributes). Right, that request could probably be fulfilled by the first draft for this idea that I had but didn't send out. Basically, having a sequential enum that only ever gets bumped when we run out of flags in a set, i.e. enum { MOUNT_ATTR_SET_1 = 1, MOUNT_ATTR_SET_2 = 2, MOUNT_ATTR_SET_3 = 3, . . . }; Then we would currently only define a single set enum { MOUNT_ATTR_SET_1 = 1, }; dump all the current mount flags we would like to support in there and call it a day until we run out of flags at which point we introduce MOUNT_ATTR_SET_2. But honestly, I find defining cuts by forming sets of logically related flags to be more intuitive and transparent for kernel- and userspace. But I'm just another muppet with an opinion. :) > > > #define MOUNT_ATTR_NOATIME (1<<1) > > #define MOUNT_ATTR_RELATIME (1<<3) > > #define MOUNT_ATTR_STRICTATIME (1<<4) > > These aren't independent, but are actually settings on the same dial, so I > would suggest that they shouldn't be separate flags. I'm not sure about > LAZYTIME though. So what you or Miklos suggested before, namely making them an enum too? > > > enum { > > MOUNT_ATTR_PROPAGATION = 1, > > MOUNT_ATTR_SECURITY, > > MOUNT_ATTR_SECURITY_1 = MOUNT_ATTR_SECURITY, > > MOUNT_ATTR_SYNC, > > MOUNT_ATTR_TIME, > > MOUNT_ATTR_SECURITY_2, > > }; > > In UAPI headers, always explicitly number your symbols, even in an enum, just > to make sure that the numbers don't get transparently changed by accident. +1 and thanks for the tip! > > > These flags will likely become AT_* flags or be tied to a syscall > > afaict. > > > > #define MS_REMOUNT 32 > > #define MS_BIND 4096 > > #define MS_MOVE 8192 > > #define MS_REC 16384 > > MS_REMOUNT: fd = fspick(); fscommand(fd, FSCONFIG_CMD_RECONFIGURE); > > MS_REMOUNT|MS_BIND: mount_setattr(). > > MS_BIND: fd = open_tree(..., OPEN_TREE_CLONE); move_mount(fd, "", ...); > > MS_MOVE: fd = open_tree(..., 0); move_mount(fd, "", ...); > > MS_REC: AT_RECURSIVE > > > Internal sb flags will not be part of the new mount attr sets. (They > > should - imho - not be exposed to userspace at all.): > > Agreed. > > > What remains is an odd duck that probably could be thrown into security > > but also *shrug* > > > > #define MS_I_VERSION (1<<23) > > Um. I think it would probably belong with atime settings. > > David