Commit e54ad19a authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

mount: Add phys_stat_dev_match helper

This helper serves to hide fs specifics (in particular
btrfs) thus the caller won't need the details.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent c9069ba0
...@@ -22,4 +22,6 @@ extern struct mount_info *lookup_mnt_sdev(unsigned int s_dev); ...@@ -22,4 +22,6 @@ extern struct mount_info *lookup_mnt_sdev(unsigned int s_dev);
extern struct ns_desc mnt_ns_desc; extern struct ns_desc mnt_ns_desc;
extern bool phys_stat_dev_match(dev_t st_dev, dev_t phys_dev);
#endif /* __CR_MOUNT_H__ */ #endif /* __CR_MOUNT_H__ */
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "util-pie.h" #include "util-pie.h"
#include "log.h" #include "log.h"
#include "mount.h" #include "mount.h"
#include "mount-btrfs.h"
#include "pstree.h" #include "pstree.h"
#include "proc_parse.h" #include "proc_parse.h"
#include "image.h" #include "image.h"
...@@ -97,6 +98,19 @@ struct mount_info *lookup_mnt_sdev(unsigned int s_dev) ...@@ -97,6 +98,19 @@ struct mount_info *lookup_mnt_sdev(unsigned int s_dev)
return NULL; return NULL;
} }
bool phys_stat_dev_match(dev_t st_dev, dev_t phys_dev)
{
if (st_dev == phys_dev)
return true;
/*
* BTRFS returns subvolume dev-id instead of
* superblock dev-id so we might need additional
* tests here.
*/
return is_btrfs_subvol(phys_dev, st_dev);
}
/* /*
* Comparer two mounts. Return true if only mount points are differ. * Comparer two mounts. Return true if only mount points are differ.
* Don't care about root and mountpoints, if bind is true. * Don't care about root and mountpoints, if bind is true.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment