/* Detect RPMB and Boot partitions, which are not listed by blkid.
* See https://github.com/systemd/systemd/issues/5806. */
static bool device_is_mmc_special_partition(struct udev_device *d) {
- const char *sysname = udev_device_get_sysname(d);
+ const char *sysname;
+
+ sysname = udev_device_get_sysname(d);
return (sysname && startswith(sysname, "mmcblk") &&
(endswith(sysname, "rpmb") || endswith(sysname, "boot0") || endswith(sysname, "boot1")));
}
+static bool device_is_block(struct udev_device *d) {
+ const char *ss;
+
+ ss = udev_device_get_subsystem(d);
+ if (!ss)
+ return false;
+
+ return streq(ss, "block");
+}
+
int dissect_image(
int fd,
const void *root_hash,
first = udev_enumerate_get_list_entry(e);
udev_list_entry_foreach(item, first) {
_cleanup_udev_device_unref_ struct udev_device *q;
+ dev_t qn;
q = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item));
if (!q)
return -errno;
+ qn = udev_device_get_devnum(q);
+ if (major(qn) == 0)
+ continue;
+
+ if (!device_is_block(q))
+ continue;
+
if (device_is_mmc_special_partition(q))
continue;
n++;
if (st.st_rdev == qn)
continue;
+ if (!device_is_block(q))
+ continue;
+
if (device_is_mmc_special_partition(q))
continue;