public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* HDIO_GETGEO vs. BLKGETSIZE
@ 2000-05-22 12:06 David Woodhouse
  2000-05-22 14:17 ` Andries Brouwer
  0 siblings, 1 reply; 7+ messages in thread
From: David Woodhouse @ 2000-05-22 12:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: mtd

Is it permitted for a driver to returns CHS values for HDIO_GETGEO which, 
when multiplied together, don't match the value returned by BLKGETSIZE?

i.e. Is the code in the second 'if' statement below actually necessary?


        thisNFTL->cylinders = 1024;
        thisNFTL->heads = 16;

        temp = thisNFTL->cylinders * thisNFTL->heads;
        thisNFTL->sectors = thisNFTL->nr_sects / temp;

        if (thisNFTL->nr_sects % temp) {
                thisNFTL->sectors++;
                temp = thisNFTL->cylinders * thisNFTL->sectors;
                thisNFTL->heads = thisNFTL->nr_sects / temp;

                if (thisNFTL->nr_sects & temp) {
                        thisNFTL->heads++;
                        temp = thisNFTL->heads * thisNFTL->sectors;
                        thisNFTL->cylinders = thisNFTL->nr_sects / temp;
                }
        }
	/* Do we really need to do this.... ? */
        if (thisNFTL->nr_sects != thisNFTL->heads * thisNFTL->cylinders *
            thisNFTL->sectors) {
                printk("NFTL capacity reduced for geometry reasons from %lx to %x sectors\n", thisNFTL->nr_sects, 
                       thisNFTL->heads * thisNFTL->cylinders * thisNFTL->sectors);

                thisNFTL->nr_sects = thisNFTL->heads * thisNFTL->cylinders * thisNFTL->sectors;
        }


--
dwmw2




To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2000-05-22 23:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-05-22 12:06 HDIO_GETGEO vs. BLKGETSIZE David Woodhouse
2000-05-22 14:17 ` Andries Brouwer
2000-05-22 14:21   ` David Woodhouse
2000-05-22 14:30     ` Andries Brouwer
2000-05-22 15:47       ` David Woodhouse
2000-05-22 16:05         ` Andries Brouwer
2000-05-22 23:14   ` Andre Hedrick

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox