The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
fs_ops_t Struct Reference

#include </home/runner/work/ginnOS-docs/ginnOS-docs/ginnOS/src/kernel/fs/fs.h>

Data Fields

kerr_t(*) open (fs_mount_t *mount, const char *path, fs_file_t *file)
kerr_t(*) create (fs_mount_t *mount, const char *path)
kerr_t(*) mkdir (fs_mount_t *mount, const char *path)
kerr_t(*) remove (fs_mount_t *mount, const char *path)
kerr_t(*) rmdir (fs_mount_t *mount, const char *path)
kerr_t(*) rename (fs_mount_t *mount, const char *old_path, const char *new_path)
kerr_t(*) stat (fs_mount_t *mount, const char *path, fs_stat_t *stat_out)
uint32_t(*) read (fs_file_t *file, uint32_t byte_count, void *data_out)
uint32_t(*) write (fs_file_t *file, uint32_t byte_count, const void *data_in)
kerr_t(*) truncate (fs_file_t *file, uint64_t length)
kerr_t(*) read_entry (fs_file_t *file, fs_dirent_t *entry_out)
kerr_t(*) fstat (fs_file_t *file, fs_stat_t *stat_out)
kerr_t(*) setattr (fs_file_t *file, const fs_attr_t *attr)
 change the permission bits and/or owner of an open file (optional; NULL means the filesystem keeps no owners: KERR_PERM).
void(*) close (fs_file_t *file)
int32_t(*) ioctl (fs_file_t *file, uint32_t request, void *arg)
 device-control operation for a special file (optional; NULL means the filesystem supports no ioctls, i.e.
int32_t(*) mmap (fs_file_t *file, addr_space_t as, uintptr_t virt, size_t length, int prot, uint64_t offset)
 map an open special file's memory into a process (optional; NULL means the file is not mappable, i.e.
int64_t(*) seek (fs_file_t *file, int64_t offset, int whence)
 reposition an open file's cursor (optional).
kerr_t(*) find_link (fs_mount_t *mount, const char *path, bool follow_last, char *target, uint32_t size, uint32_t *end_out)
 links (all optional; NULL means the filesystem has none).
kerr_t(*) readlink (fs_mount_t *mount, const char *path, char *target, uint32_t size)
kerr_t(*) symlink (fs_mount_t *mount, const char *path, const char *target)
kerr_t(*) link (fs_mount_t *mount, const char *old_path, const char *new_path)
kerr_t(*) mknod (fs_mount_t *mount, const char *path, uint32_t mode, uint32_t rdev)
 make a named pipe or a device node (optional: KERR_PERM).

Field Documentation

◆ open

kerr_t(*) fs_ops_t::open(fs_mount_t *mount, const char *path, fs_file_t *file)

◆ create

kerr_t(*) fs_ops_t::create(fs_mount_t *mount, const char *path)

◆ mkdir

kerr_t(*) fs_ops_t::mkdir(fs_mount_t *mount, const char *path)

◆ remove

kerr_t(*) fs_ops_t::remove(fs_mount_t *mount, const char *path)

◆ rmdir

kerr_t(*) fs_ops_t::rmdir(fs_mount_t *mount, const char *path)

◆ rename

kerr_t(*) fs_ops_t::rename(fs_mount_t *mount, const char *old_path, const char *new_path)

◆ stat

kerr_t(*) fs_ops_t::stat(fs_mount_t *mount, const char *path, fs_stat_t *stat_out)

◆ read

uint32_t(*) fs_ops_t::read(fs_file_t *file, uint32_t byte_count, void *data_out)

◆ write

uint32_t(*) fs_ops_t::write(fs_file_t *file, uint32_t byte_count, const void *data_in)

◆ truncate

kerr_t(*) fs_ops_t::truncate(fs_file_t *file, uint64_t length)

◆ read_entry

kerr_t(*) fs_ops_t::read_entry(fs_file_t *file, fs_dirent_t *entry_out)

◆ fstat

kerr_t(*) fs_ops_t::fstat(fs_file_t *file, fs_stat_t *stat_out)

◆ setattr

kerr_t(*) fs_ops_t::setattr(fs_file_t *file, const fs_attr_t *attr)

change the permission bits and/or owner of an open file (optional; NULL means the filesystem keeps no owners: KERR_PERM).

◆ close

void(*) fs_ops_t::close(fs_file_t *file)

◆ ioctl

int32_t(*) fs_ops_t::ioctl(fs_file_t *file, uint32_t request, void *arg)

device-control operation for a special file (optional; NULL means the filesystem supports no ioctls, i.e.

-ENOTTY). devfs forwards this to the backing device; disk filesystems like ext2 leave it NULL. returns 0 on success or a negative errno.

◆ mmap

int32_t(*) fs_ops_t::mmap(fs_file_t *file, addr_space_t as, uintptr_t virt, size_t length, int prot, uint64_t offset)

map an open special file's memory into a process (optional; NULL means the file is not mappable, i.e.

-ENODEV). devfs forwards this to the backing device; disk filesystems leave it NULL. returns 0 or -errno.

◆ seek

int64_t(*) fs_ops_t::seek(fs_file_t *file, int64_t offset, int whence)

reposition an open file's cursor (optional).

devfs implements this over its generic cursor; ext2 leaves it NULL and the syscall layer uses the ext2 file cursor directly. whence is SEEK_SET(0)/CUR(1)/END(2).

Returns
the new absolute position, or a negative errno.

◆ find_link

kerr_t(*) fs_ops_t::find_link(fs_mount_t *mount, const char *path, bool follow_last, char *target, uint32_t size, uint32_t *end_out)

links (all optional; NULL means the filesystem has none).

find_link reports the first symbolic link along a path (see ext2_find_link); readlink reads one's target; symlink makes one; link gives a file one more name.

◆ readlink

kerr_t(*) fs_ops_t::readlink(fs_mount_t *mount, const char *path, char *target, uint32_t size)

◆ symlink

kerr_t(*) fs_ops_t::symlink(fs_mount_t *mount, const char *path, const char *target)

◆ link

kerr_t(*) fs_ops_t::link(fs_mount_t *mount, const char *old_path, const char *new_path)

◆ mknod

kerr_t(*) fs_ops_t::mknod(fs_mount_t *mount, const char *path, uint32_t mode, uint32_t rdev)

make a named pipe or a device node (optional: KERR_PERM).

Parameters
modeS_IFIFO, S_IFCHR or S_IFBLK with the permission bits.
rdeva device node's number (DEVICE_NUMBER packing).

The documentation for this struct was generated from the following file:
  • src/kernel/fs/fs.h