Re: [PATCH 1/2] fs: constify file ptr in backing_file accessor helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 11, 2025 at 8:57 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> On Sat, Jun 07, 2025 at 01:53:03PM +0200, Amir Goldstein wrote:
>
> > -struct path *backing_file_user_path(struct file *f)
> > +struct path *backing_file_user_path(const struct file *f)
> >  {
> >       return &backing_file(f)->user_path;
> >  }
> >  EXPORT_SYMBOL_GPL(backing_file_user_path);
>
> const struct path *, hopefully?  With separate backing_file_set_user_path()
> you shouldn't need to modify that struct path via that functions...

Doh! of course. overlooked.

Christian,

Could you please apply this (compile tested) change in your tree?

Thanks,
Amir.


diff --git a/fs/file_table.c b/fs/file_table.c
index f09d79a98111..b28bbfa07cb8 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -54,7 +54,7 @@ struct backing_file {

 #define backing_file(f) container_of(f, struct backing_file, file)

-struct path *backing_file_user_path(const struct file *f)
+const struct path *backing_file_user_path(const struct file *f)
 {
        return &backing_file(f)->user_path;
 }
diff --git a/include/linux/fs.h b/include/linux/fs.h
index fbcd74ae2a50..7845d029a4c0 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2864,7 +2864,7 @@ struct file *dentry_open_nonotify(const struct
path *path, int flags,
                                  const struct cred *cred);
 struct file *dentry_create(const struct path *path, int flags, umode_t mode,
                           const struct cred *cred);
-struct path *backing_file_user_path(const struct file *f);
+const struct path *backing_file_user_path(const struct file *f);





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux