Hacker News new | past | comments | ask | show | jobs | submit login
The file_operations structure gets smaller (lwn.net)
12 points by sohkamyung 5 months ago | hide | past | favorite | 4 comments



One 'silly' question from this novice linux kernel driver developer: if the ->read() and ->write() operations in the Linux kernel file operations structure go away, then what happens to read() and write() from user space? Which file operations do those call trigger in the kernel driver?


The userspace read() and write() syscalls aren't the same thing as read()/write() in file_operations. Presumably the syscalls will be updated to use the new _iter operations.

In fact, the syscalls already support f_op->read_iter/write_iter, so the code using the legacy f_op->read/write just needs to be removed. See the linux source code links below:

vfs_read: https://elixir.bootlin.com/linux/latest/source/fs/read_write...

vfs_write: https://elixir.bootlin.com/linux/latest/source/fs/read_write...

Those functions are called by sys_read/sys_write, which are the functions implementing the syscalls (all the code is in fs/read_write.c).


I thought it said ->read_iter() and ->write_iter()?


From the end of the article:

"The final patch in the series removes read() and write() with a surprising lack of ceremony, given that they have been there for 32 years."




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: