Subject: Supporting sector size != DEV_BSIZE on lfs
To: None <tech-kern@netbsd.org>
From: Trevin Beattie <trevin@xmission.com>
List: tech-kern
Date: 06/19/2002 14:08:21
More confusion.
I've come up to a piece of code which uses the macro fragstofsb(), so I
tried looking at the #definition of fragstofsb to figure out what the input
/ output units should be. The macro combines the following three variables:
lfs_blktodb -- I *think* this converts lfs blocks to/from sectors (the
comment "blktodb and dbtoblk shift constant" does NOT help at ALL)
lfs_fbshift -- converts lfs frags to/from blocks (according to the comment
"fast mult/div for frag from block")
lfs_fsbtodb -- I *think* this converts lfs frags to/from sectors (the
comment "fsbtodb abd dbtodsb shift constant" does NOT help at ALL; plus it
sounds like the writer had a cold ;)
If I substitute units into the equation "((fs)->lfs_blktodb -
(fs)->lfs_fbshift - (fs)->lfs_fsbtodb)", I get the following:
sectors blocks frags 1
------- * ------ * ------- = ---
blocks frags sectors 1
!! Following my assumptions, the macro fragstofsb() does nothing!!
Obviously I must have made a mistake somewhere.
According to sbin/newfs_lfs/lfs.c, my assessment of lfs_blktodb is correct
(lines 362-363). So is lfs_fsbtodb (line 364). So, in fact, is
lfs_fbshift (lines 311, 313, and lfs.h line 299). SO WHAT THE HECK IS
WRONG HERE?!? (Sorry for shouting. I'm just frustrated due to my lack of
experience with LFS.)
-----------------------
Trevin Beattie "Do not meddle in the affairs of wizards,
trevin@xmission.com for you are crunchy and good with ketchup."
{:-> --unknown