From owner-freebsd-fs@FreeBSD.ORG Wed Oct 26 03:10:38 2005 Return-Path: X-Original-To: freebsd-fs@freebsd.org Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0E67F16A41F for ; Wed, 26 Oct 2005 03:10:38 +0000 (GMT) (envelope-from esheri3@tiger.towson.edu) Received: from mail3.towson.edu (mail3.towson.edu [136.160.180.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id A7CDA43D46 for ; Wed, 26 Oct 2005 03:10:37 +0000 (GMT) (envelope-from esheri3@tiger.towson.edu) Received: from tiger.towson.edu (tiger.towson.edu [136.160.180.166]) by mail3.towson.edu (8.13.4/8.13.4) with ESMTP id j9Q3AYQr015199 for ; Tue, 25 Oct 2005 23:10:34 -0400 (EDT) From: "Eric Sheridan" To: freebsd-fs@freebsd.org Date: Tue, 25 Oct 2005 23:10:34 -0400 Message-Id: <20051026025920.M65847@tiger.towson.edu> X-Mailer: Open WebMail 2.10 20030617 X-OriginatingIP: 69.143.98.150 (esheri3) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Spam-Score: -2.303 () BAYES_00,DNS_FROM_RFC_WHOIS X-Spam-Status: No X-Scanned-By: MIMEDefang 2.52 on 10.4.0.41 Subject: UFS Inode Direct Blocks X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Oct 2005 03:10:38 -0000 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