1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

Merge pull request #31388 from keszybz/bitfield-cleanup

Bitfield cleanup
This commit is contained in:
Luca Boccassi 2024-02-20 12:15:24 +00:00 committed by GitHub
commit ce3fa3863d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 24 additions and 26 deletions

View File

@ -113,12 +113,11 @@ static bool in_qemu(void) {
int kmod_setup(void) {
#if HAVE_KMOD
static const struct {
const char *module;
const char *path;
bool warn_if_unavailable:1;
bool warn_if_module:1;
bool warn_if_unavailable;
bool warn_if_module;
bool (*condition_fn)(void);
} kmod_table[] = {
/* This one we need to load explicitly, since auto-loading on use doesn't work
@ -166,23 +165,23 @@ int kmod_setup(void) {
{ "tpm", "/sys/class/tpmrm", false, false, efi_has_tpm2 },
#endif
};
_cleanup_(kmod_unrefp) struct kmod_ctx *ctx = NULL;
unsigned i;
if (have_effective_cap(CAP_SYS_MODULE) <= 0)
return 0;
for (i = 0; i < ELEMENTSOF(kmod_table); i++) {
if (kmod_table[i].path && access(kmod_table[i].path, F_OK) >= 0)
_cleanup_(kmod_unrefp) struct kmod_ctx *ctx = NULL;
FOREACH_ARRAY(kmod, kmod_table, ELEMENTSOF(kmod_table)) {
if (kmod->path && access(kmod->path, F_OK) >= 0)
continue;
if (kmod_table[i].condition_fn && !kmod_table[i].condition_fn())
if (kmod->condition_fn && !kmod->condition_fn())
continue;
if (kmod_table[i].warn_if_module)
if (kmod->warn_if_module)
log_debug("Your kernel apparently lacks built-in %s support. Might be "
"a good idea to compile it in. We'll now try to work around "
"this by loading the module...", kmod_table[i].module);
"this by loading the module...", kmod->module);
if (!ctx) {
ctx = kmod_new(NULL, NULL);
@ -193,7 +192,7 @@ int kmod_setup(void) {
kmod_load_resources(ctx);
}
(void) module_load_and_warn(ctx, kmod_table[i].module, kmod_table[i].warn_if_unavailable);
(void) module_load_and_warn(ctx, kmod->module, kmod->warn_if_unavailable);
}
#endif

View File

@ -135,16 +135,16 @@ struct Session {
sd_event_source *fifo_event_source;
sd_event_source *leader_pidfd_event_source;
bool idle_hint;
dual_timestamp idle_hint_timestamp;
bool in_gc_queue;
bool started;
bool stopping;
bool was_active;
bool locked_hint;
bool in_gc_queue:1;
bool started:1;
bool stopping:1;
bool was_active:1;
bool idle_hint;
dual_timestamp idle_hint_timestamp;
sd_bus_message *create_message; /* The D-Bus message used to create the session, which we haven't responded to yet */
sd_bus_message *upgrade_message; /* The D-Bus message used to upgrade the session class user-incomplete → user, which we haven't responded to yet */

View File

@ -204,7 +204,7 @@ typedef struct UnitStatusInfo {
pid_t control_pid;
const char *status_text;
const char *pid_file;
bool running:1;
bool running;
int status_errno;
uint32_t fd_store_max;

View File

@ -29,9 +29,9 @@ struct PartitionInfo {
sd_id128_t type, uuid;
char *label;
char *device; /* Note that this might point to some non-existing path in case we operate on a loopback file */
bool no_auto:1;
bool read_only:1;
bool growfs:1;
bool no_auto;
bool read_only;
bool growfs;
};
#define PARTITION_INFO_NULL \

View File

@ -45,10 +45,9 @@ struct Manager {
LIST_HEAD(ServerName, runtime_servers);
LIST_HEAD(ServerName, fallback_servers);
bool have_fallbacks:1;
RateLimit ratelimit;
bool exhausted_servers;
bool have_fallbacks;
/* network */
sd_event_source *network_event_source;

View File

@ -30,11 +30,11 @@ struct ServerAddress {
struct ServerName {
Manager *manager;
bool marked;
ServerType type;
char *string;
bool marked:1;
LIST_HEAD(ServerAddress, addresses);
LIST_FIELDS(ServerName, names);
};