mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-28 12:57:57 +00:00
mnt: Factor out find-mount-by-s_dev code
And move the 2nd piece lower to avoid fwd declaration and keep similar calls close to each other. Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
b6c3270b2f
commit
199619791d
23
mount.c
23
mount.c
@ -125,18 +125,6 @@ static inline int fsroot_mounted(struct mount_info *mi)
|
||||
return is_root(mi->root);
|
||||
}
|
||||
|
||||
static int __open_mountpoint(struct mount_info *pm, int mnt_fd);
|
||||
int open_mount(unsigned int s_dev)
|
||||
{
|
||||
struct mount_info *i;
|
||||
|
||||
for (i = mntinfo; i != NULL; i = i->next)
|
||||
if (s_dev == i->s_dev)
|
||||
return __open_mountpoint(i, -1);
|
||||
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
static struct mount_info *__lookup_mnt_id(struct mount_info *list, int id)
|
||||
{
|
||||
struct mount_info *m;
|
||||
@ -772,6 +760,17 @@ err:
|
||||
return -1;
|
||||
}
|
||||
|
||||
int open_mount(unsigned int s_dev)
|
||||
{
|
||||
struct mount_info *m;
|
||||
|
||||
m = lookup_mnt_sdev(s_dev);
|
||||
if (!m)
|
||||
return -ENOENT;
|
||||
|
||||
return __open_mountpoint(m, -1);
|
||||
}
|
||||
|
||||
static int open_mountpoint(struct mount_info *pm)
|
||||
{
|
||||
int fd = -1, ns_old = -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user