mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-06 14:31:46 +00:00
vfs: spread struct mount - __lookup_mnt() result
switch __lookup_mnt() to returning struct mount *; callers adjusted. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
7d6fec45a5
commit
c71053659e
5 changed files with 31 additions and 22 deletions
|
@ -464,20 +464,20 @@ static void free_vfsmnt(struct vfsmount *mnt)
|
|||
* @dir. If @dir is set return the first mount else return the last mount.
|
||||
* vfsmount_lock must be held for read or write.
|
||||
*/
|
||||
struct vfsmount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry,
|
||||
struct mount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry,
|
||||
int dir)
|
||||
{
|
||||
struct list_head *head = mount_hashtable + hash(mnt, dentry);
|
||||
struct list_head *tmp = head;
|
||||
struct vfsmount *p, *found = NULL;
|
||||
struct mount *p, *found = NULL;
|
||||
|
||||
for (;;) {
|
||||
tmp = dir ? tmp->next : tmp->prev;
|
||||
p = NULL;
|
||||
if (tmp == head)
|
||||
break;
|
||||
p = list_entry(tmp, struct vfsmount, mnt_hash);
|
||||
if (p->mnt_parent == mnt && p->mnt_mountpoint == dentry) {
|
||||
p = list_entry(tmp, struct mount, mnt.mnt_hash);
|
||||
if (p->mnt.mnt_parent == mnt && p->mnt.mnt_mountpoint == dentry) {
|
||||
found = p;
|
||||
break;
|
||||
}
|
||||
|
@ -491,13 +491,18 @@ struct vfsmount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry,
|
|||
*/
|
||||
struct vfsmount *lookup_mnt(struct path *path)
|
||||
{
|
||||
struct vfsmount *child_mnt;
|
||||
struct mount *child_mnt;
|
||||
|
||||
br_read_lock(vfsmount_lock);
|
||||
if ((child_mnt = __lookup_mnt(path->mnt, path->dentry, 1)))
|
||||
mntget(child_mnt);
|
||||
br_read_unlock(vfsmount_lock);
|
||||
return child_mnt;
|
||||
child_mnt = __lookup_mnt(path->mnt, path->dentry, 1);
|
||||
if (child_mnt) {
|
||||
mnt_add_count(child_mnt, 1);
|
||||
br_read_unlock(vfsmount_lock);
|
||||
return &child_mnt->mnt;
|
||||
} else {
|
||||
br_read_unlock(vfsmount_lock);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static inline int check_mnt(struct vfsmount *mnt)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue