|
PatchworkOS
|
File operations structure. More...
#include <file.h>
Data Fields | |
| uint64_t(* | open )(file_t *file) |
| uint64_t(* | open2 )(file_t *files[2]) |
| void(* | close )(file_t *file) |
| uint64_t(* | read )(file_t *file, void *buffer, uint64_t count, uint64_t *offset) |
| uint64_t(* | write )(file_t *file, const void *buffer, uint64_t count, uint64_t *offset) |
| uint64_t(* | seek )(file_t *file, int64_t offset, seek_origin_t origin) |
| uint64_t(* | ioctl )(file_t *file, uint64_t request, void *argp, uint64_t size) |
| wait_queue_t *(* | poll )(file_t *file, poll_events_t *revents) |
| void *(* | mmap )(file_t *file, void *address, uint64_t length, uint64_t *offset, pml_flags_t flags) |
File operations structure.
Note that unlike inode or dentry ops, the files inode mutex will NOT be acquired by the vfs and that the filesystem is responsible for synchronization. To understand why consider a pipe, a pipe needs to be able to block when there is no data available and then wake up when there is data available, this is only possible if multiple threads can access the pipe without blocking each other.
| wait_queue_t *(* file_ops_t::poll) (file_t *file, poll_events_t *revents) |
| uint64_t(* file_ops_t::seek) (file_t *file, int64_t offset, seek_origin_t origin) |