Commit b2504e07 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

mounts: enumirate mounts bellow specified element

Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent eef4853c
......@@ -549,7 +549,9 @@ int dump_mnt_ns(int ns_pid, struct cr_fdset *fdset)
return 0;
}
#define MNT_TREE_WALK(_mi, _el, _fn_f, _fn_r) do { \
#define MNT_TREE_WALK(_r, _el, _fn_f, _fn_r) do { \
struct mount_info *_mi = _r; \
\
while (1) { \
if (_fn_f(_mi)) \
return -1; \
......@@ -561,8 +563,8 @@ int dump_mnt_ns(int ns_pid, struct cr_fdset *fdset)
up: \
if (_fn_r(_mi)) \
return -1; \
if (_mi->parent == NULL) \
return 0; \
if (_mi == _r) \
break; \
if (_mi->siblings._el == &_mi->parent->children) { \
_mi = _mi->parent; \
goto up; \
......@@ -579,12 +581,16 @@ static int mnt_tree_for_each(struct mount_info *m,
int (*fn)(struct mount_info *))
{
MNT_TREE_WALK(m, next, fn, MNT_WALK_NONE);
return 0;
}
static int mnt_tree_for_each_reverse(struct mount_info *m,
int (*fn)(struct mount_info *))
{
MNT_TREE_WALK(m, prev, MNT_WALK_NONE, fn);
return 0;
}
static char *resolve_source(struct mount_info *mi)
......
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