From de20d7430df08731d9108acb83e1234ba7f1fe16 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Sat, 19 Sep 2020 14:53:29 -0400 Subject: file manager --- src/user/include/knob/block.h | 3 +++ src/user/include/knob/file.h | 5 ++++- src/user/include/knob/quit.h | 7 ------- src/user/include/knob/user.h | 3 +++ 4 files changed, 10 insertions(+), 8 deletions(-) delete mode 100644 src/user/include/knob/quit.h (limited to 'src/user/include/knob') diff --git a/src/user/include/knob/block.h b/src/user/include/knob/block.h index 4625577..43137e1 100644 --- a/src/user/include/knob/block.h +++ b/src/user/include/knob/block.h @@ -7,4 +7,7 @@ void blockcpy(void *to, const void *from, uint32_t size); bool blockequ(const void *a, const void *b, uint32_t size) __attribute__ ((__pure__)); +//returns length without null-terminator +uint32_t strcpy(char *to, const char *from); + #endif \ No newline at end of file diff --git a/src/user/include/knob/file.h b/src/user/include/knob/file.h index a0d084f..8862098 100644 --- a/src/user/include/knob/file.h +++ b/src/user/include/knob/file.h @@ -2,6 +2,7 @@ #define KNOB_FILE_H #include +#include struct file; @@ -9,7 +10,6 @@ const char *remove_prefix(const char *path, uint8_t *dn_out); struct file *open_file(const char *path); void close_file(struct file *f); -void _close_all_files(); uint32_t read_from_file(struct file *f, uint32_t max, void *buf); //return value and max_length don't include null terminator @@ -19,4 +19,7 @@ int32_t seek_file_by(struct file *f, int32_t by); uint32_t file_size(struct file *f) __attribute__ ((pure)); +//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); + #endif \ No newline at end of file diff --git a/src/user/include/knob/quit.h b/src/user/include/knob/quit.h deleted file mode 100644 index 7b10d09..0000000 --- a/src/user/include/knob/quit.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef KNOB_QUIT_H -#define KNOB_QUIT_H - -void on_quit(void (*run_f)()); -void quit() __attribute__ ((noreturn)); - -#endif \ No newline at end of file diff --git a/src/user/include/knob/user.h b/src/user/include/knob/user.h index 479a731..cd7676c 100644 --- a/src/user/include/knob/user.h +++ b/src/user/include/knob/user.h @@ -2,6 +2,9 @@ #define KNOB_USER_H #include +#include + +char key_to_char(_key_code_t key) __attribute__ ((const)); void tell_user_sz(const char *sz); -- cgit v1.2.3