public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vfs: fix docstring of hash_name()
@ 2026-03-12 11:28 Jori Koolstra
  2026-03-17  8:43 ` Jan Kara
  0 siblings, 1 reply; 3+ messages in thread
From: Jori Koolstra @ 2026-03-12 11:28 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Jan Kara
  Cc: Jori Koolstra, open list:FILESYSTEMS (VFS and infrastructure),
	open list

The docstring of hash_name() is falsely reporting that it returns the
component length, whereas it returns a pointer to the terminating '/'
or NUL character in the pathname being resolved.

Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
 fs/namei.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 58f715f7657e..d020b077591b 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2437,8 +2437,13 @@ u64 hashlen_string(const void *salt, const char *name)
 EXPORT_SYMBOL(hashlen_string);
 
 /*
- * Calculate the length and hash of the path component, and
- * return the length as the result.
+ * hash_name - Calculate the length and hash of the path component
+ * @nd: the path resolution state
+ * @name: the pathname to read the component from
+ * @lastword: if the component fits in a single word, the component bytes,
+ * otherwise 0
+ *
+ * Returns: a pointer to the terminating '/' or NUL character in @name.
  */
 static inline const char *hash_name(struct nameidata *nd,
 				    const char *name,
-- 
2.53.0


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

* Re: [PATCH] vfs: fix docstring of hash_name()
  2026-03-12 11:28 [PATCH] vfs: fix docstring of hash_name() Jori Koolstra
@ 2026-03-17  8:43 ` Jan Kara
  2026-03-18 20:41   ` Jori Koolstra
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2026-03-17  8:43 UTC (permalink / raw)
  To: Jori Koolstra
  Cc: Alexander Viro, Christian Brauner, Jan Kara,
	open list:FILESYSTEMS (VFS and infrastructure), open list

On Thu 12-03-26 12:28:22, Jori Koolstra wrote:
> The docstring of hash_name() is falsely reporting that it returns the
> component length, whereas it returns a pointer to the terminating '/'
> or NUL character in the pathname being resolved.
> 
> Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
> ---
>  fs/namei.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/namei.c b/fs/namei.c
> index 58f715f7657e..d020b077591b 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -2437,8 +2437,13 @@ u64 hashlen_string(const void *salt, const char *name)
>  EXPORT_SYMBOL(hashlen_string);
>  
>  /*
> - * Calculate the length and hash of the path component, and
> - * return the length as the result.
> + * hash_name - Calculate the length and hash of the path component
> + * @nd: the path resolution state
> + * @name: the pathname to read the component from
> + * @lastword: if the component fits in a single word, the component bytes,
> + * otherwise 0

The @lastword description is what the function does but not really the
point of the parameter. I think more understandable description would be:
LAST_WORD_IS_DOT, LAST_WORD_IS_DOTDOT, or some other value depending on
whether the component is '.', '..', or something else.

Otherwise the fix looks good.

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

* Re: [PATCH] vfs: fix docstring of hash_name()
  2026-03-17  8:43 ` Jan Kara
@ 2026-03-18 20:41   ` Jori Koolstra
  0 siblings, 0 replies; 3+ messages in thread
From: Jori Koolstra @ 2026-03-18 20:41 UTC (permalink / raw)
  To: Jan Kara
  Cc: Alexander Viro, Christian Brauner,
	open list:FILESYSTEMS (VFS and infrastructure), open list


> Op 17-03-2026 09:43 CET schreef Jan Kara <jack@suse.cz>:
> 
>  
> On Thu 12-03-26 12:28:22, Jori Koolstra wrote:
> > The docstring of hash_name() is falsely reporting that it returns the
> > component length, whereas it returns a pointer to the terminating '/'
> > or NUL character in the pathname being resolved.
> > 
> > Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
> > ---
> >  fs/namei.c | 9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/namei.c b/fs/namei.c
> > index 58f715f7657e..d020b077591b 100644
> > --- a/fs/namei.c
> > +++ b/fs/namei.c
> > @@ -2437,8 +2437,13 @@ u64 hashlen_string(const void *salt, const char *name)
> >  EXPORT_SYMBOL(hashlen_string);
> >  
> >  /*
> > - * Calculate the length and hash of the path component, and
> > - * return the length as the result.
> > + * hash_name - Calculate the length and hash of the path component
> > + * @nd: the path resolution state
> > + * @name: the pathname to read the component from
> > + * @lastword: if the component fits in a single word, the component bytes,
> > + * otherwise 0
> 
> The @lastword description is what the function does but not really the
> point of the parameter. I think more understandable description would be:
> LAST_WORD_IS_DOT, LAST_WORD_IS_DOTDOT, or some other value depending on
> whether the component is '.', '..', or something else.
> 
> Otherwise the fix looks good.

Thanks, Jan. I incorporated your suggestion and sent it again. I really appreciate it!

> 
> 								Honza
> -- 
> Jan Kara <jack@suse.com>
> SUSE Labs, CR

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

end of thread, other threads:[~2026-03-18 20:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-12 11:28 [PATCH] vfs: fix docstring of hash_name() Jori Koolstra
2026-03-17  8:43 ` Jan Kara
2026-03-18 20:41   ` Jori Koolstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox