diff mbox series

[v12,01/17] fs: export rw_verify_area()

Message ID 11bc0fc15490afc6ce15c405cca3e16582f2f0ec.1637179348.git.osandov@fb.com (mailing list archive)
State New, archived
Headers show
Series btrfs: add ioctls and send/receive support for reading/writing compressed data | expand

Commit Message

Omar Sandoval Nov. 17, 2021, 8:19 p.m. UTC
From: Omar Sandoval <osandov@fb.com>

I'm adding Btrfs ioctls to read and write compressed data, and rather
than duplicating the checks in rw_verify_area(), let's just export it.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
---
 fs/internal.h      | 5 -----
 fs/read_write.c    | 1 +
 include/linux/fs.h | 1 +
 3 files changed, 2 insertions(+), 5 deletions(-)

Comments

David Sterba Nov. 18, 2021, 2:57 p.m. UTC | #1
On Wed, Nov 17, 2021 at 12:19:11PM -0800, Omar Sandoval wrote:
> From: Omar Sandoval <osandov@fb.com>
> 
> I'm adding Btrfs ioctls to read and write compressed data, and rather
> than duplicating the checks in rw_verify_area(), let's just export it.
> 
> Reviewed-by: Josef Bacik <josef@toxicpanda.com>
> Signed-off-by: Omar Sandoval <osandov@fb.com>
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -3244,6 +3244,7 @@ extern loff_t fixed_size_llseek(struct file *file, loff_t offset,
>  		int whence, loff_t size);
>  extern loff_t no_seek_end_llseek_size(struct file *, loff_t, int, loff_t);
>  extern loff_t no_seek_end_llseek(struct file *, loff_t, int);
> +extern int rw_verify_area(int, struct file *, const loff_t *, size_t);

Do you have an ack from VFS people for exporting a function from
fs/interna.h to the normal fs.h?

>  extern int generic_file_open(struct inode * inode, struct file * filp);
>  extern int nonseekable_open(struct inode * inode, struct file * filp);
>  extern int stream_open(struct inode * inode, struct file * filp);
> -- 
> 2.34.0
Omar Sandoval Nov. 18, 2021, 7:15 p.m. UTC | #2
On Thu, Nov 18, 2021 at 03:57:14PM +0100, David Sterba wrote:
> On Wed, Nov 17, 2021 at 12:19:11PM -0800, Omar Sandoval wrote:
> > From: Omar Sandoval <osandov@fb.com>
> > 
> > I'm adding Btrfs ioctls to read and write compressed data, and rather
> > than duplicating the checks in rw_verify_area(), let's just export it.
> > 
> > Reviewed-by: Josef Bacik <josef@toxicpanda.com>
> > Signed-off-by: Omar Sandoval <osandov@fb.com>
> > --- a/include/linux/fs.h
> > +++ b/include/linux/fs.h
> > @@ -3244,6 +3244,7 @@ extern loff_t fixed_size_llseek(struct file *file, loff_t offset,
> >  		int whence, loff_t size);
> >  extern loff_t no_seek_end_llseek_size(struct file *, loff_t, int, loff_t);
> >  extern loff_t no_seek_end_llseek(struct file *, loff_t, int);
> > +extern int rw_verify_area(int, struct file *, const loff_t *, size_t);
> 
> Do you have an ack from VFS people for exporting a function from
> fs/interna.h to the normal fs.h?

Nope, although I've sent it enough times that they should've nacked it
by now if they cared. I guess I didn't cc fsdevel on this version, so
I'll ping this patch on v11.
diff mbox series

Patch

diff --git a/fs/internal.h b/fs/internal.h
index 7979ff8d168c..8e400574401e 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -157,11 +157,6 @@  extern char *simple_dname(struct dentry *, char *, int);
 extern void dput_to_list(struct dentry *, struct list_head *);
 extern void shrink_dentry_list(struct list_head *);
 
-/*
- * read_write.c
- */
-extern int rw_verify_area(int, struct file *, const loff_t *, size_t);
-
 /*
  * pipe.c
  */
diff --git a/fs/read_write.c b/fs/read_write.c
index 0074afa7ecb3..4d60146243df 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -385,6 +385,7 @@  int rw_verify_area(int read_write, struct file *file, const loff_t *ppos, size_t
 	return security_file_permission(file,
 				read_write == READ ? MAY_READ : MAY_WRITE);
 }
+EXPORT_SYMBOL(rw_verify_area);
 
 static ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos)
 {
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 1cb616fc1105..364940c6a299 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3244,6 +3244,7 @@  extern loff_t fixed_size_llseek(struct file *file, loff_t offset,
 		int whence, loff_t size);
 extern loff_t no_seek_end_llseek_size(struct file *, loff_t, int, loff_t);
 extern loff_t no_seek_end_llseek(struct file *, loff_t, int);
+extern int rw_verify_area(int, struct file *, const loff_t *, size_t);
 extern int generic_file_open(struct inode * inode, struct file * filp);
 extern int nonseekable_open(struct inode * inode, struct file * filp);
 extern int stream_open(struct inode * inode, struct file * filp);