nspawn: replace boolean --private-user-chown by enum
authorLennart Poettering <lennart@poettering.net>
Tue, 27 Apr 2021 13:26:26 +0000 (15:26 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 7 May 2021 20:43:25 +0000 (22:43 +0200)
commit6c045a999800c62368470938307951bb669f5afc
tree512905b0ac5386a2f68cc40f8a8eee586a9b1aec
parent33eac552ab22af58b303342b1fa912900fa42820
nspawn: replace boolean --private-user-chown by enum

This replaces --private-user-chown by an enum value
--private-user-ownership=off|chown. Changes otherwise very little.

This is mostly preparation for a follow-up commit adding a new "map"
mode, using kernel 5.12 UID mapping mounts.

Note that this does alter codeflow a bit: the new enum already knows
three different values instead of the old true/false pair. Besides "off"
and "chown" it knows -EINVAL, i.e. whenever the value wsn't set
explicitly. This value is changed to "off" or "chown" before use, thus
retaining compat to the status quo before, except it won't override
explicit configuration anymore. Thus, if you explicitly request
--private-user=pick you can now combine it wiht an explicit
--private-user-ownership=off if you like, which will give you a
container that runs under its own UID set, but the files will be owned
by the original image. Makes not much sense besids maybe debugging, but
if requested explicitly I think it's OK to implement.
src/nspawn/nspawn-gperf.gperf
src/nspawn/nspawn-settings.c
src/nspawn/nspawn-settings.h
src/nspawn/nspawn.c