From 3131d8c2f66bcecb62dfa4c69325951cd9b00706 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Mon, 8 Aug 2022 14:33:37 +0200 Subject: fs: getsize() on directories --- src/user/app/tmpfs/tmpfs.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/user/app') 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: -- cgit v1.2.3