From 17bfb0ef0a48330b1d54e61fe3c30d83528d2d90 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Wed, 25 Jan 2023 20:16:22 +0100 Subject: 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. --- src/kernel/vfs/mount.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/kernel/vfs/mount.c') 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 #include -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); } -- cgit v1.2.3