summaryrefslogtreecommitdiff
path: root/src/user/app
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/app')
-rw-r--r--src/user/app/find/find.c5
-rw-r--r--src/user/app/init/driver/tmpfs.c10
-rw-r--r--src/user/app/shell/builtins.c2
3 files changed, 9 insertions, 8 deletions
diff --git a/src/user/app/find/find.c b/src/user/app/find/find.c
index 502a190..6c5d31a 100644
--- a/src/user/app/find/find.c
+++ b/src/user/app/find/find.c
@@ -1,3 +1,4 @@
+#include <camellia/path.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -48,8 +49,8 @@ void recurse(char *path) {
}
void find(const char *path) {
- // TODO export PATH_MAX
- char *buf = malloc(4096);
+ // TODO bound checking
+ char *buf = malloc(PATH_MAX);
memcpy(buf, path, strlen(path)+1);
recurse(buf);
free(buf);
diff --git a/src/user/app/init/driver/tmpfs.c b/src/user/app/init/driver/tmpfs.c
index 5db78f1..96fdf39 100644
--- a/src/user/app/init/driver/tmpfs.c
+++ b/src/user/app/init/driver/tmpfs.c
@@ -53,11 +53,11 @@ static struct node *tmpfs_open(const char *path, struct fs_wait_response *res) {
}
void tmpfs_drv(void) {
- // TODO replace all the static allocations in drivers with mallocs
- static char buf[512];
+ const size_t buflen = 4096;
+ char *buf = malloc(buflen);
struct fs_wait_response res;
struct node *ptr;
- while (!_syscall_fs_wait(buf, sizeof buf, &res)) {
+ while (!_syscall_fs_wait(buf, buflen, &res)) {
switch (res.op) {
case VFSOP_OPEN:
ptr = tmpfs_open(buf, &res);
@@ -68,7 +68,7 @@ void tmpfs_drv(void) {
ptr = (void*)res.id;
if (ptr == &special_root) {
struct dirbuild db;
- dir_start(&db, res.offset, buf, sizeof buf);
+ dir_start(&db, res.offset, buf, buflen);
for (struct node *iter = root; iter; iter = iter->next)
dir_append(&db, iter->name);
_syscall_fs_respond(buf, dir_finish(&db), 0);
@@ -97,7 +97,7 @@ void tmpfs_drv(void) {
fs_normslice(&res.offset, &res.len, ptr->size, true);
if (res.offset + res.len >= ptr->capacity) {
- // TODO
+ // TODO expanding files
_syscall_fs_respond(NULL, -1, 0);
break;
}
diff --git a/src/user/app/shell/builtins.c b/src/user/app/shell/builtins.c
index d4de354..d409bfd 100644
--- a/src/user/app/shell/builtins.c
+++ b/src/user/app/shell/builtins.c
@@ -89,7 +89,7 @@ static void cmd_ls(int argc, char **argv) {
const size_t buflen = 4096;
char *buf = malloc(buflen);
- DEFAULT_ARGV("!stdin");
+ DEFAULT_ARGV("/");
for (int i = 1; i < argc; i++) {
char *path = (void*)argv[i];
int pathlen = strlen(path);