shared: Followups for #37575

This commit is contained in:
Daan De Meyer
2025-05-24 19:49:08 +02:00
committed by Yu Watanabe
parent f989d2853f
commit dbef7bcf29
11 changed files with 15 additions and 21 deletions

View File

@@ -127,7 +127,7 @@ int btrfs_qgroup_get_quota(const char *path, uint64_t qgroupid, BtrfsQuotaInfo *
int btrfs_log_dev_root(int level, int ret, const char *p);
bool btrfs_might_be_subvol(const struct stat *st);
bool btrfs_might_be_subvol(const struct stat *st) _pure_;
int btrfs_forget_device(const char *path);

View File

@@ -851,7 +851,7 @@ int config_section_new(const char *filename, unsigned line, ConfigSection **ret)
return 0;
}
int _hashmap_by_section_find_unused_line(
static int _hashmap_by_section_find_unused_line(
HashmapBase *entries_by_section,
const char *filename,
unsigned *ret) {

View File

@@ -150,11 +150,6 @@ void config_section_hash_func(const ConfigSection *c, struct siphash *state);
int config_section_compare_func(const ConfigSection *x, const ConfigSection *y);
extern const struct hash_ops config_section_hash_ops;
int _hashmap_by_section_find_unused_line(
HashmapBase *entries_by_section,
const char *filename,
unsigned *ret);
int hashmap_by_section_find_unused_line(Hashmap *entries_by_section, const char *filename, unsigned *ret);
int ordered_hashmap_by_section_find_unused_line(OrderedHashmap *entries_by_section, const char *filename, unsigned *ret);

View File

@@ -15,6 +15,7 @@ static inline const char* notify_start(const char *start, const char *stop) {
return stop;
}
/* This is intended to be used with _cleanup_ attribute. */
static inline void notify_on_cleanup(const char **p) {
if (*p)
(void) sd_notify(false, *p);

View File

@@ -187,8 +187,8 @@ static inline bool dissected_image_is_bootable_uefi(DissectedImage *m) {
return m && m->partitions[PARTITION_ESP].found && dissected_image_is_bootable_os(m);
}
bool dissected_image_is_portable(DissectedImage *m);
bool dissected_image_is_initrd(DissectedImage *m);
bool dissected_image_is_portable(DissectedImage *m) _pure_;
bool dissected_image_is_initrd(DissectedImage *m) _pure_;
DecryptedImage* decrypted_image_ref(DecryptedImage *p);
DecryptedImage* decrypted_image_unref(DecryptedImage *p);

View File

@@ -159,8 +159,6 @@ enum {
SECCOMP_ERROR_NUMBER_KILL = INT_MAX - 1,
};
bool seccomp_errno_or_action_is_valid(int n);
int seccomp_parse_errno_or_action(const char *p);
const char* seccomp_errno_or_action_to_string(int num);
bool seccomp_errno_or_action_is_valid(int n) _const_;
int seccomp_parse_errno_or_action(const char *p) _pure_;
const char* seccomp_errno_or_action_to_string(int num) _const_;

View File

@@ -181,7 +181,7 @@ int parse_sleep_config(SleepConfig **ret) {
return 0;
}
bool SLEEP_NEEDS_MEM_SLEEP(const SleepConfig *sc, SleepOperation operation) {
bool sleep_needs_mem_sleep(const SleepConfig *sc, SleepOperation operation) {
assert(sc);
assert(operation >= 0 && operation < _SLEEP_OPERATION_CONFIG_MAX);
@@ -354,7 +354,7 @@ static int sleep_supported_internal(
return false;
}
if (SLEEP_NEEDS_MEM_SLEEP(sleep_config, operation)) {
if (sleep_needs_mem_sleep(sleep_config, operation)) {
r = sleep_mode_supported("/sys/power/mem_sleep", sleep_config->mem_modes);
if (r < 0)
return r;

View File

@@ -41,7 +41,7 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(SleepConfig*, sleep_config_free);
int parse_sleep_config(SleepConfig **sleep_config);
bool SLEEP_NEEDS_MEM_SLEEP(const SleepConfig *sc, SleepOperation operation);
bool sleep_needs_mem_sleep(const SleepConfig *sc, SleepOperation operation) _pure_;
typedef enum SleepSupport {
SLEEP_SUPPORTED,

View File

@@ -66,7 +66,7 @@ int mac_smack_read_at(int fd, const char *path, SmackAttr attr, char **ret) {
return getxattr_at_malloc(fd, path, smack_attr_to_string(attr), /* at_flags = */ 0, ret, /* ret_size= */ NULL);
#else
return -EOPNOTSUPP;
return -EOPNOTSUPP;
#endif
}

View File

@@ -177,7 +177,7 @@ static inline UserRecordMask USER_RECORD_STRIP_MASK(UserRecordLoadFlags f) {
return (f >> 21) & _USER_RECORD_MASK_MAX;
}
sd_json_dispatch_flags_t USER_RECORD_LOAD_FLAGS_TO_JSON_DISPATCH_FLAGS(UserRecordLoadFlags flags);
sd_json_dispatch_flags_t USER_RECORD_LOAD_FLAGS_TO_JSON_DISPATCH_FLAGS(UserRecordLoadFlags flags) _const_;
typedef struct Pkcs11EncryptedKey {
/* The encrypted passphrase, which can be decrypted with the private key indicated below */
@@ -533,7 +533,7 @@ typedef struct UserDBMatch {
.uid_max = UID_NOBODY - 1, \
}
bool userdb_match_is_set(const UserDBMatch *match);
bool userdb_match_is_set(const UserDBMatch *match) _pure_;
void userdb_match_done(UserDBMatch *match);

View File

@@ -268,7 +268,7 @@ static int execute(
if (state_fd < 0)
return log_error_errno(errno, "Failed to open /sys/power/state: %m");
if (SLEEP_NEEDS_MEM_SLEEP(sleep_config, operation)) {
if (sleep_needs_mem_sleep(sleep_config, operation)) {
r = write_mode("/sys/power/mem_sleep", sleep_config->mem_modes);
if (r < 0)
return log_error_errno(r, "Failed to write mode to /sys/power/mem_sleep: %m");