summaryrefslogtreecommitdiff
path: root/src/user/app
diff options
context:
space:
mode:
authordzwdz2022-08-08 14:33:37 +0200
committerdzwdz2022-08-08 14:33:37 +0200
commit3131d8c2f66bcecb62dfa4c69325951cd9b00706 (patch)
tree595cb0baf29c15d75ffc94d04af71d7ae94517ed /src/user/app
parentc7af8418c9a2222cde5ab3a6953b31803d0a8ef1 (diff)
fs: getsize() on directories
Diffstat (limited to 'src/user/app')
-rw-r--r--src/user/app/tmpfs/tmpfs.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/user/app/tmpfs/tmpfs.c b/src/user/app/tmpfs/tmpfs.c
index 88a9fac..ed3c2e3 100644
--- a/src/user/app/tmpfs/tmpfs.c
+++ b/src/user/app/tmpfs/tmpfs.c
@@ -77,7 +77,6 @@ int main(void) {
} else {
fs_normslice(&res.offset, &res.len, ptr->size, false);
_syscall_fs_respond(ptr->buf + res.offset, res.len, 0);
- break;
}
break;
@@ -119,7 +118,15 @@ int main(void) {
case VFSOP_GETSIZE:
ptr = (void*)res.id;
- _syscall_fs_respond(NULL, ptr->size, 0);
+ if (ptr == &special_root) {
+ struct dirbuild db;
+ dir_start(&db, res.offset, NULL, buflen);
+ for (struct node *iter = root; iter; iter = iter->next)
+ dir_append(&db, iter->name);
+ _syscall_fs_respond(NULL, dir_finish(&db), 0);
+ } else {
+ _syscall_fs_respond(NULL, ptr->size, 0);
+ }
break;
default: