Re: reading superblock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Mon, Sep 15, 2008 at 10:21 PM, Manish Katiyar <mkatiyar@xxxxxxxxx> wrote:
On Mon, Sep 15, 2008 at 10:11 PM, Rohit Sharma <imreckless@xxxxxxxxx> wrote:
> I want to read ext2 superblock and display the structure.

I assume you want to do it from userspace. ext2_fill_super() is called
during mount time in kernel space. To read from userspace all you need
is to open the device file and read a char buffer of 1024 at an offset
of 1024 bytes and typecast it with ext2_super_block.

You can get the definition of ext2_super_block from ext2_fs.h (You may
already be having it in your /usr/include/ext2fs) and then you can
print whatever fields you want. Alternatively you may also look at how
debugfs does it (download source of e2fsprogs-1.41 from
sourceforge.net) for detailed info.

If you want to do in kernel space, the simplest option that i can
think of is to traverse registered filesystems and then grab a copy of
superblock and print it.

>
> which function do i need to call for that.
> is it ext2_get_sb() or ext2_fill_super() or both ??
>
> this is the function prototype:
> static int ext2_fill_super(struct super_block *sb, void *data, int silent)
>
> what are the parameters data and silent used for.

"data" is generally the char * to the parameters that you pass during
mount which are parsed and appropriate flags are set in filesystem..
"silent" is more of debugging flag and prints some messages.

Silent indicates not to print any debug or other messages.

Hope that helps

Thanks -
Manish

> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ




--
Regards,
Sandeep.






"To learn is to change. Education is a process that changes the learner."

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux