GIVEN:
in fs/read_write.c
the function vfs_read()
has a signature as shown bewlow:
ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
where the last argument is a pointer to a position. The signature itself is not documented. The signature, I would think, insinuates that the initial read position is passed to the read function, and maybe the updated position (next position to be read from) is written in *pos
. Then, however, there is the function vfs_llseek()
in fs/read_write.c
with the signature
loff_t vfs_llseek(struct file *file, loff_t offset, int whence)
which looks like a 'normal' seek function. Also, the signature is not documented along side with the code.
QUESTIONS:
- How does one actually seek in a file using VFS?
- Is the position equal to the index of the byte in the file, i.e. first byte position = 0, position = position + 1 for subsequent bytes?