linux-unionfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Matthew Wilcox <willy@infradead.org>
Cc: "Miklos Szeredi" <mszeredi@redhat.com>,
	linux-fsdevel@vger.kernel.org, linux-unionfs@vger.kernel.org,
	"André Almeida" <andrealmeid@igalia.com>,
	"John Schoenick" <johns@valvesoftware.com>
Subject: Re: [PATCH] vfs: change 'struct file *' argument to 'const struct file *' where possible
Date: Mon, 5 May 2025 18:29:00 +0100	[thread overview]
Message-ID: <20250505172900.GF2023217@ZenIV> (raw)
In-Reply-To: <aBjm9khhIBOUTFcV@casper.infradead.org>

On Mon, May 05, 2025 at 05:27:34PM +0100, Matthew Wilcox wrote:
> On Mon, May 05, 2025 at 05:41:47PM +0200, Miklos Szeredi wrote:
> > -static inline struct backing_file *backing_file(struct file *f)
> > +#define backing_file(f) container_of(f, struct backing_file, file)
> > +
> > +struct path *backing_file_user_path(struct file *f)
> >  {
> > -	return container_of(f, struct backing_file, file);
> > +	return &backing_file(f)->user_path;
> >  }
> >  
> > -struct path *backing_file_user_path(struct file *f)
> > +const struct path *backing_file_user_path_c(const struct file *f)
> >  {
> >  	return &backing_file(f)->user_path;
> >  }
> > -EXPORT_SYMBOL_GPL(backing_file_user_path);
> > +EXPORT_SYMBOL_GPL(backing_file_user_path_c);
> 
> May I suggest:
> 
> #define backing_file_user_path(f)	(_Generic((f),		\
> 	const struct file *:	(const struct path *)&backing_file(f)->user_path,  \
> 	struct file *:		(struct path *)&backing_file(f)->user_path)))

Um...  You do realize that backing_file_user_path() has users in places
that do *NOT* see the definition of struct backing_file?

      reply	other threads:[~2025-05-05 17:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-05 15:41 [PATCH] vfs: change 'struct file *' argument to 'const struct file *' where possible Miklos Szeredi
2025-05-05 16:27 ` Matthew Wilcox
2025-05-05 17:29   ` Al Viro [this message]

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 \
    --in-reply-to=20250505172900.GF2023217@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=andrealmeid@igalia.com \
    --cc=johns@valvesoftware.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=mszeredi@redhat.com \
    --cc=willy@infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).