diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-01-31 13:47:17 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-01-31 13:47:17 +0100 |
commit | 616c53544fa280a05545a88ce3a6bb0680bb4650 (patch) | |
tree | c6eeef26b03eb07c0a3acb0cb9379ad7628aa891 /src/sysusers | |
parent | 907046282c27ee2ced5e22abb80ed8df2e157baf (diff) | |
download | systemd-616c53544fa280a05545a88ce3a6bb0680bb4650.tar.gz |
sysusers: drop counterproductive bitfield annotations
The usual story:
$ diff -u <(pahole build/systemd-sysusers.0) <(pahole build/systemd-sysusers)
/* size: 80, cachelines: 2, members: 15 */
- /* sum members: 68, holes: 1, sum holes: 4 */
- /* sum bitfield members: 5 bits (0 bytes) */
- /* padding: 7 */
- /* bit_padding: 3 bits */
+ /* sum members: 73, holes: 1, sum holes: 4 */
+ /* padding: 3 */
/* last cacheline: 16 bytes */
Effectively, because of padding, we were not saving anything. We're not putting
struct Item in arrays, but when allocating on the heap, we're going to round up to
normal alignment too.
The code becomes shorter (and quicker):
$ size build/systemd-sysusers{,.0}
text data bss dec hex filename
79967 2040 264 82271 1415f build/systemd-sysusers.0
79726 2040 264 82030 1406e build/systemd-sysusers
(In case you're wondering, I wrote this long commit message for a very simple
change on purpose: I want to deflate the bitfield cargo cult a bit.)
Diffstat (limited to 'src/sysusers')
-rw-r--r-- | src/sysusers/sysusers.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c index 6e197b964d..4a695fcfab 100644 --- a/src/sysusers/sysusers.c +++ b/src/sysusers/sysusers.c @@ -76,17 +76,17 @@ typedef struct Item { gid_t gid; uid_t uid; - bool gid_set:1; + bool gid_set; /* When set the group with the specified GID must exist * and the check if a UID clashes with the GID is skipped. */ - bool id_set_strict:1; + bool id_set_strict; - bool uid_set:1; + bool uid_set; - bool todo_user:1; - bool todo_group:1; + bool todo_user; + bool todo_group; } Item; static char *arg_root = NULL; |