vfs changes for pread/pwrite

Richard Henderson (rth@dot.cygnus.com)
Mon, 13 Oct 1997 01:07:47 -0700


Single Unix adds two new system calls, pread and pwrite, that take
an extra argument for the location to do the I/O. The "p" stands
for "positioned" I guess.

It is defined rather sensibly in that anything that won't lseek
won't pread either. It acts like an atomic lseek+op+lseek, so
it never has any effect on the current offset.

I've got patches partly done, but it is a lot of work changing things
up, and I thought I'd run things by folks before I finish. I've
changed the VFS read/write functions to be

ssize_t (*read)(struct file *file, char *buf, size_t n, loff_t *ppos)

and similar for write. In the normal case ppos==&file->f_pos, and
for pread, ppos points to a stack variable. This is also how non-
seekable files know to return -ESPIPE.

Note the actual use of the posix types. Is there any reason why
we weren't using these before? I've found quite a number of places
so far that the code doesn't even use long, but int. True, it isn't
going to be every day that someone writes more than 2GB in one syscall,
but it seems Wrong in any case.

Oh, one last thing. Am I right in assuming that file->f_dentry->d_inode
is always there? You'll notice I got rid of the inode argument like
many of the other VFS functions have recently.

Comments before I finish up the changes?

r~