|
PatchworkOS
|
Underlying type of a file descriptor. More...
Data Structures | |
| struct | file_t |
| File structure. More... | |
| struct | file_ops_t |
| File operations structure. More... | |
| struct | poll_file_t |
| Structure for polling multiple files. More... | |
Functions | |
| file_t * | file_new (inode_t *inode, const path_t *path, path_flags_t flags) |
| Create a new file structure. | |
| uint64_t | file_generic_seek (file_t *file, int64_t offset, seek_origin_t origin) |
| Helper function for basic seeking. | |
Underlying type of a file descriptor.
A file is the underlying type of a file descriptor. Note that internally the kernel does not use file descriptors, they are simply a per-process handle to a file. The kernel uses files directly.
| uint64_t file_generic_seek | ( | file_t * | file, |
| int64_t | offset, | ||
| seek_origin_t | origin | ||
| ) |
Helper function for basic seeking.
This can be used by filesystems that do not have any special requirements for seeking.
Used by setting the file ops seek to this function.
Definition at line 51 of file file.c.
References EINVAL, ERR, errno, file, dentry_t::inode, inode_t::mutex, MUTEX_SCOPE, SEEK_CUR, SEEK_END, SEEK_SET, and inode_t::size.
| file_t * file_new | ( | inode_t * | inode, |
| const path_t * | path, | ||
| path_flags_t | flags | ||
| ) |
Create a new file structure.
This does not open the file, instead its used internally by the VFS when opening files.
There is no file_free() instead use DEREF().
| inode | The inode the file represents. |
| path | The path of the file. |
| flags | The flags for the file. |
NULL and errno is set. Definition at line 31 of file file.c.
References file, file_free(), inode_t::fileOps, dentry_t::inode, malloc(), NULL, dentry_t::ops, path_copy(), PATH_EMPTY, dentry_t::private, dentry_t::ref, REF, and ref_init().
Referenced by vfs_open(), and vfs_open2().