Commit d3d147ac authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] export lookup_create()

From: jbarnes@sgi.com (Jesse Barnes)

hwgfs needs lookup_create(), and intermezzo already has copied it.

Document it, export it to modules and fix intermezzo.
parent 88fbf07a
...@@ -664,28 +664,6 @@ int presto_do_create(struct presto_file_set *fset, struct dentry *dir, ...@@ -664,28 +664,6 @@ int presto_do_create(struct presto_file_set *fset, struct dentry *dir,
return error; return error;
} }
/* from namei.c */
static struct dentry *lookup_create(struct nameidata *nd, int is_dir)
{
struct dentry *dentry;
down(&nd->dentry->d_inode->i_sem);
dentry = ERR_PTR(-EEXIST);
if (nd->last_type != LAST_NORM)
goto fail;
dentry = lookup_hash(&nd->last, nd->dentry);
if (IS_ERR(dentry))
goto fail;
if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode)
goto enoent;
return dentry;
enoent:
dput(dentry);
dentry = ERR_PTR(-ENOENT);
fail:
return dentry;
}
int lento_create(const char *name, int mode, struct lento_vfs_context *info) int lento_create(const char *name, int mode, struct lento_vfs_context *info)
{ {
int error; int error;
......
...@@ -1375,8 +1375,15 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd) ...@@ -1375,8 +1375,15 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
goto do_last; goto do_last;
} }
/* SMP-safe */ /**
static struct dentry *lookup_create(struct nameidata *nd, int is_dir) * lookup_create - lookup a dentry, creating it if it doesn't exist
* @nd: nameidata info
* @is_dir: directory flag
*
* Simple function to lookup and return a dentry and create it
* if it doesn't exist. Is SMP-safe.
*/
struct dentry *lookup_create(struct nameidata *nd, int is_dir)
{ {
struct dentry *dentry; struct dentry *dentry;
......
...@@ -309,6 +309,8 @@ static inline int d_mountpoint(struct dentry *dentry) ...@@ -309,6 +309,8 @@ static inline int d_mountpoint(struct dentry *dentry)
} }
extern struct vfsmount *lookup_mnt(struct vfsmount *, struct dentry *); extern struct vfsmount *lookup_mnt(struct vfsmount *, struct dentry *);
extern struct dentry *lookup_create(struct nameidata *nd, int is_dir);
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* __LINUX_DCACHE_H */ #endif /* __LINUX_DCACHE_H */
...@@ -157,6 +157,7 @@ EXPORT_SYMBOL(inode_init_once); ...@@ -157,6 +157,7 @@ EXPORT_SYMBOL(inode_init_once);
EXPORT_SYMBOL(follow_up); EXPORT_SYMBOL(follow_up);
EXPORT_SYMBOL(follow_down); EXPORT_SYMBOL(follow_down);
EXPORT_SYMBOL(lookup_mnt); EXPORT_SYMBOL(lookup_mnt);
EXPORT_SYMBOL(lookup_create);
EXPORT_SYMBOL(path_lookup); EXPORT_SYMBOL(path_lookup);
EXPORT_SYMBOL(path_walk); EXPORT_SYMBOL(path_walk);
EXPORT_SYMBOL(path_release); EXPORT_SYMBOL(path_release);
......
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