mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
d_path: Make get_dcookie() use a struct path argument
get_dcookie() is always called with a dentry and a vfsmount from a struct path. Make get_dcookie() take it directly as an argument. [[email protected]: coding-style fixes] Signed-off-by: Jan Blunck <[email protected]> Acked-by: Christoph Hellwig <[email protected]> Cc: Al Viro <[email protected]> Cc: "J. Bruce Fields" <[email protected]> Cc: Neil Brown <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
3dcd25f37c
commit
448678a0f3
4 changed files with 37 additions and 48 deletions
|
|
@ -24,6 +24,7 @@
|
|||
#include <linux/errno.h>
|
||||
#include <linux/dcookies.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/path.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
/* The dcookies are allocated from a kmem_cache and
|
||||
|
|
@ -31,8 +32,7 @@
|
|||
* code here is particularly performance critical
|
||||
*/
|
||||
struct dcookie_struct {
|
||||
struct dentry * dentry;
|
||||
struct vfsmount * vfsmnt;
|
||||
struct path path;
|
||||
struct list_head hash_list;
|
||||
};
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ static inline int is_live(void)
|
|||
/* The dentry is locked, its address will do for the cookie */
|
||||
static inline unsigned long dcookie_value(struct dcookie_struct * dcs)
|
||||
{
|
||||
return (unsigned long)dcs->dentry;
|
||||
return (unsigned long)dcs->path.dentry;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -89,19 +89,17 @@ static void hash_dcookie(struct dcookie_struct * dcs)
|
|||
}
|
||||
|
||||
|
||||
static struct dcookie_struct * alloc_dcookie(struct dentry * dentry,
|
||||
struct vfsmount * vfsmnt)
|
||||
static struct dcookie_struct *alloc_dcookie(struct path *path)
|
||||
{
|
||||
struct dcookie_struct * dcs = kmem_cache_alloc(dcookie_cache, GFP_KERNEL);
|
||||
struct dcookie_struct *dcs = kmem_cache_alloc(dcookie_cache,
|
||||
GFP_KERNEL);
|
||||
if (!dcs)
|
||||
return NULL;
|
||||
|
||||
dentry->d_cookie = dcs;
|
||||
|
||||
dcs->dentry = dget(dentry);
|
||||
dcs->vfsmnt = mntget(vfsmnt);
|
||||
path->dentry->d_cookie = dcs;
|
||||
dcs->path = *path;
|
||||
path_get(path);
|
||||
hash_dcookie(dcs);
|
||||
|
||||
return dcs;
|
||||
}
|
||||
|
||||
|
|
@ -109,8 +107,7 @@ static struct dcookie_struct * alloc_dcookie(struct dentry * dentry,
|
|||
/* This is the main kernel-side routine that retrieves the cookie
|
||||
* value for a dentry/vfsmnt pair.
|
||||
*/
|
||||
int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt,
|
||||
unsigned long * cookie)
|
||||
int get_dcookie(struct path *path, unsigned long *cookie)
|
||||
{
|
||||
int err = 0;
|
||||
struct dcookie_struct * dcs;
|
||||
|
|
@ -122,10 +119,10 @@ int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt,
|
|||
goto out;
|
||||
}
|
||||
|
||||
dcs = dentry->d_cookie;
|
||||
dcs = path->dentry->d_cookie;
|
||||
|
||||
if (!dcs)
|
||||
dcs = alloc_dcookie(dentry, vfsmnt);
|
||||
dcs = alloc_dcookie(path);
|
||||
|
||||
if (!dcs) {
|
||||
err = -ENOMEM;
|
||||
|
|
@ -174,7 +171,7 @@ asmlinkage long sys_lookup_dcookie(u64 cookie64, char __user * buf, size_t len)
|
|||
goto out;
|
||||
|
||||
/* FIXME: (deleted) ? */
|
||||
path = d_path(dcs->dentry, dcs->vfsmnt, kbuf, PAGE_SIZE);
|
||||
path = d_path(dcs->path.dentry, dcs->path.mnt, kbuf, PAGE_SIZE);
|
||||
|
||||
if (IS_ERR(path)) {
|
||||
err = PTR_ERR(path);
|
||||
|
|
@ -254,9 +251,8 @@ out_kmem:
|
|||
|
||||
static void free_dcookie(struct dcookie_struct * dcs)
|
||||
{
|
||||
dcs->dentry->d_cookie = NULL;
|
||||
dput(dcs->dentry);
|
||||
mntput(dcs->vfsmnt);
|
||||
dcs->path.dentry->d_cookie = NULL;
|
||||
path_put(&dcs->path);
|
||||
kmem_cache_free(dcookie_cache, dcs);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue