From owner-freebsd-hackers Sat Aug 29 12:07:39 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id MAA26224 for freebsd-hackers-outgoing; Sat, 29 Aug 1998 12:07:39 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from bingsun2.cc.binghamton.edu (bingsun2.cc.binghamton.edu [128.226.1.6]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id MAA26209 for ; Sat, 29 Aug 1998 12:07:37 -0700 (PDT) (envelope-from bf20761@binghamton.edu) Received: from localhost (bf20761@localhost) by bingsun2.cc.binghamton.edu (8.8.7/8.6.9) with SMTP id PAA18834 for ; Sat, 29 Aug 1998 15:06:39 -0400 (EDT) Date: Sat, 29 Aug 1998 15:06:39 -0400 (EDT) From: zhihuizhang X-Sender: bf20761@bingsun2 To: hackers Subject: Macro cbtorpos() in fs.h Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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