mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-01 14:55:39 +00:00
mount: move is_root, is_root, fsroot_mounted to the top of the file
They are trivial and these functions will be used in many places Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
b2504e0763
commit
3ea73d7f9b
30
mount.c
30
mount.c
@@ -27,6 +27,21 @@
|
|||||||
static struct mount_info *mntinfo;
|
static struct mount_info *mntinfo;
|
||||||
int mntns_root = -1;
|
int mntns_root = -1;
|
||||||
|
|
||||||
|
static inline int is_root(char *p)
|
||||||
|
{
|
||||||
|
return p[0] == '/' && p[1] == '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int is_root_mount(struct mount_info *mi)
|
||||||
|
{
|
||||||
|
return is_root(mi->mountpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int fsroot_mounted(struct mount_info *mi)
|
||||||
|
{
|
||||||
|
return is_root(mi->root);
|
||||||
|
}
|
||||||
|
|
||||||
int open_mount(unsigned int s_dev)
|
int open_mount(unsigned int s_dev)
|
||||||
{
|
{
|
||||||
struct mount_info *i;
|
struct mount_info *i;
|
||||||
@@ -442,16 +457,6 @@ static struct fstype *decode_fstype(u32 fst)
|
|||||||
return &fstypes[fst];
|
return &fstypes[fst];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int is_root(char *p)
|
|
||||||
{
|
|
||||||
return p[0] == '/' && p[1] == '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int is_root_mount(struct mount_info *mi)
|
|
||||||
{
|
|
||||||
return is_root(mi->mountpoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int validate_shared(struct mount_info *info)
|
static int validate_shared(struct mount_info *info)
|
||||||
{
|
{
|
||||||
struct mount_info *m, *t;
|
struct mount_info *m, *t;
|
||||||
@@ -633,11 +638,6 @@ static int do_bind_mount(struct mount_info *mi)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int fsroot_mounted(struct mount_info *mi)
|
|
||||||
{
|
|
||||||
return is_root(mi->root);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int do_mount_one(struct mount_info *mi)
|
static int do_mount_one(struct mount_info *mi)
|
||||||
{
|
{
|
||||||
if (!mi->parent)
|
if (!mi->parent)
|
||||||
|
Reference in New Issue
Block a user