]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mountpoint-util: rename mount_propagation_flags_to_string() and friends as singular
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 14 Dec 2022 08:52:31 +0000 (17:52 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 15 Dec 2022 05:15:55 +0000 (14:15 +0900)
src/basic/mountpoint-util.c
src/basic/mountpoint-util.h
src/core/dbus-execute.c
src/core/load-fragment.c
src/shared/bus-print-properties.c
src/shared/bus-unit-util.c
src/test/test-mountpoint-util.c

index 09fbdcfebec31503c5b8dff4fd341012adc5ce91..0c9fc0a35059850a6b0d70ed55446c6a08d4296b 100644 (file)
@@ -568,7 +568,7 @@ int mount_nofollow(
         return mount_fd(source, fd, filesystemtype, mountflags, data);
 }
 
-const char *mount_propagation_flags_to_string(unsigned long flags) {
+const char *mount_propagation_flag_to_string(unsigned long flags) {
 
         switch (flags & (MS_SHARED|MS_SLAVE|MS_PRIVATE)) {
         case 0:
@@ -584,7 +584,7 @@ const char *mount_propagation_flags_to_string(unsigned long flags) {
         return NULL;
 }
 
-int mount_propagation_flags_from_string(const char *name, unsigned long *ret) {
+int mount_propagation_flag_from_string(const char *name, unsigned long *ret) {
 
         if (isempty(name))
                 *ret = 0;
index da5d852ff3ef1e1fb7f7e1e2dadef13a27b06e68..c7b24584da268219145ea8144e26ebd51980e5d5 100644 (file)
@@ -55,5 +55,5 @@ int dev_is_devtmpfs(void);
 int mount_fd(const char *source, int target_fd, const char *filesystemtype, unsigned long mountflags, const void *data);
 int mount_nofollow(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *data);
 
-const char *mount_propagation_flags_to_string(unsigned long flags);
-int mount_propagation_flags_from_string(const char *name, unsigned long *ret);
+const char *mount_propagation_flag_to_string(unsigned long flags);
+int mount_propagation_flag_from_string(const char *name, unsigned long *ret);
index c5a51bf5cd8d388b72345dce5615f8cb49d79d69..4b41cfe778c4056c299537e3d37cf6ae88f73aab 100644 (file)
@@ -1599,11 +1599,11 @@ static int parse_personality(const char *s, unsigned long *p) {
         return 0;
 }
 
-static const char* mount_propagation_flags_to_string_with_check(unsigned long n) {
+static const char* mount_propagation_flag_to_string_with_check(unsigned long n) {
         if (!IN_SET(n, 0, MS_SHARED, MS_PRIVATE, MS_SLAVE))
                 return NULL;
 
-        return mount_propagation_flags_to_string(n);
+        return mount_propagation_flag_to_string(n);
 }
 
 static BUS_DEFINE_SET_TRANSIENT(nsec, "t", uint64_t, nsec_t, NSEC_FMT);
@@ -1624,7 +1624,7 @@ static BUS_DEFINE_SET_TRANSIENT_PARSE_PTR(personality, unsigned long, parse_pers
 static BUS_DEFINE_SET_TRANSIENT_TO_STRING_ALLOC(secure_bits, "i", int32_t, int, "%" PRIi32, secure_bits_to_string_alloc_with_check);
 static BUS_DEFINE_SET_TRANSIENT_TO_STRING_ALLOC(capability, "t", uint64_t, uint64_t, "%" PRIu64, capability_set_to_string_alloc);
 static BUS_DEFINE_SET_TRANSIENT_TO_STRING_ALLOC(namespace_flag, "t", uint64_t, unsigned long, "%" PRIu64, namespace_flags_to_string);
-static BUS_DEFINE_SET_TRANSIENT_TO_STRING(mount_flags, "t", uint64_t, unsigned long, "%" PRIu64, mount_propagation_flags_to_string_with_check);
+static BUS_DEFINE_SET_TRANSIENT_TO_STRING(mount_flags, "t", uint64_t, unsigned long, "%" PRIu64, mount_propagation_flag_to_string_with_check);
 
 int bus_exec_context_set_transient_property(
                 Unit *u,
index 734a5941cc134d322b1b149f44f63290f55c80c5..ac8c64fe3b9782a980ad19eaca26d186be08eeb7 100644 (file)
@@ -149,7 +149,7 @@ DEFINE_CONFIG_PARSE_PTR(config_parse_blockio_weight, cg_blkio_weight_parse, uint
 DEFINE_CONFIG_PARSE_PTR(config_parse_cg_weight, cg_weight_parse, uint64_t, "Invalid weight");
 DEFINE_CONFIG_PARSE_PTR(config_parse_cg_cpu_weight, cg_cpu_weight_parse, uint64_t, "Invalid CPU weight");
 static DEFINE_CONFIG_PARSE_PTR(config_parse_cpu_shares_internal, cg_cpu_shares_parse, uint64_t, "Invalid CPU shares");
-DEFINE_CONFIG_PARSE_PTR(config_parse_exec_mount_flags, mount_propagation_flags_from_string, unsigned long, "Failed to parse mount flag");
+DEFINE_CONFIG_PARSE_PTR(config_parse_exec_mount_flags, mount_propagation_flag_from_string, unsigned long, "Failed to parse mount flag");
 DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(config_parse_numa_policy, mpol, int, -1, "Invalid NUMA policy type");
 DEFINE_CONFIG_PARSE_ENUM(config_parse_status_unit_format, status_unit_format, StatusUnitFormat, "Failed to parse status unit format");
 DEFINE_CONFIG_PARSE_ENUM_FULL(config_parse_socket_timestamping, socket_timestamping_from_string_harder, SocketTimestamping, "Failed to parse timestamping precision");
index b0267427fa1bf9b60e463c25b4f676f7e3a82d3e..9369866fa1a563a704067e4aec6b081bde918631 100644 (file)
@@ -136,7 +136,7 @@ static int bus_print_property(const char *name, const char *expected_value, sd_b
                 } else if (streq(name, "MountFlags")) {
                         const char *result;
 
-                        result = mount_propagation_flags_to_string(u);
+                        result = mount_propagation_flag_to_string(u);
                         if (!result)
                                 return -EINVAL;
 
index 6b6383b60b780b61da00203981db0f917a8953da..7d136df2d920b263579607ac59ed702e30d9b3ed 100644 (file)
@@ -131,7 +131,7 @@ DEFINE_BUS_APPEND_PARSE_PTR("t", uint64_t, uint64_t, cg_blkio_weight_parse);
 DEFINE_BUS_APPEND_PARSE_PTR("t", uint64_t, uint64_t, cg_cpu_shares_parse);
 DEFINE_BUS_APPEND_PARSE_PTR("t", uint64_t, uint64_t, cg_weight_parse);
 DEFINE_BUS_APPEND_PARSE_PTR("t", uint64_t, uint64_t, cg_cpu_weight_parse);
-DEFINE_BUS_APPEND_PARSE_PTR("t", uint64_t, unsigned long, mount_propagation_flags_from_string);
+DEFINE_BUS_APPEND_PARSE_PTR("t", uint64_t, unsigned long, mount_propagation_flag_from_string);
 DEFINE_BUS_APPEND_PARSE_PTR("t", uint64_t, uint64_t, safe_atou64);
 DEFINE_BUS_APPEND_PARSE_PTR("u", uint32_t, mode_t, parse_mode);
 DEFINE_BUS_APPEND_PARSE_PTR("u", uint32_t, unsigned, safe_atou);
@@ -1035,7 +1035,7 @@ static int bus_append_execute_property(sd_bus_message *m, const char *field, con
                 return bus_append_safe_atou(m, field, eq);
 
         if (streq(field, "MountFlags"))
-                return bus_append_mount_propagation_flags_from_string(m, field, eq);
+                return bus_append_mount_propagation_flag_from_string(m, field, eq);
 
         if (STR_IN_SET(field, "Environment",
                               "UnsetEnvironment",
index ccf18ecd9c5e2a010e79fb649b149dd9034cbf78..c4a87d253e915dd45e59d51f373f4545b751c6a7 100644 (file)
 #include "tests.h"
 #include "tmpfile-util.h"
 
-static void test_mount_propagation_flags_one(const char *name, int ret, unsigned long expected) {
+static void test_mount_propagation_flag_one(const char *name, int ret, unsigned long expected) {
         unsigned long flags;
 
         log_info("/* %s(%s) */", __func__, strnull(name));
 
-        assert_se(mount_propagation_flags_from_string(name, &flags) == ret);
+        assert_se(mount_propagation_flag_from_string(name, &flags) == ret);
 
         if (ret >= 0) {
                 const char *c;
 
                 assert_se(flags == expected);
 
-                c = mount_propagation_flags_to_string(flags);
+                c = mount_propagation_flag_to_string(flags);
                 if (isempty(name))
                         assert_se(isempty(c));
                 else
@@ -37,14 +37,14 @@ static void test_mount_propagation_flags_one(const char *name, int ret, unsigned
         }
 }
 
-TEST(mount_propagation_flags) {
-        test_mount_propagation_flags_one("shared", 0, MS_SHARED);
-        test_mount_propagation_flags_one("slave", 0, MS_SLAVE);
-        test_mount_propagation_flags_one("private", 0, MS_PRIVATE);
-        test_mount_propagation_flags_one(NULL, 0, 0);
-        test_mount_propagation_flags_one("", 0, 0);
-        test_mount_propagation_flags_one("xxxx", -EINVAL, 0);
-        test_mount_propagation_flags_one(" ", -EINVAL, 0);
+TEST(mount_propagation_flag) {
+        test_mount_propagation_flag_one("shared", 0, MS_SHARED);
+        test_mount_propagation_flag_one("slave", 0, MS_SLAVE);
+        test_mount_propagation_flag_one("private", 0, MS_PRIVATE);
+        test_mount_propagation_flag_one(NULL, 0, 0);
+        test_mount_propagation_flag_one("", 0, 0);
+        test_mount_propagation_flag_one("xxxx", -EINVAL, 0);
+        test_mount_propagation_flag_one(" ", -EINVAL, 0);
 }
 
 TEST(mnt_id) {