Nanakos Chrysostomos wrote:

> 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 */

The layout of a filesystem depends entirely upon the filesystem type
(ext2, vfat etc).

You should look at the source code for filesystem specific tools (e.g.
e2fsprogs, dosfstools etc) for example code.

-- 
Glynn Clements <[EMAIL PROTECTED]>
-
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