]> git.hungrycats.org Git - linux/commitdiff
[PATCH] export lookup_create()
authorAndrew Morton <akpm@osdl.org>
Thu, 7 Aug 2003 04:14:13 +0000 (21:14 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Thu, 7 Aug 2003 04:14:13 +0000 (21:14 -0700)
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.

fs/intermezzo/vfs.c
fs/namei.c
include/linux/dcache.h
kernel/ksyms.c

index 385e1bd80b600164013f35cd8da60c5b8e68c96a..6629dff1c8743c161e32973b68552048fcd3396a 100644 (file)
@@ -664,28 +664,6 @@ int presto_do_create(struct presto_file_set *fset, struct dentry *dir,
         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 error;
index 8810138eaaec922967d224446dfe42859087d1e9..f9222360ac3bd36f49d142bb5a7959a764a336ba 100644 (file)
@@ -1375,8 +1375,15 @@ do_link:
        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;
 
index a25d9f0443a4895ce0bf188de032438b2b193406..6bd0570d3a1c87bc9b78f469d18c94d71de5723b 100644 (file)
@@ -309,6 +309,8 @@ static inline int d_mountpoint(struct dentry *dentry)
 }
 
 extern struct vfsmount *lookup_mnt(struct vfsmount *, struct dentry *);
+extern struct dentry *lookup_create(struct nameidata *nd, int is_dir);
+
 #endif /* __KERNEL__ */
 
 #endif /* __LINUX_DCACHE_H */
index 3763e8fac2fb740f90cf5f31a2d05d3d09ed5857..5fd68e235ff7c53b47f51593addce853226c7ab3 100644 (file)
@@ -157,6 +157,7 @@ EXPORT_SYMBOL(inode_init_once);
 EXPORT_SYMBOL(follow_up);
 EXPORT_SYMBOL(follow_down);
 EXPORT_SYMBOL(lookup_mnt);
+EXPORT_SYMBOL(lookup_create);
 EXPORT_SYMBOL(path_lookup);
 EXPORT_SYMBOL(path_walk);
 EXPORT_SYMBOL(path_release);