linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] make lookup_create non-static
@ 2003-08-04 21:35 Jesse Barnes
  2003-08-04 21:41 ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Jesse Barnes @ 2003-08-04 21:35 UTC (permalink / raw)
  To: akpm, linux-kernel

Make lookup_create non-static for use by certain pseudofilesystems (e.g.
hwgfs).

Thanks,
Jesse

===== fs/namei.c 1.81 vs edited =====
--- 1.81/fs/namei.c	Thu Jul 10 22:23:45 2003
+++ edited/fs/namei.c	Mon Aug  4 14:32:19 2003
@@ -1376,7 +1376,7 @@
 }
 
 /* SMP-safe */
-static struct dentry *lookup_create(struct nameidata *nd, int is_dir)
+struct dentry *lookup_create(struct nameidata *nd, int is_dir)
 {
 	struct dentry *dentry;
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] make lookup_create non-static
  2003-08-04 21:35 [PATCH] make lookup_create non-static Jesse Barnes
@ 2003-08-04 21:41 ` Andrew Morton
  2003-08-04 21:44   ` Jesse Barnes
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2003-08-04 21:41 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: linux-kernel

jbarnes@sgi.com (Jesse Barnes) wrote:
>
>  Make lookup_create non-static for use by certain pseudofilesystems (e.g.
>  hwgfs).

If one is patching ones kernel with hwgfs, once can include this chunk in
that patch, no?



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] make lookup_create non-static
  2003-08-04 21:41 ` Andrew Morton
@ 2003-08-04 21:44   ` Jesse Barnes
  2003-08-04 21:57     ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Jesse Barnes @ 2003-08-04 21:44 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

On Mon, Aug 04, 2003 at 02:41:29PM -0700, Andrew Morton wrote:
> jbarnes@sgi.com (Jesse Barnes) wrote:
> >
> >  Make lookup_create non-static for use by certain pseudofilesystems (e.g.
> >  hwgfs).
> 
> If one is patching ones kernel with hwgfs, once can include this chunk in
> that patch, no?

You mean copy lookup_create into hwgfs (which is already in the tree,
btw)?  Yeah, I guess I could do that if you don't want to take this.

Thanks,
Jesse

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] make lookup_create non-static
  2003-08-04 21:44   ` Jesse Barnes
@ 2003-08-04 21:57     ` Andrew Morton
  2003-08-04 22:30       ` Jesse Barnes
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2003-08-04 21:57 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: linux-kernel

jbarnes@sgi.com (Jesse Barnes) wrote:
>
> You mean copy lookup_create into hwgfs (which is already in the tree,
>  btw)?  Yeah, I guess I could do that if you don't want to take this.

ah, I thought you were referring to an out-of-tree filesystem.

It would appear that intermezzo has already created a private copy of
lookup_create().  Sigh.

If we're going to export this thing to filesystems then it really should be
documented a bit.  You could bribe me with a patch which does that ;)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] make lookup_create non-static
  2003-08-04 21:57     ` Andrew Morton
@ 2003-08-04 22:30       ` Jesse Barnes
  2003-08-04 22:39         ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Jesse Barnes @ 2003-08-04 22:30 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

On Mon, Aug 04, 2003 at 02:57:23PM -0700, Andrew Morton wrote:
> jbarnes@sgi.com (Jesse Barnes) wrote:
> >
> > You mean copy lookup_create into hwgfs (which is already in the tree,
> >  btw)?  Yeah, I guess I could do that if you don't want to take this.
> 
> ah, I thought you were referring to an out-of-tree filesystem.
> 
> It would appear that intermezzo has already created a private copy of
> lookup_create().  Sigh.
> 
> If we're going to export this thing to filesystems then it really should be
> documented a bit.  You could bribe me with a patch which does that ;)

Ok, how does this look?

Jesse


===== fs/namei.c 1.81 vs edited =====
--- 1.81/fs/namei.c	Thu Jul 10 22:23:45 2003
+++ edited/fs/namei.c	Mon Aug  4 15:28:38 2003
@@ -1375,8 +1375,15 @@
 	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;
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] make lookup_create non-static
  2003-08-04 22:30       ` Jesse Barnes
@ 2003-08-04 22:39         ` Andrew Morton
  2003-08-04 22:40           ` Jesse Barnes
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2003-08-04 22:39 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: linux-kernel

jbarnes@sgi.com (Jesse Barnes) wrote:
>
> Ok, how does this look?

OK.  I grew it a bit:


 fs/intermezzo/vfs.c    |   22 ----------------------
 fs/namei.c             |   11 +++++++++--
 include/linux/dcache.h |    2 ++
 include/linux/fs.h     |    0 
 kernel/ksyms.c         |    1 +
 5 files changed, 12 insertions(+), 24 deletions(-)

diff -puN fs/namei.c~export-lookup_create fs/namei.c
--- 25/fs/namei.c~export-lookup_create	2003-08-04 15:36:39.000000000 -0700
+++ 25-akpm/fs/namei.c	2003-08-04 15:36:39.000000000 -0700
@@ -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;
 
diff -puN include/linux/fs.h~export-lookup_create include/linux/fs.h
diff -puN include/linux/dcache.h~export-lookup_create include/linux/dcache.h
--- 25/include/linux/dcache.h~export-lookup_create	2003-08-04 15:38:18.000000000 -0700
+++ 25-akpm/include/linux/dcache.h	2003-08-04 15:38:35.000000000 -0700
@@ -309,6 +309,8 @@ static inline int d_mountpoint(struct de
 }
 
 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 */
diff -puN kernel/ksyms.c~export-lookup_create kernel/ksyms.c
--- 25/kernel/ksyms.c~export-lookup_create	2003-08-04 15:38:40.000000000 -0700
+++ 25-akpm/kernel/ksyms.c	2003-08-04 15:38:52.000000000 -0700
@@ -156,6 +156,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);
diff -puN fs/intermezzo/vfs.c~export-lookup_create fs/intermezzo/vfs.c
--- 25/fs/intermezzo/vfs.c~export-lookup_create	2003-08-04 15:38:56.000000000 -0700
+++ 25-akpm/fs/intermezzo/vfs.c	2003-08-04 15:39:02.000000000 -0700
@@ -664,28 +664,6 @@ int presto_do_create(struct presto_file_
         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;

_


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] make lookup_create non-static
  2003-08-04 22:39         ` Andrew Morton
@ 2003-08-04 22:40           ` Jesse Barnes
  0 siblings, 0 replies; 7+ messages in thread
From: Jesse Barnes @ 2003-08-04 22:40 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

Much better.  Thanks.

Jesse

On Mon, Aug 04, 2003 at 03:39:38PM -0700, Andrew Morton wrote:
> jbarnes@sgi.com (Jesse Barnes) wrote:
> >
> > Ok, how does this look?
> 
> OK.  I grew it a bit:
> 
> 
>  fs/intermezzo/vfs.c    |   22 ----------------------
>  fs/namei.c             |   11 +++++++++--
>  include/linux/dcache.h |    2 ++
>  include/linux/fs.h     |    0 
>  kernel/ksyms.c         |    1 +
>  5 files changed, 12 insertions(+), 24 deletions(-)
> 
> diff -puN fs/namei.c~export-lookup_create fs/namei.c
> --- 25/fs/namei.c~export-lookup_create	2003-08-04 15:36:39.000000000 -0700
> +++ 25-akpm/fs/namei.c	2003-08-04 15:36:39.000000000 -0700
> @@ -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;
>  
> diff -puN include/linux/fs.h~export-lookup_create include/linux/fs.h
> diff -puN include/linux/dcache.h~export-lookup_create include/linux/dcache.h
> --- 25/include/linux/dcache.h~export-lookup_create	2003-08-04 15:38:18.000000000 -0700
> +++ 25-akpm/include/linux/dcache.h	2003-08-04 15:38:35.000000000 -0700
> @@ -309,6 +309,8 @@ static inline int d_mountpoint(struct de
>  }
>  
>  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 */
> diff -puN kernel/ksyms.c~export-lookup_create kernel/ksyms.c
> --- 25/kernel/ksyms.c~export-lookup_create	2003-08-04 15:38:40.000000000 -0700
> +++ 25-akpm/kernel/ksyms.c	2003-08-04 15:38:52.000000000 -0700
> @@ -156,6 +156,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);
> diff -puN fs/intermezzo/vfs.c~export-lookup_create fs/intermezzo/vfs.c
> --- 25/fs/intermezzo/vfs.c~export-lookup_create	2003-08-04 15:38:56.000000000 -0700
> +++ 25-akpm/fs/intermezzo/vfs.c	2003-08-04 15:39:02.000000000 -0700
> @@ -664,28 +664,6 @@ int presto_do_create(struct presto_file_
>          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;
> 
> _

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-08-04 22:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-04 21:35 [PATCH] make lookup_create non-static Jesse Barnes
2003-08-04 21:41 ` Andrew Morton
2003-08-04 21:44   ` Jesse Barnes
2003-08-04 21:57     ` Andrew Morton
2003-08-04 22:30       ` Jesse Barnes
2003-08-04 22:39         ` Andrew Morton
2003-08-04 22:40           ` Jesse Barnes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).