chiark / gitweb /
completion: filter templates from restartable units
[elogind.git] / src / udev / udev-builtin-firmware.c
index 9cb42946332e96f74dc3dd263243d1d80b73ed71..bd8c2fb966c8d259026cb802e04f70ba7f15fa90 100644 (file)
 
 #include "udev.h"
 
-static bool set_loading(struct udev *udev, char *loadpath, const char *state)
-{
+static bool set_loading(struct udev *udev, char *loadpath, const char *state) {
         FILE *ldfile;
 
         ldfile = fopen(loadpath, "we");
         if (ldfile == NULL) {
-                log_error("error: can not open '%s'\n", loadpath);
+                log_error("error: can not open '%s'", loadpath);
                 return false;
         };
         fprintf(ldfile, "%s\n", state);
@@ -41,8 +40,7 @@ static bool set_loading(struct udev *udev, char *loadpath, const char *state)
         return true;
 }
 
-static bool copy_firmware(struct udev *udev, const char *source, const char *target, size_t size)
-{
+static bool copy_firmware(struct udev *udev, const char *source, const char *target, size_t size) {
         char *buf;
         FILE *fsource = NULL, *ftarget = NULL;
         bool ret = false;
@@ -53,7 +51,7 @@ static bool copy_firmware(struct udev *udev, const char *source, const char *tar
                 return false;
         }
 
-        log_debug("writing '%s' (%zi) to '%s'\n", source, size, target);
+        log_debug("writing '%s' (%zi) to '%s'", source, size, target);
 
         fsource = fopen(source, "re");
         if (fsource == NULL)
@@ -74,12 +72,9 @@ exit:
         return ret;
 }
 
-static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], bool test)
-{
+static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], bool test) {
         struct udev *udev = udev_device_get_udev(dev);
         static const char *searchpath[] = { FIRMWARE_PATH };
-        char fwencpath[UTIL_PATH_SIZE];
-        char misspath[UTIL_PATH_SIZE];
         char loadpath[UTIL_PATH_SIZE];
         char datapath[UTIL_PATH_SIZE];
         char fwpath[UTIL_PATH_SIZE];
@@ -92,7 +87,7 @@ static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], boo
 
         firmware = udev_device_get_property_value(dev, "FIRMWARE");
         if (firmware == NULL) {
-                log_error("firmware parameter missing\n\n");
+                log_error("firmware parameter missing");
                 rc = EXIT_FAILURE;
                 goto exit;
         }
@@ -111,23 +106,10 @@ static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], boo
                         break;
         }
 
-        util_path_encode(firmware, fwencpath, sizeof(fwencpath));
-        strscpyl(misspath, sizeof(misspath), "/run/udev/firmware-missing/", fwencpath, NULL);
         strscpyl(loadpath, sizeof(loadpath), udev_device_get_syspath(dev), "/loading", NULL);
 
         if (fwfile == NULL) {
-                int err;
-
-                /* This link indicates the missing firmware file and the associated device */
-                log_debug("did not find firmware file '%s'\n", firmware);
-                do {
-                        err = mkdir_parents(misspath, 0755);
-                        if (err != 0 && err != -ENOENT)
-                                break;
-                        err = symlink(udev_device_get_devpath(dev), misspath);
-                        if (err != 0)
-                                err = -errno;
-                } while (err == -ENOENT);
+                log_debug("did not find firmware file '%s'", firmware);
                 rc = EXIT_FAILURE;
                 /*
                  * Do not cancel the request in the initrd, the real root might have
@@ -146,15 +128,12 @@ static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], boo
                 goto exit;
         }
 
-        if (unlink(misspath) == 0)
-                util_delete_path(udev, misspath);
-
         if (!set_loading(udev, loadpath, "1"))
                 goto exit;
 
         strscpyl(datapath, sizeof(datapath), udev_device_get_syspath(dev), "/data", NULL);
         if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) {
-                log_error("error sending firmware '%s' to device\n", firmware);
+                log_error("error sending firmware '%s' to device", firmware);
                 set_loading(udev, loadpath, "-1");
                 rc = EXIT_FAILURE;
                 goto exit;