From 740ae2e69995df37c44fe61f57642ee642982ca2 Mon Sep 17 00:00:00 2001 From: Miguel Date: Sun, 16 Sep 2018 11:39:36 +0200 Subject: cleanup and starting improve mounts and file access (pipes, sysfiles, ext2) --- xxx/file.c | 4 ++++ xxx/file.h | 26 ++++++++++++++++++++++++++ xxx/mount.c | 12 ++++++++++++ xxx/mount.h | 23 +++++++++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 xxx/file.c create mode 100644 xxx/file.h create mode 100644 xxx/mount.c create mode 100644 xxx/mount.h (limited to 'xxx') diff --git a/xxx/file.c b/xxx/file.c new file mode 100644 index 0000000..185c3a9 --- /dev/null +++ b/xxx/file.c @@ -0,0 +1,4 @@ +#include "file.h" + + + diff --git a/xxx/file.h b/xxx/file.h new file mode 100644 index 0000000..53c96d8 --- /dev/null +++ b/xxx/file.h @@ -0,0 +1,26 @@ +#ifndef FILE_H +#define FILE_H + +#include + +#define FILE_MAX_FILES 100; + +typedef struct +{ + int(* seek)(int offset, int whence); + + int(* read)(char *buf, int len); + int(* wrtie)(char *buf, int len); + + int(* close)(); + int(* stat)(void *buf); + + void *data; //opaque + +}file; + + + + + +#endif diff --git a/xxx/mount.c b/xxx/mount.c new file mode 100644 index 0000000..cb741f9 --- /dev/null +++ b/xxx/mount.c @@ -0,0 +1,12 @@ +#include "mount.h" + +void mount_add(char *path, void *data, + file (*open) (struct mount_struct*,char *path), + int (*getdents)(struct mount_struct*, uint32_t file_desciptor, fs_dirent *entries, uint32_t max_count)) +{ +} + +mount *mounts_get() +{ + return 0; +} diff --git a/xxx/mount.h b/xxx/mount.h new file mode 100644 index 0000000..a327e2e --- /dev/null +++ b/xxx/mount.h @@ -0,0 +1,23 @@ +#ifndef MOUNT_H +#define MOUNT_H + +#define MOUNT_MAX_MOUNTS 10 + +#include +#include "file.h" +#include "interface/fs.h" + +typedef struct mount_struct +{ + char path[256]; // where are we mounted + int (*getdents) (struct mount_struct*, uint32_t file_desciptor, fs_dirent *entries, uint32_t max_count); + file (*open) (struct mount_struct*,char *path); + void *data; //opaque + +}mount; + +mount *mounts_get(); +void mount_add(char *path, void *data,file (*open)(struct mount_struct*,char *path),int (*getdents)(struct mount_struct*, uint32_t file_desciptor, fs_dirent *entries, uint32_t max_count)); + +// +#endif -- cgit v1.2.3