summaryrefslogtreecommitdiff
path: root/src/user/app/tmpfs/tmpfs.c
diff options
context:
space:
mode:
authordzwdz2023-01-25 20:16:22 +0100
committerdzwdz2023-01-25 20:16:22 +0100
commit17bfb0ef0a48330b1d54e61fe3c30d83528d2d90 (patch)
treeb3d4aed1f408edcb17fe5c86fccaeacaa2a5a48a /src/user/app/tmpfs/tmpfs.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/user/app/tmpfs/tmpfs.c')
-rw-r--r--src/user/app/tmpfs/tmpfs.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/user/app/tmpfs/tmpfs.c b/src/user/app/tmpfs/tmpfs.c
index c55da59..6d58790 100644
--- a/src/user/app/tmpfs/tmpfs.c
+++ b/src/user/app/tmpfs/tmpfs.c
@@ -123,14 +123,14 @@ int main(void) {
for (;;) {
struct ufs_request req;
- handle_t reqh = ufs_wait(buf, buflen, &req);
+ hid_t reqh = ufs_wait(buf, buflen, &req);
struct node *ptr = req.id;
if (reqh < 0) break;
switch (req.op) {
case VFSOP_OPEN:
ptr = tmpfs_open(buf, &req);
- _syscall_fs_respond(reqh, ptr, ptr ? 0 : -ENOENT, 0);
+ _sys_fs_respond(reqh, ptr, ptr ? 0 : -ENOENT, 0);
break;
case VFSOP_READ:
@@ -140,16 +140,16 @@ int main(void) {
for (struct node *iter = ptr->child; iter; iter = iter->sibling) {
dir_appendl(&db, iter->name, iter->namelen);
}
- _syscall_fs_respond(reqh, buf, dir_finish(&db), 0);
+ _sys_fs_respond(reqh, buf, dir_finish(&db), 0);
} else {
fs_normslice(&req.offset, &req.len, ptr->size, false);
- _syscall_fs_respond(reqh, ptr->buf + req.offset, req.len, 0);
+ _sys_fs_respond(reqh, ptr->buf + req.offset, req.len, 0);
}
break;
case VFSOP_WRITE:
if (ptr->directory) {
- _syscall_fs_respond(reqh, NULL, -ENOSYS, 0);
+ _sys_fs_respond(reqh, NULL, -ENOSYS, 0);
break;
}
@@ -163,7 +163,7 @@ int main(void) {
if ((req.flags & WRITE_TRUNCATE) || ptr->size < req.offset + req.len) {
ptr->size = req.offset + req.len;
}
- _syscall_fs_respond(reqh, NULL, req.len, 0);
+ _sys_fs_respond(reqh, NULL, req.len, 0);
break;
case VFSOP_GETSIZE:
@@ -174,23 +174,23 @@ int main(void) {
for (struct node *iter = ptr->child; iter; iter = iter->sibling) {
dir_append(&db, iter->name);
}
- _syscall_fs_respond(reqh, NULL, dir_finish(&db), 0);
+ _sys_fs_respond(reqh, NULL, dir_finish(&db), 0);
} else {
- _syscall_fs_respond(reqh, NULL, ptr->size, 0);
+ _sys_fs_respond(reqh, NULL, ptr->size, 0);
}
break;
case VFSOP_REMOVE:
- _syscall_fs_respond(reqh, NULL, node_remove(ptr), 0);
+ _sys_fs_respond(reqh, NULL, node_remove(ptr), 0);
break;
case VFSOP_CLOSE:
node_close(ptr);
- _syscall_fs_respond(reqh, NULL, -1, 0);
+ _sys_fs_respond(reqh, NULL, -1, 0);
break;
default:
- _syscall_fs_respond(reqh, NULL, -1, 0);
+ _sys_fs_respond(reqh, NULL, -1, 0);
break;
}
}