[PATCH v2 2/2] hostfs: store permissions in extended attributes

Richard Weinberger richard at nod.at
Fri Apr 14 10:59:05 PDT 2023


----- Ursprüngliche Mail -----
> Von: "Marko Petrović" <petrovicmarko2006 at gmail.com>
> About using -1 for uid and gid, in documentation for chown it is stated
> that -1 shall be used if the desired value should not be changed, since
> normally chown(2) accepts both uid and gid for changing in one system
> call.
> In the concrete implementation, since the underlying type is unsigned
> int, the -1 will be written in 2's complement and then treated as an
> unsigned positive number. For the size of 4 bytes for unsigned int, the
> resulting number is 4294967295. That is also the maximum possible number
> of users on Linux, but Linux user IDs go from 0 to 4294967294 so that
> last one is outside UID space and reserved as "don't change" flag for
> chown(2).

You're totally right. I should have checked the manpage before.
 
> In regard to the store of values in platform independent way, in my
> humble opinion, Johannes' recommendation may be preferred (storing all
> permissions in one string) because besides this it also solves the
> problem of one setxattr() succeding and other failing (for whatever
> reason may that happen) in uml_chown().

Storing them as string is also fine by me. :-)

Thanks,
//richard



More information about the linux-um mailing list