got back to work on my kernel a bit. settled on a filesystem to use. idk what this type of filesystem is called if it already exists cuz I just pulled it out of my ass so somebody please let me know
the disk is divided evenly into blocks.
an inode (if that's the right terminology?) is just the first block of the file/directory. if the file or directory contents exceed the block size, it allocates a new block, and stores a pointer to it. kinda like a linked list.
for directories, the data in the inode is a list of inodes of the files within, along with their filename and type. the type not only determines how the OS treats it but also how the kernel treats it—a file of a type relating to a directory type is treated as a directory.
this does mean that theres no way for the kernel to know if an inode is a file or directory, without looking at the parent directory.
inode zero, the first block on the disk, is always treated as a directory, which is the root.
the user can choose to reserve some blocks for listing which blocks are used, so that it doesn't have to seek the whole disk for a free block.
if the block is at the end of the chain, the bytes used for identifying the next block in the chain is reused for showing how many bytes are in the block, so that content can be of any size, not just a multiple of the block data size.
for example, if blocks are 512 bytes each with 510bytes of storage, the inode will point to the first block. the first block will have the first 510 bytes in it, a flag stating theres a next block, and the block ID of the next block. that next block can have the next 510 bytes, and so on. once you reach the end of the data, the flag is unset for that final block, and the amount of bytes stored in that final block is stored.












