]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared: Followups for #37575
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 24 May 2025 17:49:08 +0000 (19:49 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 24 May 2025 18:28:50 +0000 (03:28 +0900)
src/shared/btrfs-util.h
src/shared/conf-parser.c
src/shared/conf-parser.h
src/shared/daemon-util.h
src/shared/dissect-image.h
src/shared/seccomp-util.h
src/shared/sleep-config.c
src/shared/sleep-config.h
src/shared/smack-util.c
src/shared/user-record.h
src/sleep/sleep.c

index 44438bbaf3f2c1341079de36dbd982062cf6e292..63fc1d0b32d5050982ace446942b816e9d5004f3 100644 (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);
 
index 5a2e253175cf6bc502d3f02ff3969555e364f05a..dc9561f9625ddcb65567743138d61299f91921ab 100644 (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) {
index e3f4666dfb74bcea9177aa563615517672d559a2..2f1b5ffecc6bf2cce4b3a3d2fbefb9594901cd09 100644 (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);
 
index 6b81fcd75c90d2fd59914f966d46290c2878f340..90d4a1689bbe1f6f56aa0bb318436b69d60241e7 100644 (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);
index 226b6f6428a2a151be9764b591972c6a013c7dff..54fdd8da0dd6d356ae6d99775756eb1bb2811fad 100644 (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);
index bd8f1a18770c1ade740aa31ab97703e22e491cd3..bde97acbec002cc9d56085ee6ca3d52f931c8aaa 100644 (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_;
index 9a6e258bd8b739a729957448947102171f3bc34b..3f4aede53714f4ceaeb341770e6279caa94dcdb7 100644 (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;
index 07d9848db2c5d8e8417bbd1651dbebb7ea44872e..9463a23d6dcd26b8b382a3c04ba49a5d76e1837e 100644 (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,
index 653e73fb94f266908e24e591c3c158e155ed36e7..cf157fa6e77f4c6e25addc2b159a690ce878c5e7 100644 (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
 }
 
index 870c30b7a82ea181de3c7c956dbcbf5f64d0f0b9..f411214453f3ecb56321d5f6bacfbe4c3c7f64ef 100644 (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);
 
index 03375a942a84d59f70c1ce3fa6fdb551c8e5c4ca..3f09d2272d3cf56c21159d49ca1f683c768dafd0 100644 (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");