chiark / gitweb /
bus: drop systemd.kdbus_attach_flags_mask= cmdline
authorDavid Herrmann <dh.herrmann@gmail.com>
Sun, 18 Jan 2015 22:56:19 +0000 (23:56 +0100)
committerDavid Herrmann <dh.herrmann@gmail.com>
Sun, 18 Jan 2015 22:56:19 +0000 (23:56 +0100)
There is no reason to provide our own attach_flags_mask. We can simply
rely on kdbus.attach_flags_mask= which is read by the kernel *and* kmod.
If it's set, we assume the user wants to override our setting, so we
simply skip setting it.

src/libsystemd/sd-bus/bus-kernel.c

index bd829459de225c82fb585cb92e4d91c2b5c71160..e73a5077b54948e5ab1a639bfd21a053009460a9 100644 (file)
@@ -1741,30 +1741,21 @@ int bus_kernel_fix_attach_mask(void) {
 
         /* By default we don't want any kdbus metadata fields to be
          * suppressed, hence we reset the kernel mask for it to
-         * (uint64_t) -1. This is overridable via a kernel command
-         * line option, however. */
+         * (uint64_t) -1. If the module argument was overwritten by
+         * the kernel cmdline, we leave it as is. */
 
-        r = get_proc_cmdline_key("systemd.kdbus_attach_flags_mask=", &mask);
+        r = get_proc_cmdline_key("kdbus.attach_flags_mask=", &mask);
         if (r < 0)
                 return log_warning_errno(r, "Failed to read kernel command line: %m");
 
-        if (mask) {
-                const char *p = mask;
-
-                if (startswith(p, "0x"))
-                        p += 2;
-
-                if (sscanf(p, "%" PRIx64, &m) != 1)
-                        log_warning("Couldn't parse systemd.kdbus_attach_flags_mask= kernel command line parameter.");
+        if (r == 0) {
+                sprintf(buf, "0x%" PRIx64 "\n", m);
+                r = write_string_file("/sys/module/kdbus/parameters/attach_flags_mask", buf);
+                if (r < 0)
+                        return log_full_errno(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, r,
+                                              "Failed to write kdbus attach mask: %m");
         }
 
-        sprintf(buf, "0x%" PRIx64 "\n", m);
-        r = write_string_file("/sys/module/kdbus/parameters/attach_flags_mask", buf);
-        if (r < 0)
-                return log_full_errno(
-                                IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, r,
-                                "Failed to write kdbus attach mask: %m");
-
         return 0;
 }