From 89de370eddb61949fb3c87abbe544c217079479e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 22 Sep 2020 12:48:25 +0200 Subject: [PATCH] core/namespace: drop bitfield annotations from boolean fields Such microoptimization makes sense when the structure is used in many many copies, but here's it's not, and the few bytes we save are not worth the extra code the compiler has to generate: return ns_info->mount_apivfs || ns_info->protect_control_groups || ns_info->protect_kernel_tunables || ... before: 49b187: 48 8b 45 f8 mov -0x8(%rbp),%rax 49b18b: 0f b6 00 movzbl (%rax),%eax 49b18e: 83 e0 80 and $0xffffff80,%eax 49b191: 84 c0 test %al,%al 49b193: 75 32 jne 49b1c7 49b195: 48 8b 45 f8 mov -0x8(%rbp),%rax 49b199: 0f b6 00 movzbl (%rax),%eax 49b19c: 83 e0 08 and $0x8,%eax 49b19f: 84 c0 test %al,%al 49b1a1: 75 24 jne 49b1c7 49b1a3: 48 8b 45 f8 mov -0x8(%rbp),%rax 49b1a7: 0f b6 00 movzbl (%rax),%eax 49b1aa: 83 e0 10 and $0x10,%eax 49b1ad: 84 c0 test %al,%al 49b1af: 75 16 jne 49b1c7 after: 49b024: 48 8b 45 f8 mov -0x8(%rbp),%rax 49b028: 0f b6 40 07 movzbl 0x7(%rax),%eax 49b02c: 84 c0 test %al,%al 49b02e: 75 2e jne 49b05e 49b030: 48 8b 45 f8 mov -0x8(%rbp),%rax 49b034: 0f b6 40 03 movzbl 0x3(%rax),%eax 49b038: 84 c0 test %al,%al 49b03a: 75 22 jne 49b05e 49b03c: 48 8b 45 f8 mov -0x8(%rbp),%rax 49b040: 0f b6 40 04 movzbl 0x4(%rax),%eax 49b044: 84 c0 test %al,%al 49b046: 75 16 jne 49b05e --- src/core/namespace.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/core/namespace.h b/src/core/namespace.h index 13cc0e80cb..908e57c42c 100644 --- a/src/core/namespace.h +++ b/src/core/namespace.h @@ -64,15 +64,15 @@ typedef enum ProcSubset { } ProcSubset; struct NamespaceInfo { - bool ignore_protect_paths:1; - bool private_dev:1; - bool private_mounts:1; - bool protect_control_groups:1; - bool protect_kernel_tunables:1; - bool protect_kernel_modules:1; - bool protect_kernel_logs:1; - bool mount_apivfs:1; - bool protect_hostname:1; + bool ignore_protect_paths; + bool private_dev; + bool private_mounts; + bool protect_control_groups; + bool protect_kernel_tunables; + bool protect_kernel_modules; + bool protect_kernel_logs; + bool mount_apivfs; + bool protect_hostname; ProtectHome protect_home; ProtectSystem protect_system; ProtectProc protect_proc; @@ -82,10 +82,10 @@ struct NamespaceInfo { struct BindMount { char *source; char *destination; - bool read_only:1; - bool nosuid:1; - bool recursive:1; - bool ignore_enoent:1; + bool read_only; + bool nosuid; + bool recursive; + bool ignore_enoent; }; struct TemporaryFileSystem {