Date: Sat, 29 Aug 1998 15:06:39 -0400 (EDT) From: zhihuizhang <bf20761@binghamton.edu> To: hackers <freebsd-hackers@FreeBSD.ORG> Subject: Macro cbtorpos() in fs.h Message-ID: <Pine.SOL.L3.93.980829145113.18319A-100000@bingsun2>
next in thread | raw e-mail | index | archive | help
I am trying to understand the macro cbtorpos() defined below: #define cbtorpos(fs, bno) \ (((bno) * NSPF(fs) % (fs)->fs_spc / (fs)->fs_nsect * (fs)->fs_trackskew + \ (bno) * NSPF(fs) % (fs)->fs_spc % (fs)->fs_nsect * (fs)->fs_interleave) % \ (fs)->fs_nsect * (fs)->fs_nrpos / (fs)->fs_npsect) First I assume that the hard disk sectors are numbered from one cylinder to another, moving from top track to the bottom track before moving to the next cylinder. (This is the vertical mapping as described at the site http:/www.tomshardware.com/hdd.html). Otherwise, the macro might not make any sense. So bno * NSPF % fs_spc / fs_nsect will give us the track number and bno * NSPF % fs_spc % fs_nsect will give us the sector count within that track. However, the rest part of the macro is confusing to me. In particular, why we multiply fs_trackskew? What is the meaning of fs_nrpos (number of rotational positions in a single track?) Why we divide by fs_nsect after multiplying by fs_interleave? I assume that fs_nsect + unused sectors = fs_npsect and the C operators %, /, and * all have same precedence. Any help is appreciated. -------------------------------------------------- | Zhihui Zhang, http://cs.binghamton.edu/~zzhang | | Dept. of Computer Science, SUNY at Binghamton | -------------------------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SOL.L3.93.980829145113.18319A-100000>