(Need dev help) how do I dereference an inode pointer?

I’m trying to write a parser for BeFS, to later use as a foundation for a Windows driver.

I’m ashamed to say I didn’t make it very far, and right now I’m stuck unable to find the root node from the superblock (it gives me a bad magic value.

To make matters worse when looking through the partition in a hex editor I found multiple inodes that claimed to be the first inode in the eighth ag. (isn’t this impossible???)

My code is here if you’re willing to take a look:
badasahog/BeFS: Windows Driver for BeFS Filesystem (wip)

I have found a way to find an inode, but it claims to be in allocation group 32, instead of 8 like it should be! this is maddening.

If any dev can help me rationalize it would be very much appreciated.

The code in the link has been updated:
badasahog/BeFS: Windows Driver for BeFS Filesystem (wip)

is the blocks_per_ag field in the super block the number of bitmap blocks or the number of blocks total? The book is super unclear and seams to give conflicting information

When in doubt, I would encourage taking a look at the BFS driver code in Haiku. It’s quite readable and should hopefully allow you to answer any questions you have :slight_smile:

blocks_per_ag is mostly accessed via this function which then gets forwarded to BlockAllocator and then used there as well.


What’s throwing me off is where the bitmaps are stored.

which of these is correct?