|
ginnOS
The reference: libc, the libraries and the kernel
|
Functions | |
| kerr_t | vfs_open (const char *path, vfs_file_t *file) |
| open a file or directory by absolute path in the virtual file system. | |
| kerr_t | vfs_create (const char *path) |
| create a regular file by absolute path. | |
| kerr_t | vfs_mkdir (const char *path) |
| create a directory by absolute path. | |
| kerr_t | vfs_remove (const char *path) |
| remove a file by absolute path. | |
| kerr_t | vfs_rmdir (const char *path) |
| remove a directory by absolute path. | |
| kerr_t | vfs_rename (const char *old_path, const char *new_path) |
| rename a file or directory by absolute paths. | |
| kerr_t | vfs_stat (const char *path, vfs_stat_t *stat_out) |
| stat a file or directory by absolute path. | |
| uint32_t | vfs_read (vfs_file_t *file, uint32_t size, void *buffer) |
| read data from an open file in the virtual file system. | |
| uint32_t | vfs_write (vfs_file_t *file, uint32_t size, const void *buffer) |
| write data to an open file in the virtual file system. | |
| kerr_t | vfs_truncate (vfs_file_t *file, uint64_t length) |
| cut or grow an open file to length bytes (growth reads as zeros). | |
| kerr_t | vfs_read_entry (vfs_file_t *file, fs_dirent_t *entryOut) |
| read a directory entry from an open directory in the virtual file system. | |
| void | vfs_close (vfs_file_t *file) |
| close an open file in the virtual file system. | |
| uint8_t | vfs_file_type (vfs_file_t *file) |
| get the type of an open file in the virtual file system. | |
| int32_t | vfs_ioctl (vfs_file_t *file, uint32_t request, void *arg) |
| issue a device-control (ioctl) request on an open file. | |
| int32_t | vfs_mmap (vfs_file_t *file, addr_space_t as, uintptr_t virt, size_t length, int prot, uint64_t offset) |
| map an open file's memory into a process address space. | |
| int64_t | vfs_lseek (vfs_file_t *file, int64_t offset, int whence) |
| move an open file's offset, as lseek does: through the filesystem's own seek op if it has one (devfs), else the ext2 file cursor. | |
| void | vfs_seek_end (vfs_file_t *file) |
| move an open file's offset to its end (O_APPEND writes). | |
| kerr_t | vfs_fstat (vfs_file_t *file, vfs_stat_t *stat_out) |
| stat an open file or directory. | |
| kerr_t | vfs_setattr (const char *path, const fs_attr_t *attr) |
| change the permission bits and/or owner of a file by path, or of an open file. | |
| kerr_t | vfs_fsetattr (vfs_file_t *file, const fs_attr_t *attr) |
| kerr_t vfs_open | ( | const char * | path, |
| vfs_file_t * | file ) |
open a file or directory by absolute path in the virtual file system.
| path | absolute path to the file or directory. |
| file | pointer to a vfs_file_t structure that will be initialized with the opened file |
| kerr_t vfs_create | ( | const char * | path | ) |
create a regular file by absolute path.
| path | absolute path to the new file. |
| kerr_t vfs_mkdir | ( | const char * | path | ) |
create a directory by absolute path.
| path | absolute path to the new directory. |
| kerr_t vfs_remove | ( | const char * | path | ) |
remove a file by absolute path.
| path | absolute path to the file to remove. |
| kerr_t vfs_rmdir | ( | const char * | path | ) |
remove a directory by absolute path.
| path | absolute path to the directory to remove. |
| kerr_t vfs_rename | ( | const char * | old_path, |
| const char * | new_path ) |
rename a file or directory by absolute paths.
| old_path | absolute path to the existing file or directory. |
| new_path | absolute path to the new name for the file or directory. |
| kerr_t vfs_stat | ( | const char * | path, |
| vfs_stat_t * | stat_out ) |
stat a file or directory by absolute path.
| path | absolute path to the file or directory. |
| stat_out | pointer to a vfs_stat_t structure that will be filled with the file's metadata. |
| uint32_t vfs_read | ( | vfs_file_t * | file, |
| uint32_t | size, | ||
| void * | buffer ) |
read data from an open file in the virtual file system.
| file | pointer to the vfs_file_t structure representing the open file. |
| size | number of bytes to read. |
| buffer | pointer to the buffer where the read data will be stored. |
| uint32_t vfs_write | ( | vfs_file_t * | file, |
| uint32_t | size, | ||
| const void * | buffer ) |
write data to an open file in the virtual file system.
| file | pointer to the vfs_file_t structure representing the open file. |
| size | number of bytes to write. |
| buffer | pointer to the source data. |
| kerr_t vfs_truncate | ( | vfs_file_t * | file, |
| uint64_t | length ) |
cut or grow an open file to length bytes (growth reads as zeros).
| kerr_t vfs_read_entry | ( | vfs_file_t * | file, |
| fs_dirent_t * | entryOut ) |
read a directory entry from an open directory in the virtual file system.
| file | pointer to the vfs_file_t structure representing the open directory. |
| entryOut | pointer to output directory entry. |
| void vfs_close | ( | vfs_file_t * | file | ) |
close an open file in the virtual file system.
| file | pointer to the vfs_file_t structure representing the open file. |
| uint8_t vfs_file_type | ( | vfs_file_t * | file | ) |
get the type of an open file in the virtual file system.
| file | pointer to the vfs_file_t structure representing the open file. |
| int32_t vfs_ioctl | ( | vfs_file_t * | file, |
| uint32_t | request, | ||
| void * | arg ) |
issue a device-control (ioctl) request on an open file.
dispatches through the backing filesystem; only special filesystems (devfs) implement it, forwarding to the device. others return -ENOTTY.
| file | pointer to the vfs_file_t representing the open file. |
| request | driver-defined request code. |
| arg | request-specific argument (typically a bounds-checked pointer). |
| int32_t vfs_mmap | ( | vfs_file_t * | file, |
| addr_space_t | as, | ||
| uintptr_t | virt, | ||
| size_t | length, | ||
| int | prot, | ||
| uint64_t | offset ) |
map an open file's memory into a process address space.
dispatches through the backing filesystem; only device nodes (devfs) that forward to a mappable device succeed. others return -ENODEV.
| file | pointer to the vfs_file_t representing the open file. |
| page_directory | physical address of the target process page directory. |
| virt | page-aligned destination virtual address. |
| length | bytes to map (page-multiple). |
| prot | PROT_* bits. |
| offset | page-aligned byte offset into the mapped object. |
| int64_t vfs_lseek | ( | vfs_file_t * | file, |
| int64_t | offset, | ||
| int | whence ) |
move an open file's offset, as lseek does: through the filesystem's own seek op if it has one (devfs), else the ext2 file cursor.
| file | the open file. |
| offset | bytes relative to whence. |
| whence | VFS_SEEK_SET, VFS_SEEK_CUR or VFS_SEEK_END. |
| void vfs_seek_end | ( | vfs_file_t * | file | ) |
move an open file's offset to its end (O_APPEND writes).
| file | the open file. |
| kerr_t vfs_fstat | ( | vfs_file_t * | file, |
| vfs_stat_t * | stat_out ) |
stat an open file or directory.
| file | the open file. |
| stat_out | receives its metadata. |
change the permission bits and/or owner of a file by path, or of an open file.
| kerr_t vfs_fsetattr | ( | vfs_file_t * | file, |
| const fs_attr_t * | attr ) |