On Tue, 26 Jul 2005, Nanakos Chrysostomos wrote:

> Hi all,
> i want to read the superblock & inode for a block device.
> I dont want to use readdir to get the inode and dir name.I want to do it
> like the skeleton below,can someone help me??
>
>
> #include <sys/types.h>
> #include <stdio.h>
>
> int main()
> {
>
> struct what_struct d; /* What struct to use for inode*/
> struct what_struct_sb sb; /*What struct to use for superblock */
> int fd;
>
> fd=open("/dev/hda1",0);
> lseek(fd,4096L,0); /* Is this the first inode?? Where is the next one?*/
> /*Where is the superblock allocated in the disk */
> read(fd,&d,sizeof(d));
> /*Retrieve information now ....*/
>
> return 0;
> }

your best bet is to get a copy of the kernel source and check out the
directory fs/ext3, particularly the source files super.c and inode.c.

rday
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" 
in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to