summaryrefslogtreecommitdiff
path: root/src/kernel/vfs/mount.c
diff options
context:
space:
mode:
authordzwdz2023-01-25 20:16:22 +0100
committerdzwdz2023-01-25 20:16:22 +0100
commit17bfb0ef0a48330b1d54e61fe3c30d83528d2d90 (patch)
treeb3d4aed1f408edcb17fe5c86fccaeacaa2a5a48a /src/kernel/vfs/mount.c
parent2ad6ee8ed15d1bf898645a16dbc06991a3c1425e (diff)
style: typedef structs, shorter namespaces
I've wanted to do this for a while, and since I've just had a relatively large refactor commit (pcpy), this is as good of a time as any. Typedefing structs was mostly inspired by Plan 9's coding style. It makes some lines of code much shorter at basically no expense. Everything related to userland kept old-style struct definitions, so as not to force that style onto other people. I also considered changing SCREAMING_ENUM_FIELDS to NicerLookingCamelcase, but I didn't, just in case that'd be confusing.
Diffstat (limited to 'src/kernel/vfs/mount.c')
-rw-r--r--src/kernel/vfs/mount.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/kernel/vfs/mount.c b/src/kernel/vfs/mount.c
index 2815bb9..2518989 100644
--- a/src/kernel/vfs/mount.c
+++ b/src/kernel/vfs/mount.c
@@ -3,22 +3,22 @@
#include <kernel/vfs/mount.h>
#include <shared/mem.h>
-static struct vfs_mount *mount_root = NULL;
+static VfsMount *mount_root = NULL;
-struct vfs_mount *vfs_mount_seed(void) {
+VfsMount *vfs_mount_seed(void) {
return mount_root;
}
-void vfs_root_register(const char *path, void (*accept)(struct vfs_request *)) {
- struct vfs_backend *backend = kmalloc(sizeof *backend);
- struct vfs_mount *mount = kmalloc(sizeof *mount);
- *backend = (struct vfs_backend) {
+void vfs_root_register(const char *path, void (*accept)(VfsReq *)) {
+ VfsBackend *backend = kmalloc(sizeof *backend);
+ VfsMount *mount = kmalloc(sizeof *mount);
+ *backend = (VfsBackend) {
.is_user = false,
.usehcnt = 1,
.provhcnt = 1,
.kern.accept = accept,
};
- *mount = (struct vfs_mount){
+ *mount = (VfsMount){
.prev = mount_root,
.prefix = path,
.prefix_len = strlen(path),
@@ -29,8 +29,8 @@ void vfs_root_register(const char *path, void (*accept)(struct vfs_request *)) {
}
-struct vfs_mount *vfs_mount_resolve(
- struct vfs_mount *top, const char *path, size_t path_len)
+VfsMount *vfs_mount_resolve(
+ VfsMount *top, const char *path, size_t path_len)
{
for (; top; top = top->prev) {
if (top->prefix_len > path_len)
@@ -49,12 +49,12 @@ struct vfs_mount *vfs_mount_resolve(
return top;
}
-void vfs_mount_remref(struct vfs_mount *mnt) {
+void vfs_mount_remref(VfsMount *mnt) {
assert(mnt);
assert(mnt->refs > 0);
if (--(mnt->refs) > 0) return;
- struct vfs_mount *prev = mnt->prev;
+ VfsMount *prev = mnt->prev;
if (mnt->backend) {
vfs_backend_refdown(mnt->backend, true);
}