I am trying to access the superblock in the opening and reading in of a ext2 filesystem from a vdi file. I want to use the struct ext2_super_block that exists in the ext2.h file (see line 415 of http://lxr.free-electrons.com/source/fs/ext2/ext2.h). I would like to just #include <ext2.h>
but since my current unix OS is ext3/ext4 the header file is not in my system, nor is any of the files that ext2.h needs to include.
How can I include this file do get that struct? Should I be building it (the struct to hold the superblock upon read in) on my own? If I build it on my own how will the read in differ?
Here's what I have so far for my system calls to complete this (obviously don't work at the moment):
fd = open (argv[1], O_RDONLY);
.......check for errors in open
lseek(fd, OFFSET, SEEK_SET); //to skip to superblock
read (fd, &mySB, sizeof(struct ext2_superblock));