Please refer the quoted text. ---------- Forwarded message ---------- From: Rohit Sharma <imreckless@xxxxxxxxx> Date: Mon, Sep 15, 2008 at 10:50 PM Subject: Re: reading superblock To: Manish Katiyar <mkatiyar@xxxxxxxxx> 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. > that sounds good. I'll try it. > 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. > Yes , i am making a kernel module for doing that. I saw that ext2_super_block is always cached in memory, so is there a way to do that. >> >> 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. > > 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