chiark / gitweb /
core: when writing drop-in files, name them directly after the property we set
authorLennart Poettering <lennart@poettering.net>
Thu, 11 Jul 2013 19:03:06 +0000 (21:03 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 11 Jul 2013 19:03:06 +0000 (21:03 +0200)
Mapping from "FooBar" to "foo-bar" is unnecessary and makes it hard to
handle many different properties with the same code, hence, let's just
not do it.

src/core/dbus-cgroup.c
src/core/dbus-service.c
src/core/dbus-unit.c

index d1d35633c122be3c8ac4a6322429c77a1dc340ad..27b54f95c6d03279f6140a7bdd48ac8c70f7ed40 100644 (file)
@@ -162,7 +162,7 @@ int bus_cgroup_set_property(
                         dbus_message_iter_get_basic(i, &b);
 
                         c->cpu_accounting = b;
-                        unit_write_drop_in_private_section(u, mode, "cpu-accounting", b ? "CPUAccounting=yes" : "CPUAccounting=no");
+                        unit_write_drop_in_private_section(u, mode, name, b ? "CPUAccounting=yes" : "CPUAccounting=no");
                 }
 
                 return 1;
@@ -185,7 +185,7 @@ int bus_cgroup_set_property(
                         c->cpu_shares = ul;
 
                         sprintf(buf, "CPUShares=%lu", ul);
-                        unit_write_drop_in_private_section(u, mode, "cpu-shares", buf);
+                        unit_write_drop_in_private_section(u, mode, name, buf);
                 }
 
                 return 1;
@@ -200,7 +200,7 @@ int bus_cgroup_set_property(
                         dbus_message_iter_get_basic(i, &b);
 
                         c->blockio_accounting = b;
-                        unit_write_drop_in_private_section(u, mode, "block-io-accounting", b ? "BlockIOAccounting=yes" : "BlockIOAccounting=no");
+                        unit_write_drop_in_private_section(u, mode, name, b ? "BlockIOAccounting=yes" : "BlockIOAccounting=no");
                 }
 
                 return 1;
@@ -223,7 +223,7 @@ int bus_cgroup_set_property(
                         c->cpu_shares = ul;
 
                         sprintf(buf, "BlockIOWeight=%lu", ul);
-                        unit_write_drop_in_private_section(u, mode, "blockio-weight", buf);
+                        unit_write_drop_in_private_section(u, mode, name, buf);
                 }
 
                 return 1;
@@ -238,7 +238,7 @@ int bus_cgroup_set_property(
                         dbus_message_iter_get_basic(i, &b);
 
                         c->memory_accounting = b;
-                        unit_write_drop_in_private_section(u, mode, "memory-accounting", b ? "MemoryAccounting=yes" : "MemoryAccounting=no");
+                        unit_write_drop_in_private_section(u, mode, name, b ? "MemoryAccounting=yes" : "MemoryAccounting=no");
                 }
 
                 return 1;
@@ -257,11 +257,11 @@ int bus_cgroup_set_property(
                         if (streq(name, "MemoryLimit")) {
                                 c->memory_limit = limit;
                                 sprintf(buf, "MemoryLimit=%" PRIu64, limit);
-                                unit_write_drop_in_private_section(u, mode, "memory-limit", buf);
+                                unit_write_drop_in_private_section(u, mode, name, buf);
                         } else {
                                 c->memory_soft_limit = limit;
                                 sprintf(buf, "MemorySoftLimit=%" PRIu64, limit);
-                                unit_write_drop_in_private_section(u, mode, "memory-soft-limit", buf);
+                                unit_write_drop_in_private_section(u, mode, name, buf);
                         }
                 }
 
@@ -285,7 +285,7 @@ int bus_cgroup_set_property(
                         c->device_policy = p;
 
                         buf = strappenda("DevicePolicy=", policy);
-                        unit_write_drop_in_private_section(u, mode, "device-policy", buf);
+                        unit_write_drop_in_private_section(u, mode, name, buf);
                 }
 
                 return 1;
@@ -365,7 +365,7 @@ int bus_cgroup_set_property(
                                 fprintf(f, "DeviceAllow=%s %s%s%s\n", a->path, a->r ? "r" : "", a->w ? "w" : "", a->m ? "m" : "");
 
                         fflush(f);
-                        unit_write_drop_in_private_section(u, mode, "device-allow", buf);
+                        unit_write_drop_in_private_section(u, mode, name, buf);
                 }
 
                 return 1;
index c2e02209beb28cfa00e174dbfdeb30a9f1415510..d63ca01c4fdacce387112880bc8a8480d857b420 100644 (file)
@@ -276,7 +276,7 @@ static int bus_service_set_transient_property(
                         }
 
                         fflush(f);
-                        unit_write_drop_in_private_section(UNIT(s), mode, "exec-start", buf);
+                        unit_write_drop_in_private_section(UNIT(s), mode, name, buf);
                 }
 
                 return 1;
index 57fac00d19a2769ae0160139abc96956331722b6..5814971b8c9e3e405bcb32579851d1f743a56c85 100644 (file)
@@ -807,7 +807,7 @@ static int bus_unit_set_transient_property(
                         if (!contents)
                                 return -ENOMEM;
 
-                        unit_write_drop_in(u, mode, "Description", contents);
+                        unit_write_drop_in(u, mode, name, contents);
                 }
 
                 return 1;
@@ -841,7 +841,7 @@ static int bus_unit_set_transient_property(
                         if (!contents)
                                 return -ENOMEM;
 
-                        unit_write_drop_in(u, mode, "Slice", contents);
+                        unit_write_drop_in(u, mode, name, contents);
                 }
                 return 1;