Hi Rafał, instead of reverting the hierarchical mount handling, isn't fixing the unintended mounts just a matter of doing a prefix compare during vlist_for_first_to_element() traversal?
Assuming that `the_dev` refers to the block we do want to mount and `dev` is
the iterator pointing to each `dev` which is lexically ordered before
`the_dev`, would something like the below code suffice?
-- 8< --
size_t tlen = strlen(the_dev->m->target);
vlist_for_first_to_element(&devices, the_dev, dev, node) {
if (dev->m && dev->m->type == TYPE_MOUNT) {
/* skip this dev if its mount target path isn't a parent
directory of the_dev's target mount path. */
size_t ilen = strlen(dev->m->target);
if (ilen > tlen ||
strncmp(dev->m->target, the_dev->m->target, ilen) != 0 ||
(dev->m->target[ilen] != '/' &&
dev->m->target[ilen] != '\0'))
continue;
int err = mount_device(dev, type);
if (err)
return err;
}
}
-- >8 --
~ Jo
signature.asc
Description: OpenPGP digital signature
_______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
