linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] let kernfs_name_locked & kernfs_name return size_t
@ 2016-02-10 16:18 Christian Brauner
  2016-02-10 16:18 ` Christian Brauner
  0 siblings, 1 reply; 6+ messages in thread
From: Christian Brauner @ 2016-02-10 16:18 UTC (permalink / raw)
  To: tj, gregkh, linux-kernel; +Cc: Christian Brauner

Simple patch that changes the return value of kernfs_name_locked and kernfs_name
to size_t which alignes these functions with kernfs_path_len which also returns
size_t.

Patch was made against for-4.5 branch.
(As per Tejun's request, ccing gregkh@linuxfoundation.org and
 linux-kernel@vger.kernel.org.)

Christian Brauner (1):
  let kernfs_name_locked & kernfs_name return size_t

 fs/kernfs/dir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.7.0

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

* [PATCH] let kernfs_name_locked & kernfs_name return size_t
  2016-02-10 16:18 [PATCH] let kernfs_name_locked & kernfs_name return size_t Christian Brauner
@ 2016-02-10 16:18 ` Christian Brauner
  2016-02-10 16:26   ` Tejun Heo
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Christian Brauner @ 2016-02-10 16:18 UTC (permalink / raw)
  To: tj, gregkh, linux-kernel; +Cc: Christian Brauner

They return the length of kn->parent or kn->name and should be aligned with
kernfs_path_len which also returns size_t.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
---
 fs/kernfs/dir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 742bf4a..a3553b8 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -39,7 +39,7 @@ static bool kernfs_lockdep(struct kernfs_node *kn)
 #endif
 }
 
-static int kernfs_name_locked(struct kernfs_node *kn, char *buf, size_t buflen)
+static size_t kernfs_name_locked(struct kernfs_node *kn, char *buf, size_t buflen)
 {
 	return strlcpy(buf, kn->parent ? kn->name : "/", buflen);
 }
@@ -80,7 +80,7 @@ static char * __must_check kernfs_path_locked(struct kernfs_node *kn, char *buf,
  *
  * This function can be called from any context.
  */
-int kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen)
+size_t kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen)
 {
 	unsigned long flags;
 	int ret;
-- 
2.7.0

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

* Re: [PATCH] let kernfs_name_locked & kernfs_name return size_t
  2016-02-10 16:18 ` Christian Brauner
@ 2016-02-10 16:26   ` Tejun Heo
  2016-02-10 16:41   ` kbuild test robot
  2016-02-10 16:53   ` Greg KH
  2 siblings, 0 replies; 6+ messages in thread
From: Tejun Heo @ 2016-02-10 16:26 UTC (permalink / raw)
  To: Christian Brauner; +Cc: gregkh, linux-kernel

On Wed, Feb 10, 2016 at 05:18:59PM +0100, Christian Brauner wrote:
> They return the length of kn->parent or kn->name and should be aligned with
> kernfs_path_len which also returns size_t.
> 
> Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>

Acked-by: Tejun Heo <tj@kernel.org>

Thanks.

-- 
tejun

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

* Re: [PATCH] let kernfs_name_locked & kernfs_name return size_t
  2016-02-10 16:18 ` Christian Brauner
  2016-02-10 16:26   ` Tejun Heo
@ 2016-02-10 16:41   ` kbuild test robot
  2016-02-10 16:53   ` Greg KH
  2 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2016-02-10 16:41 UTC (permalink / raw)
  To: Christian Brauner; +Cc: kbuild-all, tj, gregkh, linux-kernel, Christian Brauner

[-- Attachment #1: Type: text/plain, Size: 1620 bytes --]

Hi Christian,

[auto build test ERROR on driver-core/driver-core-testing]
[also build test ERROR on v4.5-rc3 next-20160210]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Christian-Brauner/let-kernfs_name_locked-kernfs_name-return-size_t/20160211-002314
config: x86_64-randconfig-x012-201606 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

>> fs/kernfs/dir.c:83:8: error: conflicting types for 'kernfs_name'
    size_t kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen)
           ^
   In file included from fs/kernfs/kernfs-internal.h:19:0,
                    from fs/kernfs/dir.c:19:
   include/linux/kernfs.h:268:5: note: previous declaration of 'kernfs_name' was here
    int kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen);
        ^

vim +/kernfs_name +83 fs/kernfs/dir.c

    77	 * Copies the name of @kn into @buf of @buflen bytes.  The behavior is
    78	 * similar to strlcpy().  It returns the length of @kn's name and if @buf
    79	 * isn't long enough, it's filled upto @buflen-1 and nul terminated.
    80	 *
    81	 * This function can be called from any context.
    82	 */
  > 83	size_t kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen)
    84	{
    85		unsigned long flags;
    86		int ret;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 30599 bytes --]

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

* Re: [PATCH] let kernfs_name_locked & kernfs_name return size_t
  2016-02-10 16:18 ` Christian Brauner
  2016-02-10 16:26   ` Tejun Heo
  2016-02-10 16:41   ` kbuild test robot
@ 2016-02-10 16:53   ` Greg KH
  2016-02-10 17:12     ` Christian Brauner
  2 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2016-02-10 16:53 UTC (permalink / raw)
  To: Christian Brauner; +Cc: tj, linux-kernel

On Wed, Feb 10, 2016 at 05:18:59PM +0100, Christian Brauner wrote:
> They return the length of kn->parent or kn->name and should be aligned with
> kernfs_path_len which also returns size_t.
> 
> Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
> ---
>  fs/kernfs/dir.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
> index 742bf4a..a3553b8 100644
> --- a/fs/kernfs/dir.c
> +++ b/fs/kernfs/dir.c
> @@ -39,7 +39,7 @@ static bool kernfs_lockdep(struct kernfs_node *kn)
>  #endif
>  }
>  
> -static int kernfs_name_locked(struct kernfs_node *kn, char *buf, size_t buflen)
> +static size_t kernfs_name_locked(struct kernfs_node *kn, char *buf, size_t buflen)
>  {
>  	return strlcpy(buf, kn->parent ? kn->name : "/", buflen);
>  }
> @@ -80,7 +80,7 @@ static char * __must_check kernfs_path_locked(struct kernfs_node *kn, char *buf,
>   *
>   * This function can be called from any context.
>   */
> -int kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen)
> +size_t kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen)
>  {
>  	unsigned long flags;
>  	int ret;

Now if only you had test built this patch :(

Please be more careful, it just makes maintainers grumpy and annoyed
when you do that...

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

* Re: [PATCH] let kernfs_name_locked & kernfs_name return size_t
  2016-02-10 16:53   ` Greg KH
@ 2016-02-10 17:12     ` Christian Brauner
  0 siblings, 0 replies; 6+ messages in thread
From: Christian Brauner @ 2016-02-10 17:12 UTC (permalink / raw)
  To: Greg KH; +Cc: tj, linux-kernel

On Wed, Feb 10, 2016 at 08:53:14AM -0800, Greg KH wrote:
> On Wed, Feb 10, 2016 at 05:18:59PM +0100, Christian Brauner wrote:
> > They return the length of kn->parent or kn->name and should be aligned with
> > kernfs_path_len which also returns size_t.
> > 
> > Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
> > ---
> >  fs/kernfs/dir.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
> > index 742bf4a..a3553b8 100644
> > --- a/fs/kernfs/dir.c
> > +++ b/fs/kernfs/dir.c
> > @@ -39,7 +39,7 @@ static bool kernfs_lockdep(struct kernfs_node *kn)
> >  #endif
> >  }
> >  
> > -static int kernfs_name_locked(struct kernfs_node *kn, char *buf, size_t buflen)
> > +static size_t kernfs_name_locked(struct kernfs_node *kn, char *buf, size_t buflen)
> >  {
> >  	return strlcpy(buf, kn->parent ? kn->name : "/", buflen);
> >  }
> > @@ -80,7 +80,7 @@ static char * __must_check kernfs_path_locked(struct kernfs_node *kn, char *buf,
> >   *
> >   * This function can be called from any context.
> >   */
> > -int kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen)
> > +size_t kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen)
> >  {
> >  	unsigned long flags;
> >  	int ret;
> 
> Now if only you had test built this patch :(
I actually did but forgot to commit the changes to include/linux/kernfs.h as
well.
> 
> Please be more careful, it just makes maintainers grumpy and annoyed
> when you do that...
Yes, sorry. I will do that. I'll resend with the appropriate changes
to kernfs.h included. Thanks for being patient.

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

end of thread, other threads:[~2016-02-10 17:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-10 16:18 [PATCH] let kernfs_name_locked & kernfs_name return size_t Christian Brauner
2016-02-10 16:18 ` Christian Brauner
2016-02-10 16:26   ` Tejun Heo
2016-02-10 16:41   ` kbuild test robot
2016-02-10 16:53   ` Greg KH
2016-02-10 17:12     ` Christian Brauner

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).