FS to physical disk block conversion

Gary Jennejohn gljennjohn at googlemail.com
Wed May 26 15:07:22 UTC 2010


On Wed, 26 May 2010 21:09:38 +0000
Dima Naumov <shadow_user at rambler.ru> wrote:

> I am sorry for my English. OK my problem: i do not understand how i can 
> get real address of disk block, when i use macros fsbtodb() to convert 
> fs address to physical disk block address i receive odd result, explain 
> me please where my error.
> Example:
>          struct fs *sblock;
>          ino_t inode = 2;
>          caddr_t inoblock;
>          struct ufs2_dinode * ino;
>          ...
>          if(pread(dev_fd, ino, sizeof(struct ufs2_dinode),\
>                  (sblock->fs_bsize * fsbtodb(sblock, \
>                  ino_to_fsba(sblock, inode)))) != sizeof(struct 
> ufs2_dinode))
>                                  error(__LINE__, errno);
> After executing this string a not get correct inode in "ino". Please 
> explain, it important to me!
> 

See /usr/src/sbin/dump/traverse.c:getino() for how to do it.

--
Gary Jennejohn


More information about the freebsd-fs mailing list