Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Oct 2005 23:10:34 -0400
From:      "Eric Sheridan" <esheri3@tiger.towson.edu>
To:        freebsd-fs@freebsd.org
Subject:   UFS Inode Direct Blocks
Message-ID:  <20051026025920.M65847@tiger.towson.edu>

next in thread | raw e-mail | index | archive | help
Hello Everyone:

My name is Eric and I am working on a project which traverses the inodes of
the disk in order to map out the file system. I am able to read in the
superblock with the SBLOCK_UFS2 offset. I am able to read in any disk inode
using the following offsets:

ib = fsbtodb(superblock, itod(superblock, i_num));
lseek(fd, ib*DEV_BSIZE, SEEK_SET);
read(fd, buffer, sizeof(buffer));
d = (struct ufs2_dinode *)buffer + itoo(superblock, i_num);

*Note* I have defines for the itoo and itod to appropriate ino_to_*'s

However, given the dinode, I do not know how to seek to the direct blocks of
the dinode. My question is how do I seek to these direct blocks stored in
di_db[] using all of these available macros? What is stored in these data
blocks? If the inode represents a directory, then do the data blocks contain
"struct ufs2_direct"s? If I am able to get file names from directory inodes,
then I will be able to map out every file on the system. This is my first
post, so I appologize for being either too vague or too verbose. Thank you
everyone in advance for your help.

-Eric Sheridan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051026025920.M65847>