From 1acc542400d15ddf32f44e3f1ddb82f9c9fe4aab Mon Sep 17 00:00:00 2001 From: "leleraffa97@hotmail.it" Date: Sat, 26 Aug 2017 11:11:39 +0200 Subject: File system initialization Simple I/O (sio) interfaced, not yet implemented --- sw/z80/kernel/include/fs/dirent.h | 13 ++++++++ sw/z80/kernel/include/fs/fs.h | 65 +++++++++++++++++++++++++++++++++++++++ sw/z80/kernel/include/fs/mount.h | 15 +++++++++ sw/z80/kernel/include/fs/users.h | 6 ++++ 4 files changed, 99 insertions(+) create mode 100644 sw/z80/kernel/include/fs/dirent.h create mode 100644 sw/z80/kernel/include/fs/fs.h create mode 100644 sw/z80/kernel/include/fs/mount.h create mode 100644 sw/z80/kernel/include/fs/users.h (limited to 'sw/z80/kernel/include/fs') diff --git a/sw/z80/kernel/include/fs/dirent.h b/sw/z80/kernel/include/fs/dirent.h new file mode 100644 index 0000000..ea5699b --- /dev/null +++ b/sw/z80/kernel/include/fs/dirent.h @@ -0,0 +1,13 @@ +#ifndef DIRENT_H +#define DIRENT_H + +#include "types.h" + +struct dirent +{ + ino_t i_number; // inode referred + uint8_t name_size; // size of the name + char name[]; // name of the referred inode +} + +#endif diff --git a/sw/z80/kernel/include/fs/fs.h b/sw/z80/kernel/include/fs/fs.h new file mode 100644 index 0000000..62bef36 --- /dev/null +++ b/sw/z80/kernel/include/fs/fs.h @@ -0,0 +1,65 @@ +#ifndef INODE_H +#define INODE_H + +#include "types.h" + +#define FS_OFFSET 0x1000 + +#define FS_BLOCKS_SIZE 512 +#define FS_BLOCKS_N 8 +#define FS_BLOCKS_IND 6 + +#define INODE_TYPE_FILE 0x0 +#define INODE_TYPE_DIR 0x1 +#define INODE_TYPE_HLINK 0x2 +#define INODE_TYPE_SLINK 0x3 + +typedef struct time_s +{ + struct + { + uint minutes :6; + uint hour :5; + + } time; + + struct + { + uint day :5; + uint month :4; + uint year :12; + + } date; + +} time_t; + +struct fs_superblock +{ + uint8_t magic; // identifier + + uint16_t blk_size; // size of a single block + uint16_t imap_size; // quantity of inodes + uint16_t dmap_size; // quantity of blocks +} + +struct fs_inode +{ + + /* inode meta data */ + uint mode :3; // chmod + uint uid :3; // chown + uint type :2; // file, dir, hard-link, sym-link + + /* data storage informations */ + uint24_t size; + uint16_t blocks[FS_BLOCKS_N]; + +} + +struct fs_inumber +{ + uint dev : 4; // device id, global in the fs + ino_t rel; // inode id relative to the volume +} + +#endif diff --git a/sw/z80/kernel/include/fs/mount.h b/sw/z80/kernel/include/fs/mount.h new file mode 100644 index 0000000..a0edd5d --- /dev/null +++ b/sw/z80/kernel/include/fs/mount.h @@ -0,0 +1,15 @@ +#ifndef MOUNT_H +#define MOUNT_H + +#include "fs.h" + +#define FS_MOUNT_LIMIT 16 + +struct fs_mount_point +{ + struct fs_inumber inode; // dir mounted + uint serial_port :4; + struct fs_superblock superblock; // block informations +} + +#endif diff --git a/sw/z80/kernel/include/fs/users.h b/sw/z80/kernel/include/fs/users.h new file mode 100644 index 0000000..7e4016b --- /dev/null +++ b/sw/z80/kernel/include/fs/users.h @@ -0,0 +1,6 @@ +#ifndef USERS_H +#define USERS_H + + + +#endif -- cgit v1.2.1 From 57a35f750781dad141dc5ab6120afe9c1244981f Mon Sep 17 00:00:00 2001 From: "leleraffa97@hotmail.it" Date: Sat, 26 Aug 2017 14:49:07 +0200 Subject: time to inode --- sw/z80/kernel/include/fs/fs.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sw/z80/kernel/include/fs') diff --git a/sw/z80/kernel/include/fs/fs.h b/sw/z80/kernel/include/fs/fs.h index 62bef36..2a0e9d4 100644 --- a/sw/z80/kernel/include/fs/fs.h +++ b/sw/z80/kernel/include/fs/fs.h @@ -50,6 +50,8 @@ struct fs_inode uint uid :3; // chown uint type :2; // file, dir, hard-link, sym-link + time_t ctime; // creation time + /* data storage informations */ uint24_t size; uint16_t blocks[FS_BLOCKS_N]; -- cgit v1.2.1