summaryrefslogtreecommitdiff
path: root/fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs.h')
-rw-r--r--fs.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/fs.h b/fs.h
new file mode 100644
index 0000000..b710e1c
--- /dev/null
+++ b/fs.h
@@ -0,0 +1,28 @@
+// on-disk file system format
+
+// second sector
+struct superblock{
+ int nblocks;
+ int ninodes;
+};
+
+#define NDIRECT 14
+
+// inodes start at the third sector
+// and blocks start at (ninodes * sizeof(dinode) + 511) / 512
+struct dinode {
+ short type;
+ short nlink;
+ uint size;
+ uint addrs[NDIRECT];
+};
+#define T_DIR 1
+#define T_FILE 2
+
+#define IPB (512 / sizeof(struct dinode))
+
+struct dirent {
+ ushort inum;
+ char name[14];
+};
+