From 9fd793e565cf5b57913c9886e283175a5c090ff5 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Wed, 6 Aug 2014 10:57:27 +0400 Subject: [PATCH] stat: Pass namespace into phys_stat_resolve_dev, not mnt tree This makes the API simpler. Signed-off-by: Pavel Emelyanov --- files-reg.c | 2 +- include/mount.h | 3 +-- mount.c | 9 ++++----- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/files-reg.c b/files-reg.c index 68d0040a0..1ee57e04f 100644 --- a/files-reg.c +++ b/files-reg.c @@ -351,7 +351,7 @@ static int dump_ghost_remap(char *path, const struct stat *st, return -1; } - phys_dev = phys_stat_resolve_dev(nsid->mnt.mntinfo_tree, st->st_dev, path); + phys_dev = phys_stat_resolve_dev(nsid, st->st_dev, path); list_for_each_entry(gf, &ghost_files, list) if ((gf->dev == phys_dev) && (gf->ino == st->st_ino)) goto dump_entry; diff --git a/include/mount.h b/include/mount.h index 876928ac5..e8989e7d8 100644 --- a/include/mount.h +++ b/include/mount.h @@ -26,8 +26,7 @@ extern struct mount_info *lookup_mnt_sdev(unsigned int s_dev); extern struct ns_desc mnt_ns_desc; -extern dev_t phys_stat_resolve_dev(struct mount_info *tree, - dev_t st_dev, const char *path); +extern dev_t phys_stat_resolve_dev(struct ns_id *, dev_t st_dev, const char *path); extern bool phys_stat_dev_match(dev_t st_dev, dev_t phys_dev, struct ns_id *, const char *path); diff --git a/mount.c b/mount.c index 58e4d8fc7..ef52bfa61 100644 --- a/mount.c +++ b/mount.c @@ -192,12 +192,11 @@ static struct mount_info *mount_resolve_path(struct mount_info *mntinfo_tree, co return m; } -dev_t phys_stat_resolve_dev(struct mount_info *tree, - dev_t st_dev, const char *path) +dev_t phys_stat_resolve_dev(struct ns_id *ns, dev_t st_dev, const char *path) { struct mount_info *m; - m = mount_resolve_path(tree, path); + m = mount_resolve_path(ns->mnt.mntinfo_tree, path); /* * BTRFS returns subvolume dev-id instead of * superblock dev-id, in such case return device @@ -213,7 +212,7 @@ bool phys_stat_dev_match(dev_t st_dev, dev_t phys_dev, if (st_dev == kdev_to_odev(phys_dev)) return true; - return phys_dev == phys_stat_resolve_dev(ns->mnt.mntinfo_tree, st_dev, path); + return phys_dev == phys_stat_resolve_dev(ns, st_dev, path); } /* @@ -580,7 +579,7 @@ static int __open_mountpoint(struct mount_info *pm, int mnt_fd) goto err; } - dev = phys_stat_resolve_dev(pm->nsid->mnt.mntinfo_tree, st.st_dev, pm->mountpoint + 1); + dev = phys_stat_resolve_dev(pm->nsid, st.st_dev, pm->mountpoint + 1); if (dev != pm->s_dev) { pr_err("The file system %#x (%#x) %s %s is inaccessible\n", pm->s_dev, (int)dev, pm->fstype->name, pm->mountpoint);