]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: rename MemoryLimitByPhysicalMemory transient property to MemoryLimitScale
authorLennart Poettering <lennart@poettering.net>
Tue, 19 Jul 2016 14:10:15 +0000 (16:10 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 22 Jul 2016 13:33:12 +0000 (15:33 +0200)
That way, we can neatly keep this in line with the new TasksMaxScale= option.

Note that we didn't release a version with MemoryLimitByPhysicalMemory= yet,
hence this change should be unproblematic without breaking API.

src/core/dbus-cgroup.c
src/shared/bus-unit-util.c

index b3e2830c1144ab482e9a7659a959921a6b8023bc..85b0c86a2f29df896e4b4c52f5617a12616655a7 100644 (file)
@@ -856,7 +856,7 @@ int bus_cgroup_set_property(
 
                 return 1;
 
-        } else if (STR_IN_SET(name, "MemoryLowByPhysicalMemory", "MemoryHighByPhysicalMemory", "MemoryMaxByPhysicalMemory")) {
+        } else if (STR_IN_SET(name, "MemoryLowScale", "MemoryHighScale", "MemoryMaxScale")) {
                 uint32_t raw;
                 uint64_t v;
 
@@ -872,7 +872,7 @@ int bus_cgroup_set_property(
                         const char *e;
 
                         /* Chop off suffix */
-                        assert_se(e = endswith(name, "ByPhysicalMemory"));
+                        assert_se(e = endswith(name, "Scale"));
                         name = strndupa(name, e - name);
 
                         if (streq(name, "MemoryLow"))
@@ -883,7 +883,8 @@ int bus_cgroup_set_property(
                                 c->memory_max = v;
 
                         unit_invalidate_cgroup(u, CGROUP_MASK_MEMORY);
-                        unit_write_drop_in_private_format(u, mode, name, "%s=%" PRIu32 "%%", name, (uint32_t) (DIV_ROUND_UP((uint64_t) raw * 100, (uint64_t) UINT32_MAX)));
+                        unit_write_drop_in_private_format(u, mode, name, "%s=%" PRIu32 "%%", name,
+                                                          (uint32_t) (DIV_ROUND_UP((uint64_t) raw * 100U, (uint64_t) UINT32_MAX)));
                 }
 
                 return 1;
@@ -909,7 +910,7 @@ int bus_cgroup_set_property(
 
                 return 1;
 
-        } else if (streq(name, "MemoryLimitByPhysicalMemory")) {
+        } else if (streq(name, "MemoryLimitScale")) {
                 uint64_t limit;
                 uint32_t raw;
 
@@ -924,7 +925,8 @@ int bus_cgroup_set_property(
                 if (mode != UNIT_CHECK) {
                         c->memory_limit = limit;
                         unit_invalidate_cgroup(u, CGROUP_MASK_MEMORY);
-                        unit_write_drop_in_private_format(u, mode, "MemoryLimit", "MemoryLimit=%" PRIu32 "%%", (uint32_t) (DIV_ROUND_UP((uint64_t) raw * 100, (uint64_t) UINT32_MAX)));
+                        unit_write_drop_in_private_format(u, mode, "MemoryLimit", "MemoryLimit=%" PRIu32 "%%",
+                                                          (uint32_t) (DIV_ROUND_UP((uint64_t) raw * 100U, (uint64_t) UINT32_MAX)));
                 }
 
                 return 1;
index e63e9195f1bea5408ef7cda8605312a67c24399c..ea020b517b833b4ef07237c702099ca6eae57cec 100644 (file)
@@ -132,10 +132,10 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
                                 char *n;
 
                                 /* When this is a percentage we'll convert this into a relative value in the range
-                                 * 0…UINT32_MAX and pass it in the MemoryLowByPhysicalMemory property (and related
+                                 * 0…UINT32_MAX and pass it in the MemoryLowScale property (and related
                                  * ones). This way the physical memory size can be determined server-side */
 
-                                n = strjoina(field, "ByPhysicalMemory");
+                                n = strjoina(field, "Scale");
                                 r = sd_bus_message_append(m, "sv", n, "u", (uint32_t) (((uint64_t) UINT32_MAX * r) / 100U));
                                 goto finish;