mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +00:00
mount: add mnt_bind_pick helper to pick the desired bind
Adding different pick functions we would be able to search different things like mounted bind with wider root, or external bind, or external bind with same sharing group and so on and so forth. Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
This commit is contained in:
committed by
Andrei Vagin
parent
9d1f39f28a
commit
c09bd89419
@@ -173,4 +173,6 @@ extern int remount_readonly_mounts(void);
|
||||
extern int try_remount_writable(struct mount_info *mi, bool ns);
|
||||
extern bool mnt_is_overmounted(struct mount_info *mi);
|
||||
|
||||
extern struct mount_info *mnt_bind_pick(struct mount_info *mi,
|
||||
bool (*pick)(struct mount_info *mi, struct mount_info *bind));
|
||||
#endif /* __CR_MOUNT_H__ */
|
||||
|
21
criu/mount.c
21
criu/mount.c
@@ -934,6 +934,27 @@ static void search_bindmounts(void)
|
||||
__search_bindmounts(mi);
|
||||
}
|
||||
|
||||
struct mount_info *mnt_bind_pick(struct mount_info *mi, bool (*pick)(struct mount_info *mi, struct mount_info *bind))
|
||||
{
|
||||
struct mount_info *bind;
|
||||
|
||||
BUG_ON(!mi);
|
||||
|
||||
if (pick(mi, mi))
|
||||
return mi;
|
||||
|
||||
/*
|
||||
* Shouldn't use mnt_bind list before it was populated in search_bindmounts
|
||||
*/
|
||||
BUG_ON(!mi->mnt_bind_is_populated);
|
||||
|
||||
list_for_each_entry(bind, &mi->mnt_bind, mnt_bind)
|
||||
if (pick(mi, bind))
|
||||
return bind;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int resolve_shared_mounts(struct mount_info *info, int root_master_id)
|
||||
{
|
||||
struct mount_info *m, *t;
|
||||
|
Reference in New Issue
Block a user