#include "string-util.h"
#include "strv.h"
#include "tmpfile-util.h"
+#include "udev-util.h"
#include "user-util.h"
#include "xattr-util.h"
if (device_is_mmc_special_partition(q))
continue;
+ r = device_wait_for_initialization(q, "block", NULL);
+ if (r < 0)
+ return r;
+
n++;
}
sd_device *d,
unsigned num_partitions,
sd_device_enumerator **ret_enumerator) {
+ _cleanup_(sd_device_unrefp) sd_device *device = NULL;
int r;
+ log_debug("Waiting for device (parent + %d partitions) to appear...", num_partitions);
+
+ r = device_wait_for_initialization(d, "block", &device);
+ if (r < 0)
+ return r;
+
for (unsigned i = 0; i < N_DEVICE_NODE_LIST_ATTEMPTS; i++) {
- r = wait_for_partitions_to_appear(fd, d, num_partitions, ret_enumerator);
+ r = wait_for_partitions_to_appear(fd, device, num_partitions, ret_enumerator);
if (r != -EAGAIN)
return r;
}
if (!m)
return -ENOMEM;
+ r = sd_device_new_from_devnum(&d, 'b', st.st_rdev);
+ if (r < 0)
+ return r;
+
if (!(flags & DISSECT_IMAGE_GPT_ONLY) &&
(flags & DISSECT_IMAGE_REQUIRE_ROOT)) {
const char *usage = NULL;
m->encrypted = streq_ptr(fstype, "crypto_LUKS");
+ r = loop_wait_for_partitions_to_appear(fd, d, 0, &e);
+ if (r < 0)
+ return r;
+
*ret = TAKE_PTR(m);
return 0;
if (!pl)
return -errno ?: -ENOMEM;
- r = sd_device_new_from_devnum(&d, 'b', st.st_rdev);
- if (r < 0)
- return r;
-
r = loop_wait_for_partitions_to_appear(fd, d, blkid_partlist_numof_partitions(pl), &e);
if (r < 0)
return r;