From 277cfd923d2de74fd2aef03e80c46436b50e14de Mon Sep 17 00:00:00 2001 From: Guamss Date: Thu, 26 Mar 2026 12:06:56 +0100 Subject: [PATCH] add : struct of inode, bloc and disk --- src/const.h | 9 ++++++++- src/struct.h | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 src/struct.h diff --git a/src/const.h b/src/const.h index 0bad2d1..0749a3c 100644 --- a/src/const.h +++ b/src/const.h @@ -1 +1,8 @@ -#define BUFSIZE 1024 \ No newline at end of file +#define BUFSIZE 1024 +#define MAX_BLOCS_PER_INODE 30 +#define MAX_BYTES_PER_BLOC 1024 + +#define FILE 0 +#define BINARY 1 +#define DIRECTORY 2 +#define SYMBOLIC_LINK 3 \ No newline at end of file diff --git a/src/struct.h b/src/struct.h new file mode 100644 index 0000000..0a2c229 --- /dev/null +++ b/src/struct.h @@ -0,0 +1,20 @@ +#pragma once +#include "const.h" + +typedef struct inode { + char perms[8]; // rwxrwxrwx + char filetype; // d, -, l + int blocs[MAX_BLOCS_PER_INODE]; +} inode; + +typedef struct bloc { + char datas[MAX_BYTES_PER_BLOC]; +} bloc; + +typedef struct disk { + inode inodes[10]; + bloc blocs[30]; +} disk; + +// pour 10 inode qui a 30 blocs de chacun 1024 octets, on a 307200 octets, soit +// 307,2 Ko sur le disque \ No newline at end of file