Re: [PATCH 1/3] readfile: implement readfile syscall

2020-07-04 Thread Miklos Szeredi
On Sat, Jul 4, 2020 at 10:50 PM Alexey Dobriyan wrote: > > Al wrote: > > > > On Sat, Jul 04, 2020 at 09:41:09PM +0200, Miklos Szeredi wrote: > > > 1) just leave the first explanation (it's an open + read + close > > > equivalent) and leave out the rest > > > > > > 2) add a loop around the vfs_re

Re: [PATCH 1/3] readfile: implement readfile syscall

2020-07-04 Thread Alexey Dobriyan
Al wrote: > > On Sat, Jul 04, 2020 at 09:41:09PM +0200, Miklos Szeredi wrote: > > 1) just leave the first explanation (it's an open + read + close > > equivalent) and leave out the rest > > > > 2) add a loop around the vfs_read() in the code. > > 3) don't bother with the entire thing, until som

Re: [PATCH 1/3] readfile: implement readfile syscall

2020-07-04 Thread Al Viro
On Sat, Jul 04, 2020 at 09:12:06PM +0100, Al Viro wrote: > On Sat, Jul 04, 2020 at 09:41:09PM +0200, Miklos Szeredi wrote: > > And "If the size of file is smaller than the value provided in count > > then the whole file will be copied into buf", which is simply a lie; > > for example seq_file will

Re: [PATCH 1/3] readfile: implement readfile syscall

2020-07-04 Thread Al Viro
On Sat, Jul 04, 2020 at 09:41:09PM +0200, Miklos Szeredi wrote: > And "If the size of file is smaller than the value provided in count > then the whole file will be copied into buf", which is simply a lie; > for example seq_file will happily return a smaller-than-PAGE_SIZE > chunk if at least one r

Re: [PATCH 1/3] readfile: implement readfile syscall

2020-07-04 Thread Miklos Szeredi
On Sat, Jul 4, 2020 at 4:03 PM Greg Kroah-Hartman wrote: > > It's a tiny syscall, meant to allow a user to do a single "open this > file, read into this buffer, and close the file" all in a single shot. > > Should be good for reading "tiny" files like sysfs, procfs, and other > "small" files. > >

Re: [PATCH 1/3] readfile: implement readfile syscall

2020-07-04 Thread Matthew Wilcox
On Sat, Jul 04, 2020 at 04:02:47PM +0200, Greg Kroah-Hartman wrote: > + /* only accept a small subset of O_ flags that make sense */ > + if ((flags & (O_NOFOLLOW | O_NOATIME)) != flags) > + return -EINVAL; > + > + /* add some needed flags to be able to open the file properly

Re: [PATCH 1/3] readfile: implement readfile syscall

2020-07-04 Thread Geert Uytterhoeven
Hi Greg, On Sat, Jul 4, 2020 at 4:05 PM Greg Kroah-Hartman wrote: > It's a tiny syscall, meant to allow a user to do a single "open this > file, read into this buffer, and close the file" all in a single shot. > > Should be good for reading "tiny" files like sysfs, procfs, and other > "small" fil