public inbox for [email protected]
 help / color / mirror / Atom feed
From: Stefan Roesch <[email protected]>
To: Linus Torvalds <[email protected]>
Cc: io-uring <[email protected]>,
	linux-fsdevel <[email protected]>,
	Kernel Team <[email protected]>,
	Christian Brauner <[email protected]>
Subject: Re: [PATCH v7 2/5] fs: split off setxattr_copy and do_setxattr function from setxattr
Date: Thu, 23 Dec 2021 15:54:43 -0800	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAHk-=wjZ4YORKUBswiH5CZ5pukRju=k+Aby6pKwdgCbqXJP1Nw@mail.gmail.com>



On 12/23/21 12:11 PM, Linus Torvalds wrote:
> On Thu, Dec 23, 2021 at 11:57 AM Stefan Roesch <[email protected]> wrote:
>>
>> +       /* Attribute name */
>> +       char *kname;
>> +       int kname_sz;
> 
> I still don't like this.
> 
> Clearly the "just embed the kname in the context" didn't work, but I
> hate how this adds that "pointer and size", when the size really
> should be part of the type.
> 
> The patch takes what used to be a fixed size, and turns it into
> something we pass along as an argument - for no actual good reason.
> The 'size' isn't even the size of the name, it's literally the size of
> the allocation that has a fixed definition.
> 
> Can we perhaps do it another way, by just encoding the size in the
> type itself - but keeping it as a pointer.
> 
> We have a fixed size for attribute names, so maybe we can do
> 
>         struct xattr_name {
>                 char name[XATTR_NAME_MAX + 1];
>         };
> 
> and actually use that.
> 
> Because I don't see that kname_sz is ever validly anything else, and
> ever has any actual value to be passed around?
> 
> Maybe some day we'd actually make that "xattr_name" structure also
> have the actual length of the name in it, but that would still *not*
> be the size of the allocation.
> 
> I think it's actively misleading to have "kname_sz' that isn't
> actually the size of the name, but I also think it's stupid to have a
> variable for what is a constant value.
> 
>              Linus
> 

Linus, I added the xattr_name struct and removed the kname_sz field from
the xattr_ctx struct. In addition the xattr_name struct is used in xattr.c
and io_uring.c.


  reply	other threads:[~2021-12-23 23:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-23 19:56 [PATCH v7 0/5] io_uring: add xattr support Stefan Roesch
2021-12-23 19:56 ` [PATCH v7 1/5] fs: split off do_user_path_at_empty from user_path_at_empty() Stefan Roesch
2021-12-23 19:56 ` [PATCH v7 2/5] fs: split off setxattr_copy and do_setxattr function from setxattr Stefan Roesch
2021-12-23 20:11   ` Linus Torvalds
2021-12-23 23:54     ` Stefan Roesch [this message]
2021-12-23 19:56 ` [PATCH v7 3/5] fs: split off do_getxattr from getxattr Stefan Roesch
2021-12-23 19:56 ` [PATCH v7 4/5] io_uring: add fsetxattr and setxattr support Stefan Roesch
2021-12-23 19:56 ` [PATCH v7 5/5] io_uring: add fgetxattr and getxattr support Stefan Roesch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox