Writing a file system from scratch in Rust
blog.carlosgaldino.com
blog.carlosgaldino.com
In a production Rust filesystem, I would not use libc types lid uid_t and gid_t in defining the on-disk format -- they may vary from libc to libc, but you probably want your filesystem to be portable between systems.
It says "A single indirect pointer can point - (12 + 1024) * 4 KiB" that is 4MiB file.
My question is, what does 1024 represent. I understand 12 is the number of direct pointers and we are multiplying it by 4 considering a pointer takes 4 bytes of space. Would help if anyone explains it.
Might be a silly question, sorry about that. But ya, thanks for the help!
The "1024" appears to be the single indirect pointers: it seems like the inode only has 1 "single indirect pointer", so that points to a block's worth of pointers. (Hence the "indirect" part.) A block in this design is 4 KiB, and a pointer in this design is 4 B, so the block of pointers will hold 4 KiB / (4 B/pointer) = 1024 pointers — that's the "1024".
Many thanks.