]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dissect-image: drop currently unused code
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 6 Sep 2022 13:50:33 +0000 (22:50 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 7 Sep 2022 11:45:24 +0000 (20:45 +0900)
Currently, dissect_image() is called only through dissect_loop_device(),
and image_path is always specified. Let's drop it.

src/shared/dissect-image.c

index b5c963656b8a059bdd375b3f2b8ea299e1dc52bd..d69a7bebc4c9ad86d044f34ac72167f67a5461c9 100644 (file)
@@ -305,24 +305,6 @@ int dissect_image(
                 .has_init_system = -1,
         };
 
-        if (!image_path) {
-                const char *sysname;
-
-                /* If image_path is not provided and the device is a loopback block device, then use the path
-                 * to the backing file. Note that the backing_file reference resolves symlinks, while for
-                 * sysext images we want the original path. */
-
-                r = sd_device_get_sysname(d, &sysname);
-                if (r < 0)
-                        return log_debug_errno(r, "Failed to get device sysname: %m");
-
-                if (startswith(sysname, "loop")) {
-                        r = sd_device_get_sysattr_value(d, "loop/backing_file", &image_path);
-                        if (r < 0)
-                                log_debug_errno(r, "Failed to lookup image name via loop device backing file sysattr, ignoring: %m");
-                }
-        }
-
         if (image_path) {
                 _cleanup_free_ char *extracted_filename = NULL, *name_stripped = NULL;