summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenji Dial <benji6283@gmail.com>2021-03-02 20:43:19 -0500
committerBenji Dial <benji6283@gmail.com>2021-03-02 20:43:19 -0500
commit053c6f0d9f1894fb6a7ada060600f464dafc43d5 (patch)
treed0d1a0a495a885ef075ace580ca4a0fd47bf3fca
parente9a11deef01346dc75728f4debefcc694254e5f0 (diff)
downloadportland-os-053c6f0d9f1894fb6a7ada060600f464dafc43d5.tar.gz
removing stub for special handling of 'sd' prefix in file paths from knob
passing a path with an 'sd' prefix will now act like any other path on the first drive, instead of closing the calling program. eventually, i will add a system of mounting drives directly into a file hierarchy (like in unix), and have all of the system calls just pass a path, no drive number
-rw-r--r--src/user/knob/file.c20
-rw-r--r--src/user/knob/task.c7
2 files changed, 5 insertions, 22 deletions
diff --git a/src/user/knob/file.c b/src/user/knob/file.c
index 283f984..8d7a327 100644
--- a/src/user/knob/file.c
+++ b/src/user/knob/file.c
@@ -28,19 +28,8 @@ struct file {
uint32_t length;
};
-const char *remove_prefix(const char *path, uint8_t *dn_out) {
- if ((path[0] == 's') && (path[1] == 'd'))
- PANIC("remove_prefix not fully implemented");
-
- *dn_out = 0;//change this later to an "active drive" or something
- return path;
-}
-
struct file *open_file(const char *path) {
- uint8_t dn;
- path = remove_prefix(path, &dn);
-
- _file_handle_t h = _open_file(dn, path);
+ _file_handle_t h = _open_file(0, path);
if (!h)
return 0;
@@ -131,16 +120,13 @@ void trunc_file(struct file *f) {
//return value must be manually freed, unless it is a null pointer
_dir_info_entry_t *get_directory_info(const char *path, uint32_t *count_out) {
- uint8_t dn;
- path = remove_prefix(path, &dn);
-
- uint32_t count = _count_of_dir(dn, path);
+ uint32_t count = _count_of_dir(0, path);
if (!count) {
*count_out = 0;
return 0;
}
_dir_info_entry_t *buffer = get_block(count * sizeof(_dir_info_entry_t));
- *count_out = _enumerate_dir(dn, path, buffer, count);
+ *count_out = _enumerate_dir(0, path, buffer, count);
return buffer;
} \ No newline at end of file
diff --git a/src/user/knob/task.c b/src/user/knob/task.c
index 9a49386..9bf2c83 100644
--- a/src/user/knob/task.c
+++ b/src/user/knob/task.c
@@ -8,21 +8,18 @@
#include <knob/format.h>
_task_handle_t run_command(const char *path, _task_handle_t stdio_task) {
- uint8_t dn;
- path = remove_prefix(path, &dn);
-
for (const char *ptr = path; *ptr; ++ptr)
if (*ptr == ' ') {
char *new_path = get_block(ptr - path + 1);
blockcpy(new_path, path, ptr - path);
new_path[ptr - path] = '\0';
- _task_handle_t handle = _start_task(dn, new_path, ptr + 1, stdio_task);
+ _task_handle_t handle = _start_task(0, new_path, ptr + 1, stdio_task);
free_block(new_path);
return handle;
}
- return _start_task(dn, path, "", stdio_task);
+ return _start_task(0, path, "", stdio_task);
}
bool try_run_command_blocking(const char *path, _task_handle_t stdio_task) {