&verity,
root_image_options,
loop_device->uevent_seqnum_not_before,
+ loop_device->timestamp_not_before,
dissect_image_flags,
&dissected_image);
if (r < 0)
&arg_verity_settings,
NULL,
d->uevent_seqnum_not_before,
+ d->timestamp_not_before,
arg_flags,
&m);
if (r < 0)
fd,
NULL, NULL,
UINT64_MAX,
+ USEC_INFINITY,
DISSECT_IMAGE_GPT_ONLY|
DISSECT_IMAGE_NO_UDEV|
DISSECT_IMAGE_USR_NO_ROOT,
&arg_verity_settings,
NULL,
loop->uevent_seqnum_not_before,
+ loop->timestamp_not_before,
dissect_image_flags,
&dissected_image);
if (r == -ENOPKG) {
d->fd,
NULL, NULL,
d->uevent_seqnum_not_before,
+ d->timestamp_not_before,
DISSECT_IMAGE_READ_ONLY |
DISSECT_IMAGE_GENERIC_ROOT |
DISSECT_IMAGE_REQUIRE_ROOT |
d->fd,
NULL, NULL,
d->uevent_seqnum_not_before,
+ d->timestamp_not_before,
DISSECT_IMAGE_GENERIC_ROOT |
DISSECT_IMAGE_REQUIRE_ROOT |
DISSECT_IMAGE_RELAX_VAR_CHECK |
if (r < 0)
return r;
- r = sd_device_enumerator_allow_uninitialized(e);
- if (r < 0)
- return r;
-
r = sd_device_enumerator_add_match_subsystem(e, "block", true);
if (r < 0)
return r;
static int find_partition(
sd_device *parent,
blkid_partition pp,
+ usec_t timestamp_not_before,
sd_device **ret) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
return r;
FOREACH_DEVICE(e, q) {
+ uint64_t usec;
+
+ r = sd_device_get_usec_initialized(q, &usec);
+ if (r == -EBUSY) /* Not initialized yet */
+ continue;
+ if (r < 0)
+ return r;
+
+ if (timestamp_not_before != USEC_INFINITY &&
+ usec < timestamp_not_before) /* udev database entry older than our attachment? Then it's not ours */
+ continue;
+
r = device_is_partition(q, parent, pp);
if (r < 0)
return r;
blkid_partition pp,
usec_t deadline,
uint64_t uevent_seqnum_not_before,
+ usec_t timestamp_not_before,
sd_device **ret) {
_cleanup_(sd_event_source_unrefp) sd_event_source *timeout_source = NULL;
assert(pp);
assert(ret);
- r = find_partition(parent, pp, ret);
+ r = find_partition(parent, pp, timestamp_not_before, ret);
if (r != -ENXIO)
return r;
return r;
/* Check again, the partition might have appeared in the meantime */
- r = find_partition(parent, pp, ret);
+ r = find_partition(parent, pp, timestamp_not_before, ret);
if (r != -ENXIO)
return r;
const VeritySettings *verity,
const MountOptions *mount_options,
uint64_t uevent_seqnum_not_before,
+ usec_t timestamp_not_before,
DissectImageFlags flags,
DissectedImage **ret) {
if (!pp)
return errno_or_else(EIO);
- r = wait_for_partition_device(d, pp, deadline, uevent_seqnum_not_before, &q);
+ r = wait_for_partition_device(d, pp, deadline, uevent_seqnum_not_before, timestamp_not_before, &q);
if (r < 0)
return r;
const VeritySettings *verity,
const MountOptions *mount_options,
uint64_t uevent_seqnum_not_before,
+ usec_t timestamp_not_before,
DissectImageFlags flags,
DissectedImage **ret) {
name = buffer;
}
- r = dissect_image(fd, verity, mount_options, uevent_seqnum_not_before, flags, ret);
+ r = dissect_image(fd, verity, mount_options, uevent_seqnum_not_before, timestamp_not_before, flags, ret);
switch (r) {
case -EOPNOTSUPP:
if (r < 0)
return log_error_errno(r, "Failed to set up loopback device: %m");
- r = dissect_image_and_warn(d->fd, image, &verity, NULL, d->uevent_seqnum_not_before, flags, &dissected_image);
+ r = dissect_image_and_warn(d->fd, image, &verity, NULL, d->uevent_seqnum_not_before, d->timestamp_not_before, flags, &dissected_image);
if (r < 0)
return r;
&verity,
options,
loop_device->uevent_seqnum_not_before,
+ loop_device->timestamp_not_before,
dissect_image_flags,
&dissected_image);
/* No partition table? Might be a single-filesystem image, try again */
&verity,
options,
loop_device->uevent_seqnum_not_before,
+ loop_device->timestamp_not_before,
dissect_image_flags | DISSECT_IMAGE_NO_PARTITION_TABLE,
&dissected_image);
if (r < 0)
const char* mount_options_from_designator(const MountOptions *options, PartitionDesignator designator);
int probe_filesystem(const char *node, char **ret_fstype);
-int dissect_image(int fd, const VeritySettings *verity, const MountOptions *mount_options, uint64_t uevent_seqnum_not_before, DissectImageFlags flags, DissectedImage **ret);
-int dissect_image_and_warn(int fd, const char *name, const VeritySettings *verity, const MountOptions *mount_options, uint64_t uevent_seqnum_not_before, DissectImageFlags flags, DissectedImage **ret);
+int dissect_image(int fd, const VeritySettings *verity, const MountOptions *mount_options, uint64_t uevent_seqnum_not_before, usec_t timestamp_not_before, DissectImageFlags flags, DissectedImage **ret);
+int dissect_image_and_warn(int fd, const char *name, const VeritySettings *verity, const MountOptions *mount_options, uint64_t uevent_seqnum_not_before, usec_t timestamp_not_before, DissectImageFlags flags, DissectedImage **ret);
DissectedImage* dissected_image_unref(DissectedImage *m);
DEFINE_TRIVIAL_CLEANUP_FUNC(DissectedImage*, dissected_image_unref);
&verity_settings,
NULL,
d->uevent_seqnum_not_before,
+ d->timestamp_not_before,
flags,
&m);
if (r < 0)
log_notice("Acquired loop device %s, will mount on %s", loop->node, mounted);
- r = dissect_image(loop->fd, NULL, NULL, loop->uevent_seqnum_not_before, DISSECT_IMAGE_READ_ONLY, &dissected);
+ r = dissect_image(loop->fd, NULL, NULL, loop->uevent_seqnum_not_before, loop->timestamp_not_before, DISSECT_IMAGE_READ_ONLY, &dissected);
if (r < 0)
log_error_errno(r, "Failed dissect loopback device %s: %m", loop->node);
assert_se(r >= 0);
sfdisk = NULL;
assert_se(loop_device_make(fd, O_RDWR, 0, UINT64_MAX, LO_FLAGS_PARTSCAN, &loop) >= 0);
- assert_se(dissect_image(loop->fd, NULL, NULL, loop->uevent_seqnum_not_before, 0, &dissected) >= 0);
+ assert_se(dissect_image(loop->fd, NULL, NULL, loop->uevent_seqnum_not_before, loop->timestamp_not_before, 0, &dissected) >= 0);
assert_se(dissected->partitions[PARTITION_ESP].found);
assert_se(dissected->partitions[PARTITION_ESP].node);
assert_se(make_filesystem(dissected->partitions[PARTITION_HOME].node, "ext4", "home", id, true) >= 0);
dissected = dissected_image_unref(dissected);
- assert_se(dissect_image(loop->fd, NULL, NULL, loop->uevent_seqnum_not_before, 0, &dissected) >= 0);
+ assert_se(dissect_image(loop->fd, NULL, NULL, loop->uevent_seqnum_not_before, loop->timestamp_not_before, 0, &dissected) >= 0);
assert_se(mkdtemp_malloc(NULL, &mounted) >= 0);