AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
vfs.h
Go to the documentation of this file.
1#ifndef _FS_VFS_H
2#define _FS_VFS_H
3
4#include <core/system.h>
5
6/*
7 * The virtual filesystem (fs/): what every filesystem provides (struct
8 * fs, its vnode operations), vnodes and open files, and the operations
9 * the rest of the kernel calls on them, whatever filesystem they're on.
10 * See docs/kernel/vfs.md.
11 */
12
14
15struct fs;
16struct vnode;
17struct file;
18struct uio;
19struct vops;
20struct iobuf;
21
22#include <aquila/dirent.h>
23
28struct fops {
29 int (*open) (struct file *file);
30 ssize_t (*read) (struct file *file, struct iobuf *io);
31 ssize_t (*write) (struct file *file, struct iobuf *io);
32 ssize_t (*readdir) (struct file *file, struct dirent *dirent);
33 off_t (*lseek) (struct file *file, off_t offset, int whence);
34 int (*close) (struct file *file);
35 int (*ioctl) (struct file *file, int request, void *argp);
36 int (*trunc) (struct file *file, off_t len);
37
38 /* for select() and poll(), and end of file */
39 int (*can_read) (struct file *file, size_t size);
40 int (*can_write) (struct file *file, size_t size);
41 int (*eof) (struct file *);
42
43 /* how long a read with nothing to return waits (ns); 0 means until
44 * data comes */
45 uint64_t (*read_timeout) (struct file *);
46};
47
48#include <aquila/errno.h>
49#include <sys/proc.h>
50#include <ds/queue.h>
51#include <fs/stat.h>
52#include <mm/vm.h>
53
54MALLOC_DECLARE(M_VNODE);
55
60struct uio {
61 struct vnode *root; /* where absolute paths start (NULL: vfs_root) */
62 struct vnode *cwd; /* where relative ones start (NULL: the root) */
67};
68
70struct vops {
71 /* `io->resid` bytes at `offset`, through the iobuf */
72 ssize_t (*read) (struct vnode *vnode, off_t offset, struct iobuf *io);
73 ssize_t (*write) (struct vnode *vnode, off_t offset, struct iobuf *io);
74 int (*ioctl) (struct vnode *vnode, int request, void *argp);
75 int (*close) (struct vnode *vnode);
76 int (*trunc) (struct vnode *vnode, off_t len);
77
78 ssize_t (*readdir) (struct vnode *dir, off_t offset, struct dirent *dirent);
79 int (*finddir) (struct vnode *dir, const char *name, struct dirent *dirent);
80
81 int (*vmknod) (struct vnode *dir, const char *fn, uint32_t mode, dev_t dev, struct uio *uio, struct vnode **ref);
82 int (*vunlink) (struct vnode *dir, const char *fn, struct uio *uio);
83 int (*vlink) (struct vnode *dir, const char *fn, struct vnode *vnode, struct uio *uio);
84 int (*vrename) (struct vnode *odir, const char *ofn, struct vnode *ndir, const char *nfn, struct uio *uio);
85
86 /* stores the vnode's mode, owner and times, after they were changed */
87 int (*setattr) (struct vnode *vnode);
88
89 int (*vget) (struct vnode *super, ino_t ino, struct vnode **vnode);
90
91 int (*vsync) (struct vnode *vnode, int mode);
92 int (*sync) (struct vnode *super, int mode);
93
94 int (*map) (struct vm_space *vm_space, struct vm_entry *vm_entry);
95};
96
98struct fs {
99 char *name;
100 int (*init) ();
101 int (*load) (struct vnode *dev, struct vnode **super); /* reads the superblock */
102 int (*mount) (struct vnode *dir, int flags, void *data); /* mounts on dir: vfs_bind() */
103
104 struct vops vops;
105 struct fops fops;
106
107 /* whether it needs no device (tmpfs, procfs) */
108 int nodev;
109};
110
151
157struct file {
158 union {
159 struct vnode *vnode;
160 struct socket *socket;
161 };
162
164 int flags; /* open flags (O_*) */
165
166 /* its flock() lock */
168
169 /* how many descriptors, and system calls, refer to it */
170 int ref;
171};
172
173/* Makes a new open file, whose one reference is the caller's. */
174struct file *file_new(void);
175
176/* Adds a reference to an open file. */
177struct file *file_ref(struct file *file);
178
179/* Drops a reference to an open file; the last one closes and frees it,
180 * and returns the close's result. */
181int file_put(struct file *file);
182
183/* Holds an open file until the current thread's system call returns. */
184struct file *file_hold(struct file *file);
185
187struct fs_list {
189 const char *name;
190
192 struct fs *fs;
193
195 struct fs_list *next;
196};
197
198extern struct fs_list *registered_fs;
199extern struct vnode *vfs_root;
200
201/* can_read, can_write and eof functions for files that always or never
202 * can, or are at their end. */
203static inline int __vfs_can_always(struct file *f, size_t s){return 1;}
204static inline int __vfs_can_never (struct file *f, size_t s){return 0;}
205static inline int __vfs_eof_always(struct file *f){return 1;}
206static inline int __vfs_eof_never (struct file *f){return 0;}
207
208/* Whether a vnode is a device. */
209#define ISDEV(vnode) (S_ISCHR((vnode)->mode) || S_ISBLK((vnode)->mode))
210
211/* Filesystems and mounts */
212void vfs_init(void);
213int vfs_install(struct fs *fs);
214int vfs_mount_root(struct vnode *vnode);
215int vfs_mount_root_dev(const char *name, const char *type);
216int vfs_bind(struct vnode *dir, struct vnode *root);
217int vfs_mount(const char *type, const char *dir, int flags, void *data, struct uio *uio);
218
219/* The vnode operations, whatever the filesystem */
220int vfs_vmknod(struct vnode *dir, const char *fn, uint32_t mode, dev_t dev, struct uio *uio, struct vnode **ref);
221int vfs_vcreat(struct vnode *dir, const char *fn, struct uio *uio, struct vnode **ref);
222int vfs_vmkdir(struct vnode *dir, const char *dname, struct uio *uio, struct vnode **ref);
223int vfs_vunlink(struct vnode *dir, const char *fn, struct uio *uio);
224int vfs_vlink(struct vnode *dir, const char *fn, struct vnode *vnode, struct uio *uio);
225int vfs_vrename(struct vnode *odir, const char *ofn, struct vnode *ndir, const char *nfn, struct uio *uio);
226int vfs_setattr(struct vnode *vnode);
227int vfs_vget(struct vnode *super, ino_t ino, struct vnode **vnode);
228
229int vfs_map(struct vm_space *vm_space, struct vm_entry *vm_entry);
230
231ssize_t vfs_read_io(struct vnode *vnode, off_t offset, struct iobuf *io);
232ssize_t vfs_write_io(struct vnode *vnode, off_t offset, struct iobuf *io);
233
234/* The kernel's own reads and writes, with a kernel buffer */
235ssize_t vfs_read(struct vnode *vnode, off_t offset, size_t size, void *buf);
236ssize_t vfs_write(struct vnode *vnode, off_t offset, size_t size, void *buf);
237int vfs_ioctl(struct vnode *vnode, unsigned long request, void *argp);
238int vfs_close(struct vnode *vnode);
239int vfs_trunc(struct vnode *vnode, off_t len);
240
241struct vm_page *vfs_pagein(struct vnode *vnode, off_t offset);
242
243/* Writing cached data to the disks */
244#define FS_MSYNC 0x0001
245#define FS_DSYNC 0x0002
246int vfs_vsync(struct vnode *vnode, int mode);
247int vfs_fssync(struct vnode *super, int mode);
248int vfs_sync(int mode);
249
250ssize_t vfs_readdir(struct vnode *dir, off_t offset, struct dirent *dirent);
251int vfs_finddir(struct vnode *dir, const char *name, struct dirent *dirent);
252int vfs_dir_empty(struct vnode *dir);
253
254/* The open file operations, whatever the file */
255int vfs_file_open(struct file *file);
256ssize_t vfs_file_read(struct file *file, struct iobuf *io);
257ssize_t vfs_file_write(struct file *file, struct iobuf *io);
258ssize_t vfs_file_readdir(struct file *file, struct dirent *dirent);
259off_t vfs_file_lseek(struct file *file, off_t offset, int whence);
261int vfs_file_flock(struct file *file, int op);
262void vfs_file_lock_release(struct file *file);
263int vfs_file_ioctl(struct file *file, int request, void *argp);
264int vfs_file_trunc(struct file *file, off_t len);
265
266/* For select() and poll(), and end of file */
267int vfs_file_can_read(struct file * file, size_t size);
268struct waitq *vfs_file_wait_queue(struct file *file, int write);
269int vfs_file_can_write(struct file * file, size_t size);
270int vfs_file_eof(struct file *);
271
272/* Path lookup (fs/lookup.c) */
273int vfs_lookup(const char *path, struct uio *uio, struct vnode **vnode);
274int vfs_lookup_parent(const char *path, struct uio *uio, struct vnode **dir, char **name);
275int vfs_lookup_dir(const char *path, struct uio *uio, struct vnode **vnode, struct vnode **dir);
276int vfs_parent(struct vnode *dir, struct vnode **parent);
277struct vnode *vfs_mount_root_of(struct vnode *vnode);
278int vfs_under(struct vnode *vnode, struct vnode *dir);
279int vfs_vnode_path(struct vnode *vnode, struct vnode *root, char *buf, size_t size);
280
281/* Operations by path */
282int vfs_creat(const char *path, mode_t mode, struct uio *uio, struct vnode **ref);
283int vfs_mkdir(const char *path, mode_t mode, struct uio *uio, struct vnode **ref);
284int vfs_mknod(const char *path, uint32_t mode, dev_t dev, struct uio *uio, struct vnode **ref);
285int vfs_unlink(const char *path, struct uio *uio);
286int vfs_rmdir(const char *path, struct uio *uio);
287int vfs_link(const char *oldpath, struct uio *ouio, const char *newpath, struct uio *nuio);
288int vfs_symlink(const char *target, const char *path, struct uio *uio);
289ssize_t vfs_readlink(const char *path, struct uio *uio, char *buf, size_t size);
290int vfs_rename(const char *oldpath, struct uio *ouio, const char *newpath, struct uio *nuio);
291int vfs_stat(struct vnode *vnode, struct aquila_stat *buf);
292int vfs_perms_check(struct file *file, struct uio *uio);
293
294/* The access modes vfs_access() checks */
295#define VFS_R 4
296#define VFS_W 2
297#define VFS_X 1
298int vfs_access(struct vnode *vnode, struct uio *uio, int mode);
299
300/* Changing attributes; `times` is atime then mtime (or UTIME_NOW,
301 * UTIME_OMIT) */
302int vfs_chmod(struct vnode *vnode, mode_t mode, struct uio *uio);
303int vfs_chown(struct vnode *vnode, uid_t uid, gid_t gid, struct uio *uio);
304int vfs_utimens(struct vnode *vnode, const struct aquila_timespec times[2], struct uio *uio);
305
308 const char *dev;
309 const char *path;
310 const char *type;
311 const char *options;
312};
313
314#endif /* ! _FS_VFS_H */
int vfs_chown(struct vnode *vnode, uid_t uid, gid_t gid, struct uio *uio)
Changes a vnode's owner and group.
Definition attr.c:68
int vfs_utimens(struct vnode *vnode, const struct aquila_timespec times[2], struct uio *uio)
Changes a vnode's access and modification times, for utimensat().
Definition attr.c:124
int vfs_chmod(struct vnode *vnode, mode_t mode, struct uio *uio)
Changes a vnode's permission bits.
Definition attr.c:38
int vfs_close(struct vnode *vnode)
Drops a reference to a vnode.
Definition close.c:18
struct file * file_hold(struct file *file)
Holds an open file for the current system call, until it returns.
Definition file.c:82
struct file * file_new(void)
Makes a new open file, with one reference.
Definition file.c:32
int file_put(struct file *file)
Drops a reference to an open file.
Definition file.c:60
struct file * file_ref(struct file *file)
Adds a reference to an open file.
Definition file.c:48
int vfs_file_flock(struct file *file, int op)
Takes, changes or releases an open file's lock.
Definition flock.c:67
void vfs_file_lock_release(struct file *file)
Releases an open file's lock when the file is closed.
Definition flock.c:119
int vfs_file_open(struct file *file)
Opens a file whose vnode is set: a device's driver, a FIFO's pipe, or the filesystem opens it.
Definition fops.c:22
int vfs_file_eof(struct file *file)
Says whether an open file is at its end, so that a read returns 0 rather than waiting.
Definition fops.c:325
struct waitq * vfs_file_wait_queue(struct file *file, int write)
Finds the wait queue that a reader (or a writer) of an open file sleeps on until it can go on,...
Definition fops.c:243
off_t vfs_file_lseek(struct file *file, off_t offset, int whence)
Moves an open file's offset.
Definition fops.c:136
ssize_t vfs_file_readdir(struct file *file, struct dirent *dirent)
Reads the next entry of an open directory.
Definition fops.c:162
int vfs_file_trunc(struct file *file, off_t len)
Changes the length of an open file.
Definition fops.c:213
int vfs_file_can_read(struct file *file, size_t size)
Says whether a read of an open file would go on without waiting, for poll() and select().
Definition fops.c:262
ssize_t vfs_file_close(struct file *file)
Closes an open file, when its last reference goes: its lock is released, then its socket,...
Definition fops.c:183
ssize_t vfs_file_write(struct file *file, struct iobuf *io)
Writes to an open file, at its offset.
Definition fops.c:83
int vfs_file_ioctl(struct file *file, int request, void *argp)
Passes an ioctl() request to an open file's device or filesystem.
Definition fops.c:111
int vfs_file_can_write(struct file *file, size_t size)
Says whether a write to an open file would go on without waiting, for poll(), select() and non-blocki...
Definition fops.c:295
ssize_t vfs_file_read(struct file *file, struct iobuf *io)
Reads from an open file, at its offset.
Definition fops.c:52
int vfs_ioctl(struct vnode *vnode, unsigned long request, void *argp)
Passes an ioctl() request to a vnode's device driver, or to its filesystem.
Definition ioctl.c:19
#define MALLOC_DECLARE(type)
Definition kvmem.h:29
int vfs_lookup_dir(const char *path, struct uio *uio, struct vnode **ref, struct vnode **dir)
Finds the vnode a path names, as vfs_lookup() does, and the directory it was found in.
Definition lookup.c:381
int vfs_lookup_parent(const char *path, struct uio *uio, struct vnode **dir, char **name)
Finds the directory of a path's last component, and the component's name, to make or remove an entry ...
Definition lookup.c:414
struct vnode * vfs_mount_root_of(struct vnode *vnode)
Finds the root of the mounted filesystem a vnode is in.
Definition lookup.c:452
int vfs_under(struct vnode *vnode, struct vnode *dir)
Says whether a vnode is a directory or under it, in the same filesystem: rename() can't move a direct...
Definition lookup.c:473
int vfs_lookup(const char *path, struct uio *uio, struct vnode **ref)
Finds the vnode a path names.
Definition lookup.c:349
int vfs_vnode_path(struct vnode *vnode, struct vnode *root, char *buf, size_t size)
Computes a vnode's path, for getcwd() and /proc/mounts: it goes up through .., and finds each directo...
Definition lookup.c:532
int vfs_parent(struct vnode *dir, struct vnode **ref)
Finds a directory's parent in its own filesystem, through its .. entry.
Definition lookup.c:80
int vfs_mknod(const char *path, mode_t mode, dev_t dev, struct uio *uio, struct vnode **ref)
Makes a node at a path.
Definition mknod.c:21
int vfs_mkdir(const char *path, mode_t mode, struct uio *uio, struct vnode **ref)
Makes a directory at a path.
Definition mknod.c:55
int vfs_creat(const char *path, mode_t mode, struct uio *uio, struct vnode **ref)
Makes a regular file at a path.
Definition mknod.c:69
int vfs_mount_root_dev(const char *name, const char *type)
Mounts the root filesystem from a disk partition (the root=/dev/hda2 kernel argument).
Definition mount.c:120
int vfs_mount(const char *type, const char *dir, int flags, void *data, struct uio *uio)
Mounts a filesystem of a type on a directory, for mount().
Definition mount.c:29
#define LOGGER_DECLARE(name)
Definition printk.h:42
ssize_t vfs_read(struct vnode *vnode, off_t off, size_t size, void *buf)
Reads from a vnode into a kernel buffer.
Definition read.c:52
ssize_t vfs_read_io(struct vnode *vnode, off_t off, struct iobuf *io)
Reads from a vnode into an iobuf (user or kernel memory).
Definition read.c:20
int vfs_finddir(struct vnode *dir, const char *name, struct dirent *dirent)
Finds the entry of a directory that has a name.
Definition readdir.c:46
int vfs_dir_empty(struct vnode *dir)
Says whether a directory is empty, so that it can be removed.
Definition readdir.c:69
ssize_t vfs_readdir(struct vnode *dir, off_t off, struct dirent *dirent)
Reads a directory's entry at an offset.
Definition readdir.c:19
int vfs_stat(struct vnode *vnode, struct aquila_stat *buf)
Fills a stat structure with a vnode's attributes.
Definition stat.c:16
unsigned int uint32_t
Definition stddef.h:22
unsigned long long int uint64_t
Definition stddef.h:23
A device driver: its operations, any of which may be NULL.
Definition dev.h:28
An open file's lock.
Definition flock.c:20
An open file (POSIX's "open file description", fs/file.c).
Definition vfs.h:157
off_t offset
Definition vfs.h:163
int ref
Definition vfs.h:170
struct file_lock * lock
Definition vfs.h:167
int flags
Definition vfs.h:164
An open file's operations.
Definition vfs.h:28
int(*) ioctl(struct file *file, int request, void *argp)
Definition vfs.h:35
int(*) close(struct file *file)
Definition vfs.h:34
int(*) can_read(struct file *file, size_t size)
Definition vfs.h:39
int(*) trunc(struct file *file, off_t len)
Definition vfs.h:36
uint64_t(*) read_timeout(struct file *)
Definition vfs.h:45
ssize_t(*) read(struct file *file, struct iobuf *io)
Definition vfs.h:30
off_t(*) lseek(struct file *file, off_t offset, int whence)
Definition vfs.h:33
ssize_t(*) write(struct file *file, struct iobuf *io)
Definition vfs.h:31
int(*) open(struct file *file)
Definition vfs.h:29
int(*) eof(struct file *)
Definition vfs.h:41
ssize_t(*) readdir(struct file *file, struct dirent *dirent)
Definition vfs.h:32
int(*) can_write(struct file *file, size_t size)
Definition vfs.h:40
The list of registered filesystem types.
Definition vfs.h:187
struct fs_list * next
the next entry of the list
Definition vfs.h:195
const char * name
the type's name
Definition vfs.h:189
struct fs * fs
the type
Definition vfs.h:192
A filesystem type.
Definition vfs.h:98
int nodev
Definition vfs.h:108
int(*) mount(struct vnode *dir, int flags, void *data)
Definition vfs.h:102
struct fops fops
Definition vfs.h:105
char * name
Definition vfs.h:99
int(*) load(struct vnode *dev, struct vnode **super)
Definition vfs.h:101
int(*) init()
Definition vfs.h:100
struct vops vops
Definition vfs.h:104
An iobuf.
Definition iobuf.h:35
A mount's description, as /proc/mounts shows it.
Definition vfs.h:307
const char * type
Definition vfs.h:310
const char * options
Definition vfs.h:311
const char * path
Definition vfs.h:309
const char * dev
Definition vfs.h:308
A pipe, or a FIFO's pipe.
Definition pipe.h:17
Who does a filesystem operation: where its paths start, and its credentials and umask.
Definition vfs.h:60
struct vnode * cwd
Definition vfs.h:62
struct vnode * root
Definition vfs.h:61
mode_t mask
Definition vfs.h:65
gid_t gid
Definition vfs.h:64
uid_t uid
Definition vfs.h:63
uint32_t flags
Definition vfs.h:66
A mapping (map entry): a range of an address space, its permissions, and where its pages come from.
Definition vm.h:66
A page of physical memory (pages[] has one for every page of RAM).
Definition vm.h:150
An address space: its mappings, and its page tables.
Definition vm.h:25
A file in memory (a vnode): what its inode says, and the kernel's own state.
Definition vfs.h:113
struct vnode * covered
Definition vfs.h:149
ino_t ino
Definition vfs.h:114
struct waitq * write_queue
Definition vfs.h:137
_time_t atime
Definition vfs.h:123
_time_t ctime
Definition vfs.h:125
dev_t dev
Definition vfs.h:116
size_t ref
how many references there are to it
Definition vfs.h:133
struct vm_object * vm_object
its vm object: its pages, read in (the page cache)
Definition vfs.h:140
nlink_t nlink
Definition vfs.h:121
struct fs * fs
Definition vfs.h:127
_time_t mtime
Definition vfs.h:124
struct waitq * read_queue
where its readers and writers sleep
Definition vfs.h:136
gid_t gid
Definition vfs.h:120
size_t size
Definition vfs.h:115
void * p
the filesystem's own data
Definition vfs.h:130
mode_t mode
Definition vfs.h:118
struct pipe * fifo
the pipe of a FIFO while it is open
Definition vfs.h:143
uid_t uid
Definition vfs.h:119
struct vnode * mounted
for a directory that a filesystem is mounted on, that filesystem's root; for a mounted filesystem's r...
Definition vfs.h:148
dev_t rdev
Definition vfs.h:117
A filesystem's vnode operations, any of which may be NULL.
Definition vfs.h:70
int(*) setattr(struct vnode *vnode)
Definition vfs.h:87
int(*) close(struct vnode *vnode)
Definition vfs.h:75
int(*) vmknod(struct vnode *dir, const char *fn, uint32_t mode, dev_t dev, struct uio *uio, struct vnode **ref)
Definition vfs.h:81
int(*) finddir(struct vnode *dir, const char *name, struct dirent *dirent)
Definition vfs.h:79
int(*) sync(struct vnode *super, int mode)
Definition vfs.h:92
int(*) vget(struct vnode *super, ino_t ino, struct vnode **vnode)
Definition vfs.h:89
int(*) vrename(struct vnode *odir, const char *ofn, struct vnode *ndir, const char *nfn, struct uio *uio)
Definition vfs.h:84
int(*) trunc(struct vnode *vnode, off_t len)
Definition vfs.h:76
int(*) vunlink(struct vnode *dir, const char *fn, struct uio *uio)
Definition vfs.h:82
ssize_t(*) write(struct vnode *vnode, off_t offset, struct iobuf *io)
Definition vfs.h:73
int(*) map(struct vm_space *vm_space, struct vm_entry *vm_entry)
Definition vfs.h:94
ssize_t(*) read(struct vnode *vnode, off_t offset, struct iobuf *io)
Definition vfs.h:72
ssize_t(*) readdir(struct vnode *dir, off_t offset, struct dirent *dirent)
Definition vfs.h:78
int(*) vsync(struct vnode *vnode, int mode)
Definition vfs.h:91
int(*) ioctl(struct vnode *vnode, int request, void *argp)
Definition vfs.h:74
int(*) vlink(struct vnode *dir, const char *fn, struct vnode *vnode, struct uio *uio)
Definition vfs.h:83
Definition waitq.h:19
int vfs_sync(int mode)
Would write every filesystem's data and metadata to its disk.
Definition sync.c:43
int vfs_vsync(struct vnode *vnode, int mode)
Would write a vnode's data and metadata to its disk.
Definition sync.c:18
int vfs_fssync(struct vnode *super, int mode)
Would write a filesystem's data and metadata to its disk.
Definition sync.c:31
int vfs_trunc(struct vnode *vnode, off_t len)
Changes a file's length, through its filesystem.
Definition trunc.c:19
uint16_t dev_t
Definition types.h:18
struct timespec _time_t
Definition types.h:24
uintptr_t ino_t
Definition types.h:23
long int ssize_t
Definition types.h:12
long int off_t
Definition types.h:10
uint32_t nlink_t
Definition types.h:22
uint32_t gid_t
Definition types.h:21
uint32_t uid_t
Definition types.h:20
uint32_t mode_t
Definition types.h:15
int vfs_bind(struct vnode *dir, struct vnode *root)
Mounts a filesystem on a directory: a lookup that reaches dir goes on in root instead.
Definition vfs.c:53
int vfs_access(struct vnode *vnode, struct uio *uio, int mode)
Checks whether a user may access a vnode in a way: the owner's permissions apply to its owner,...
Definition vfs.c:114
struct vnode * vfs_root
Definition vfs.c:29
int vfs_perms_check(struct file *file, struct uio *uio)
Checks whether a user may open a file the way it's being opened (read, write, execute,...
Definition vfs.c:139
int vfs_mount_root(struct vnode *vnode)
Makes a vnode the root of the filesystem tree.
Definition vfs.c:37
struct fs_list * registered_fs
The installed filesystems.
Definition vfs.c:25
int vfs_install(struct fs *fs)
Installs a filesystem, so that it can be mounted by name.
Definition vfs.c:85
void vfs_init(void)
Sets up the VFS at boot.
Definition vfs.c:74
static int __vfs_can_never(struct file *f, size_t s)
Definition vfs.h:204
static int __vfs_can_always(struct file *f, size_t s)
Definition vfs.h:203
static int __vfs_eof_never(struct file *f)
Definition vfs.h:206
struct vm_page * vfs_pagein(struct vnode *vnode, off_t offset)
static int __vfs_eof_always(struct file *f)
Definition vfs.h:205
int vfs_vmkdir(struct vnode *dir, const char *name, struct uio *uio, struct vnode **ref)
Makes a directory in a directory, with no permissions set.
Definition vops.c:66
int vfs_map(struct vm_space *vm_space, struct vm_entry *vm_entry)
Maps a file into an address space, for mmap(): a device's own mapping, or the filesystem's.
Definition vops.c:205
int vfs_vget(struct vnode *super, ino_t ino, struct vnode **ref)
Gets the vnode of an inode, by its number.
Definition vops.c:176
int vfs_vlink(struct vnode *dir, const char *fn, struct vnode *vnode, struct uio *uio)
Adds a name for an existing file (a hard link) to a directory of the same filesystem.
Definition vops.c:103
int vfs_vunlink(struct vnode *dir, const char *fn, struct uio *uio)
Removes a name from a directory.
Definition vops.c:79
int vfs_setattr(struct vnode *vnode)
Has the filesystem store a vnode's attributes (mode, owner, times) after they were changed in memory.
Definition vops.c:156
int vfs_vcreat(struct vnode *dir, const char *name, struct uio *uio, struct vnode **ref)
Makes a regular file in a directory, with no permissions set.
Definition vops.c:52
int vfs_vmknod(struct vnode *dir, const char *name, mode_t mode, dev_t dev, struct uio *uio, struct vnode **ref)
Makes a node in a directory.
Definition vops.c:22
int vfs_vrename(struct vnode *odir, const char *ofn, struct vnode *ndir, const char *nfn, struct uio *uio)
Renames an entry, possibly to another directory of the same filesystem.
Definition vops.c:132
ssize_t vfs_write_io(struct vnode *vnode, off_t off, struct iobuf *io)
Writes to a vnode from an iobuf (user or kernel memory).
Definition write.c:22
ssize_t vfs_write(struct vnode *vnode, off_t off, size_t size, void *buf)
Writes to a vnode from a kernel buffer.
Definition write.c:60