All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] Rename SECTOR_SIZE to IDE_SECTOR_SIZE
@ 2004-10-27  6:08 Chris Wedgwood
  2004-10-27  6:47 ` Jeff Garzik
  0 siblings, 1 reply; 9+ messages in thread
From: Chris Wedgwood @ 2004-10-27  6:08 UTC (permalink / raw)
  To: LKML; +Cc: Chris Wedgwood, Bartlomiej Zolnierkiewicz

The token SECTOR_SIZE is used in multiple places that have (almost)
the same defintion everywhere.

How do people feel about rename this vague token?



===== drivers/char/ftape/lowlevel/ftape-bsm.h 1.2 vs edited =====
--- 1.2/drivers/char/ftape/lowlevel/ftape-bsm.h	2004-04-29 02:41:09 -07:00
+++ edited/drivers/char/ftape/lowlevel/ftape-bsm.h	2004-10-26 17:15:36 -07:00
@@ -36,7 +36,7 @@
 
 /*  maximum (format code 4) bad sector map size (bytes).
  */
-#define BAD_SECTOR_MAP_SIZE     (29 * SECTOR_SIZE - 256)
+#define BAD_SECTOR_MAP_SIZE     (29 * IDE_SECTOR_SIZE - 256)
 
 /*  format code 4 bad sector entry, ftape uses this
  *  internally for all format codes
===== drivers/ide/ide-cd.c 1.96 vs edited =====
--- 1.96/drivers/ide/ide-cd.c	2004-10-25 13:06:46 -07:00
+++ edited/drivers/ide/ide-cd.c	2004-10-26 17:43:24 -07:00
@@ -965,7 +965,7 @@ static void cdrom_buffer_sectors (ide_dr
 
 	/* Number of sectors to read into the buffer. */
 	int sectors_to_buffer = min_t(int, sectors_to_transfer,
-				     (SECTOR_BUFFER_SIZE >> SECTOR_BITS) -
+				     (CD_SECTOR_BUFFER_SIZE >> CD_SECTOR_BITS) -
 				       info->nsectors_buffered);
 
 	char *dest;
@@ -979,18 +979,18 @@ static void cdrom_buffer_sectors (ide_dr
 		info->sector_buffered = sector;
 
 	/* Read the data into the buffer. */
-	dest = info->buffer + info->nsectors_buffered * SECTOR_SIZE;
+	dest = info->buffer + info->nsectors_buffered * IDE_SECTOR_SIZE;
 	while (sectors_to_buffer > 0) {
-		HWIF(drive)->atapi_input_bytes(drive, dest, SECTOR_SIZE);
+		HWIF(drive)->atapi_input_bytes(drive, dest, IDE_SECTOR_SIZE);
 		--sectors_to_buffer;
 		--sectors_to_transfer;
 		++info->nsectors_buffered;
-		dest += SECTOR_SIZE;
+		dest += IDE_SECTOR_SIZE;
 	}
 
 	/* Throw away any remaining data. */
 	while (sectors_to_transfer > 0) {
-		static char dum[SECTOR_SIZE];
+		static char dum[IDE_SECTOR_SIZE];
 		HWIF(drive)->atapi_input_bytes(drive, dum, sizeof (dum));
 		--sectors_to_transfer;
 	}
@@ -1093,9 +1093,9 @@ static ide_startstop_t cdrom_read_intr (
 		return ide_stopped;
 
 	/* Assume that the drive will always provide data in multiples
-	   of at least SECTOR_SIZE, as it gets hairy to keep track
+	   of at least IDE_SECTOR_SIZE, as it gets hairy to keep track
 	   of the transfers otherwise. */
-	if ((len % SECTOR_SIZE) != 0) {
+	if ((len % IDE_SECTOR_SIZE) != 0) {
 		printk ("%s: cdrom_read_intr: Bad transfer size %d\n",
 			drive->name, len);
 		if (CDROM_CONFIG_FLAGS(drive)->limit_nframes)
@@ -1109,7 +1109,7 @@ static ide_startstop_t cdrom_read_intr (
 	}
 
 	/* The number of sectors we need to read from the drive. */
-	sectors_to_transfer = len / SECTOR_SIZE;
+	sectors_to_transfer = len / IDE_SECTOR_SIZE;
 
 	/* First, figure out if we need to bit-bucket
 	   any of the leading sectors. */
@@ -1117,7 +1117,7 @@ static ide_startstop_t cdrom_read_intr (
 
 	while (nskip > 0) {
 		/* We need to throw away a sector. */
-		static char dum[SECTOR_SIZE];
+		static char dum[IDE_SECTOR_SIZE];
 		HWIF(drive)->atapi_input_bytes(drive, dum, sizeof (dum));
 
 		--rq->current_nr_sectors;
@@ -1149,8 +1149,8 @@ static ide_startstop_t cdrom_read_intr (
 			/* Read this_transfer sectors
 			   into the current buffer. */
 			while (this_transfer > 0) {
-				HWIF(drive)->atapi_input_bytes(drive, rq->buffer, SECTOR_SIZE);
-				rq->buffer += SECTOR_SIZE;
+				HWIF(drive)->atapi_input_bytes(drive, rq->buffer, IDE_SECTOR_SIZE);
+				rq->buffer += IDE_SECTOR_SIZE;
 				--rq->nr_sectors;
 				--rq->current_nr_sectors;
 				++rq->sector;
@@ -1175,7 +1175,7 @@ static int cdrom_read_from_buffer (ide_d
 	struct request *rq = HWGROUP(drive)->rq;
 	unsigned short sectors_per_frame;
 
-	sectors_per_frame = queue_hardsect_size(drive->queue) >> SECTOR_BITS;
+	sectors_per_frame = queue_hardsect_size(drive->queue) >> CD_SECTOR_BITS;
 
 	/* Can't do anything if there's no buffer. */
 	if (info->buffer == NULL) return 0;
@@ -1190,9 +1190,9 @@ static int cdrom_read_from_buffer (ide_d
 
 		memcpy (rq->buffer,
 			info->buffer +
-			(rq->sector - info->sector_buffered) * SECTOR_SIZE,
-			SECTOR_SIZE);
-		rq->buffer += SECTOR_SIZE;
+			(rq->sector - info->sector_buffered) * IDE_SECTOR_SIZE,
+			IDE_SECTOR_SIZE);
+		rq->buffer += IDE_SECTOR_SIZE;
 		--rq->current_nr_sectors;
 		--rq->nr_sectors;
 		++rq->sector;
@@ -1236,7 +1236,7 @@ static ide_startstop_t cdrom_start_read_
 	unsigned short sectors_per_frame;
 	int nskip;
 
-	sectors_per_frame = queue_hardsect_size(drive->queue) >> SECTOR_BITS;
+	sectors_per_frame = queue_hardsect_size(drive->queue) >> CD_SECTOR_BITS;
 
 	/* If the requested sector doesn't start on a cdrom block boundary,
 	   we must adjust the start of the transfer so that it does,
@@ -1298,7 +1298,7 @@ static ide_startstop_t cdrom_start_seek_
 	struct request *rq = HWGROUP(drive)->rq;
 	sector_t frame = rq->sector;
 
-	sector_div(frame, queue_hardsect_size(drive->queue) >> SECTOR_BITS);
+	sector_div(frame, queue_hardsect_size(drive->queue) >> CD_SECTOR_BITS);
 
 	memset(rq->cmd, 0, sizeof(rq->cmd));
 	rq->cmd[0] = GPCMD_SEEK;
@@ -1323,7 +1323,7 @@ static ide_startstop_t cdrom_start_seek 
 static void restore_request (struct request *rq)
 {
 	if (rq->buffer != bio_data(rq->bio)) {
-		sector_t n = (rq->buffer - (char *) bio_data(rq->bio)) / SECTOR_SIZE;
+		sector_t n = (rq->buffer - (char *) bio_data(rq->bio)) / IDE_SECTOR_SIZE;
 
 		rq->buffer = bio_data(rq->bio);
 		rq->nr_sectors += n;
@@ -1344,7 +1344,7 @@ static ide_startstop_t cdrom_start_read 
 	struct request *rq = HWGROUP(drive)->rq;
 	unsigned short sectors_per_frame;
 
-	sectors_per_frame = queue_hardsect_size(drive->queue) >> SECTOR_BITS;
+	sectors_per_frame = queue_hardsect_size(drive->queue) >> CD_SECTOR_BITS;
 
 	/* We may be retrying this request after an error.  Fix up
 	   any weirdness which might be present in the request packet. */
@@ -1837,7 +1837,7 @@ static ide_startstop_t cdrom_write_intr(
 	if (cdrom_write_check_ireason(drive, len, ireason))
 		return ide_stopped;
 
-	sectors_to_transfer = len / SECTOR_SIZE;
+	sectors_to_transfer = len / IDE_SECTOR_SIZE;
 
 	/*
 	 * now loop and write out the data
@@ -1856,8 +1856,8 @@ static ide_startstop_t cdrom_write_intr(
 		this_transfer = min_t(int, sectors_to_transfer, rq->current_nr_sectors);
 
 		while (this_transfer > 0) {
-			HWIF(drive)->atapi_output_bytes(drive, rq->buffer, SECTOR_SIZE);
-			rq->buffer += SECTOR_SIZE;
+			HWIF(drive)->atapi_output_bytes(drive, rq->buffer, IDE_SECTOR_SIZE);
+			rq->buffer += IDE_SECTOR_SIZE;
 			--rq->nr_sectors;
 			--rq->current_nr_sectors;
 			++rq->sector;
@@ -1893,7 +1893,7 @@ static ide_startstop_t cdrom_start_write
 {
 	struct cdrom_info *info = drive->driver_data;
 	struct gendisk *g = drive->disk;
-	unsigned short sectors_per_frame = queue_hardsect_size(drive->queue) >> SECTOR_BITS;
+	unsigned short sectors_per_frame = queue_hardsect_size(drive->queue) >> CD_SECTOR_BITS;
 
 	/*
 	 * writes *must* be hardware frame aligned
@@ -2195,7 +2195,7 @@ static int cdrom_read_capacity(ide_drive
 	if (stat == 0) {
 		*capacity = 1 + be32_to_cpu(capbuf.lba);
 		*sectors_per_frame =
-			be32_to_cpu(capbuf.blocklen) >> SECTOR_BITS;
+			be32_to_cpu(capbuf.blocklen) >> CD_SECTOR_BITS;
 	}
 
 	return stat;
@@ -2238,7 +2238,7 @@ static int cdrom_read_toc(ide_drive_t *d
 		struct atapi_toc_entry  ent;
 	} ms_tmp;
 	long last_written;
-	unsigned long sectors_per_frame = SECTORS_PER_FRAME;
+	unsigned long sectors_per_frame = CD_SECTORS_PER_FRAME;
 
 	if (toc == NULL) {
 		/* Try to allocate space. */
@@ -2266,7 +2266,7 @@ static int cdrom_read_toc(ide_drive_t *d
 
 	set_capacity(drive->disk, toc->capacity * sectors_per_frame);
 	blk_queue_hardsect_size(drive->queue,
-				sectors_per_frame << SECTOR_BITS);
+				sectors_per_frame << CD_SECTOR_BITS);
 
 	/* First read just the header, so we know how long the TOC is. */
 	stat = cdrom_read_tocentry(drive, 0, 1, 0, (char *) &toc->hdr,
@@ -3375,7 +3375,7 @@ static int idecd_open(struct inode * ino
 	drive->usage++;
 
 	if (!info->buffer)
-		info->buffer = kmalloc(SECTOR_BUFFER_SIZE,
+		info->buffer = kmalloc(CD_SECTOR_BUFFER_SIZE,
 					GFP_KERNEL|__GFP_REPEAT);
         if (!info->buffer || (rc = cdrom_open(&info->devinfo, inode, file)))
 		drive->usage--;
===== drivers/ide/ide-cd.h 1.11 vs edited =====
--- 1.11/drivers/ide/ide-cd.h	2004-06-18 08:08:15 -07:00
+++ edited/drivers/ide/ide-cd.h	2004-10-26 17:10:27 -07:00
@@ -43,14 +43,11 @@
 
 /************************************************************************/
 
-#define SECTOR_BITS 		9
-#ifndef SECTOR_SIZE
-#define SECTOR_SIZE		(1 << SECTOR_BITS)
-#endif
-#define SECTORS_PER_FRAME	(CD_FRAMESIZE >> SECTOR_BITS)
-#define SECTOR_BUFFER_SIZE	(CD_FRAMESIZE * 32)
-#define SECTORS_BUFFER		(SECTOR_BUFFER_SIZE >> SECTOR_BITS)
-#define SECTORS_MAX		(131072 >> SECTOR_BITS)
+#define CD_SECTOR_BITS 		9
+#define CD_SECTORS_PER_FRAME	(CD_FRAMESIZE >> CD_SECTOR_BITS)
+#define CD_SECTOR_BUFFER_SIZE	(CD_FRAMESIZE * 32)
+#define CD_SECTORS_BUFFER	(SECTOR_BUFFER_SIZE >> CD_SECTOR_BITS)
+#define CD_SECTORS_MAX		(131072 >> CD_SECTOR_BITS)
 
 #define BLOCKS_PER_FRAME	(CD_FRAMESIZE / BLOCK_SIZE)
 
@@ -84,7 +81,7 @@ struct ide_cd_config_flags {
 	__u8 supp_disc_present	: 1; /* Changer can report exact contents
 					of slots. */
 	__u8 limit_nframes	: 1; /* Drive does not provide data in
-					multiples of SECTOR_SIZE when more
+					multiples of CD_SECTOR_SIZE when more
 					than one interrupt is needed. */
 	__u8 seeking		: 1; /* Seeking in progress */
 	__u8 audio_play		: 1; /* can do audio related commands */
===== drivers/ide/ide-io.c 1.34 vs edited =====
--- 1.34/drivers/ide/ide-io.c	2004-10-21 16:46:25 -07:00
+++ edited/drivers/ide/ide-io.c	2004-10-26 17:15:36 -07:00
@@ -686,7 +686,7 @@ void ide_map_sg(ide_drive_t *drive, stru
 	if ((rq->flags & REQ_DRIVE_TASKFILE) == 0) {
 		hwif->sg_nents = blk_rq_map_sg(drive->queue, rq, sg);
 	} else {
-		sg_init_one(sg, rq->buffer, rq->nr_sectors * SECTOR_SIZE);
+		sg_init_one(sg, rq->buffer, rq->nr_sectors * IDE_SECTOR_SIZE);
 		hwif->sg_nents = 1;
 	}
 }
===== drivers/ide/ide-taskfile.c 1.69 vs edited =====
--- 1.69/drivers/ide/ide-taskfile.c	2004-10-25 08:54:48 -07:00
+++ edited/drivers/ide/ide-taskfile.c	2004-10-26 17:15:36 -07:00
@@ -288,12 +288,12 @@ static void ide_pio_sector(ide_drive_t *
 	local_irq_save(flags);
 #endif
 	buf = kmap_atomic(page, KM_BIO_SRC_IRQ) +
-	      sg[hwif->cursg].offset + (hwif->cursg_ofs * SECTOR_SIZE);
+	      sg[hwif->cursg].offset + (hwif->cursg_ofs * IDE_SECTOR_SIZE);
 
 	hwif->nleft--;
 	hwif->cursg_ofs++;
 
-	if ((hwif->cursg_ofs * SECTOR_SIZE) == sg[hwif->cursg].length) {
+	if ((hwif->cursg_ofs * IDE_SECTOR_SIZE) == sg[hwif->cursg].length) {
 		hwif->cursg++;
 		hwif->cursg_ofs = 0;
 	}
@@ -488,7 +488,7 @@ int ide_diag_taskfile (ide_drive_t *driv
 		if (data_size == 0)
 			rq.nr_sectors = (args->hobRegister[IDE_NSECTOR_OFFSET] << 8) | args->tfRegister[IDE_NSECTOR_OFFSET];
 		else
-			rq.nr_sectors = data_size / SECTOR_SIZE;
+			rq.nr_sectors = data_size / IDE_SECTOR_SIZE;
 
 		if (!rq.nr_sectors) {
 			printk(KERN_ERR "%s: in/out command without data\n",
===== drivers/ide/pci/siimage.c 1.35 vs edited =====
--- 1.35/drivers/ide/pci/siimage.c	2004-10-22 09:12:34 -07:00
+++ edited/drivers/ide/pci/siimage.c	2004-10-26 17:15:36 -07:00
@@ -491,7 +491,7 @@ static int siimage_mmio_ide_dma_count (i
 #ifdef SIIMAGE_VIRTUAL_DMAPIO
 	struct request *rq	= HWGROUP(drive)->rq;
 	ide_hwif_t *hwif	= HWIF(drive);
-	u32 count		= (rq->nr_sectors * SECTOR_SIZE);
+	u32 count		= (rq->nr_sectors * IDE_SECTOR_SIZE);
 	u32 rcount		= 0;
 	unsigned long addr	= siimage_selreg(hwif, 0x1C);
 
===== include/linux/ide.h 1.148 vs edited =====
--- 1.148/include/linux/ide.h	2004-10-22 09:12:35 -07:00
+++ edited/include/linux/ide.h	2004-10-26 17:15:36 -07:00
@@ -202,8 +202,8 @@ typedef unsigned char	byte;	/* used ever
 #define PARTN_BITS	6	/* number of minor dev bits for partitions */
 #define PARTN_MASK	((1<<PARTN_BITS)-1)	/* a useful bit mask */
 #define MAX_DRIVES	2	/* per interface; 2 assumed by lots of code */
-#define SECTOR_SIZE	512
-#define SECTOR_WORDS	(SECTOR_SIZE / 4)	/* number of 32bit words per sector */
+#define IDE_SECTOR_SIZE	512
+#define SECTOR_WORDS	(IDE_SECTOR_SIZE / 4)	/* number of 32bit words per sector */
 #define IDE_LARGE_SEEK(b1,b2,t)	(((b1) > (b2) + (t)) || ((b2) > (b1) + (t)))
 
 /*

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

* Re: [RFC] Rename SECTOR_SIZE to IDE_SECTOR_SIZE
  2004-10-27  6:08 [RFC] Rename SECTOR_SIZE to IDE_SECTOR_SIZE Chris Wedgwood
@ 2004-10-27  6:47 ` Jeff Garzik
  2004-10-27  6:55   ` Chris Wedgwood
  0 siblings, 1 reply; 9+ messages in thread
From: Jeff Garzik @ 2004-10-27  6:47 UTC (permalink / raw)
  To: Chris Wedgwood; +Cc: LKML, Chris Wedgwood, Bartlomiej Zolnierkiewicz

Chris Wedgwood wrote:
> The token SECTOR_SIZE is used in multiple places that have (almost)
> the same defintion everywhere.
> 
> How do people feel about rename this vague token?

It's highly silly to rename the same name + the same value to multiple 
different names.

Put it in a common header somewhere, and only rename the oddballs (if any).

	Jeff




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

* Re: [RFC] Rename SECTOR_SIZE to IDE_SECTOR_SIZE
  2004-10-27  6:47 ` Jeff Garzik
@ 2004-10-27  6:55   ` Chris Wedgwood
  2004-10-27  7:22     ` Jens Axboe
  0 siblings, 1 reply; 9+ messages in thread
From: Chris Wedgwood @ 2004-10-27  6:55 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: LKML, Bartlomiej Zolnierkiewicz

On Wed, Oct 27, 2004 at 02:47:51AM -0400, Jeff Garzik wrote:

> It's highly silly to rename the same name + the same value to
> multiple different names.

initially i was going to do that, but when i looked at the code i
realized the problem is some of the users seem to be semantically
different and potentially might want to be changed separate to the
others

> Put it in a common header somewhere, and only rename the oddballs
> (if any).

we could have UNIX_SECTOR_SIZE in blkdev.h but as i said, some users
really are 512 for different reasons that might change (?)

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

* Re: [RFC] Rename SECTOR_SIZE to IDE_SECTOR_SIZE
  2004-10-27  6:55   ` Chris Wedgwood
@ 2004-10-27  7:22     ` Jens Axboe
  2004-10-27 19:05       ` [PATCH] Rename SECTOR_SIZE to BIO_SECTOR_SIZE Chris Wedgwood
  0 siblings, 1 reply; 9+ messages in thread
From: Jens Axboe @ 2004-10-27  7:22 UTC (permalink / raw)
  To: Chris Wedgwood; +Cc: Jeff Garzik, LKML, Bartlomiej Zolnierkiewicz

On Tue, Oct 26 2004, Chris Wedgwood wrote:
> On Wed, Oct 27, 2004 at 02:47:51AM -0400, Jeff Garzik wrote:
> 
> > It's highly silly to rename the same name + the same value to
> > multiple different names.
> 
> initially i was going to do that, but when i looked at the code i
> realized the problem is some of the users seem to be semantically
> different and potentially might want to be changed separate to the
> others
> 
> > Put it in a common header somewhere, and only rename the oddballs
> > (if any).
> 
> we could have UNIX_SECTOR_SIZE in blkdev.h but as i said, some users
> really are 512 for different reasons that might change (?)

Please, just call it IO_SECTOR_SIZE or BIO_SECTOR_SIZE to signify that
it's the block io sector size. And use that where it applies, leave the
rest of the unrelated cases alone.

-- 
Jens Axboe


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

* [PATCH] Rename SECTOR_SIZE to BIO_SECTOR_SIZE
  2004-10-27  7:22     ` Jens Axboe
@ 2004-10-27 19:05       ` Chris Wedgwood
  2004-10-27 20:27         ` Matt Mackall
  0 siblings, 1 reply; 9+ messages in thread
From: Chris Wedgwood @ 2004-10-27 19:05 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Jeff Garzik, LKML, Bartlomiej Zolnierkiewicz

Rename (one of the uses of) SECTOR_SIZE to BIO_SECTOR_SIZE which is
more appropriate.

Signed-off-by: Chris Wedgwood <cw@f00f.org>
---

Rediffed against the BK tree from a few minutes ago.

 drivers/char/ftape/lowlevel/ftape-bsm.h |    2 -
 drivers/ide/ide-cd.c                    |   54 ++++++++++++++++----------------
 drivers/ide/ide-cd.h                    |   15 +++-----
 drivers/ide/ide-io.c                    |    2 -
 drivers/ide/ide-taskfile.c              |    6 +--
 drivers/ide/pci/siimage.c               |    2 -
 include/linux/ide.h                     |    4 +-
 7 files changed, 41 insertions(+), 44 deletions(-)


Index: cw-current/drivers/char/ftape/lowlevel/ftape-bsm.h
===================================================================
--- cw-current.orig/drivers/char/ftape/lowlevel/ftape-bsm.h	2004-10-26 22:59:51.628352414 -0700
+++ cw-current/drivers/char/ftape/lowlevel/ftape-bsm.h	2004-10-27 11:35:13.237711103 -0700
@@ -36,7 +36,7 @@
 
 /*  maximum (format code 4) bad sector map size (bytes).
  */
-#define BAD_SECTOR_MAP_SIZE     (29 * SECTOR_SIZE - 256)
+#define BAD_SECTOR_MAP_SIZE     (29 * BIO_SECTOR_SIZE - 256)
 
 /*  format code 4 bad sector entry, ftape uses this
  *  internally for all format codes
Index: cw-current/drivers/ide/ide-cd.c
===================================================================
--- cw-current.orig/drivers/ide/ide-cd.c	2004-10-26 22:59:51.643352933 -0700
+++ cw-current/drivers/ide/ide-cd.c	2004-10-27 11:35:13.240711206 -0700
@@ -965,7 +965,7 @@
 
 	/* Number of sectors to read into the buffer. */
 	int sectors_to_buffer = min_t(int, sectors_to_transfer,
-				     (SECTOR_BUFFER_SIZE >> SECTOR_BITS) -
+				     (CD_SECTOR_BUFFER_SIZE >> CD_SECTOR_BITS) -
 				       info->nsectors_buffered);
 
 	char *dest;
@@ -979,18 +979,18 @@
 		info->sector_buffered = sector;
 
 	/* Read the data into the buffer. */
-	dest = info->buffer + info->nsectors_buffered * SECTOR_SIZE;
+	dest = info->buffer + info->nsectors_buffered * BIO_SECTOR_SIZE;
 	while (sectors_to_buffer > 0) {
-		HWIF(drive)->atapi_input_bytes(drive, dest, SECTOR_SIZE);
+		HWIF(drive)->atapi_input_bytes(drive, dest, BIO_SECTOR_SIZE);
 		--sectors_to_buffer;
 		--sectors_to_transfer;
 		++info->nsectors_buffered;
-		dest += SECTOR_SIZE;
+		dest += BIO_SECTOR_SIZE;
 	}
 
 	/* Throw away any remaining data. */
 	while (sectors_to_transfer > 0) {
-		static char dum[SECTOR_SIZE];
+		static char dum[BIO_SECTOR_SIZE];
 		HWIF(drive)->atapi_input_bytes(drive, dum, sizeof (dum));
 		--sectors_to_transfer;
 	}
@@ -1093,9 +1093,9 @@
 		return ide_stopped;
 
 	/* Assume that the drive will always provide data in multiples
-	   of at least SECTOR_SIZE, as it gets hairy to keep track
+	   of at least BIO_SECTOR_SIZE, as it gets hairy to keep track
 	   of the transfers otherwise. */
-	if ((len % SECTOR_SIZE) != 0) {
+	if ((len % BIO_SECTOR_SIZE) != 0) {
 		printk ("%s: cdrom_read_intr: Bad transfer size %d\n",
 			drive->name, len);
 		if (CDROM_CONFIG_FLAGS(drive)->limit_nframes)
@@ -1109,7 +1109,7 @@
 	}
 
 	/* The number of sectors we need to read from the drive. */
-	sectors_to_transfer = len / SECTOR_SIZE;
+	sectors_to_transfer = len / BIO_SECTOR_SIZE;
 
 	/* First, figure out if we need to bit-bucket
 	   any of the leading sectors. */
@@ -1117,7 +1117,7 @@
 
 	while (nskip > 0) {
 		/* We need to throw away a sector. */
-		static char dum[SECTOR_SIZE];
+		static char dum[BIO_SECTOR_SIZE];
 		HWIF(drive)->atapi_input_bytes(drive, dum, sizeof (dum));
 
 		--rq->current_nr_sectors;
@@ -1149,8 +1149,8 @@
 			/* Read this_transfer sectors
 			   into the current buffer. */
 			while (this_transfer > 0) {
-				HWIF(drive)->atapi_input_bytes(drive, rq->buffer, SECTOR_SIZE);
-				rq->buffer += SECTOR_SIZE;
+				HWIF(drive)->atapi_input_bytes(drive, rq->buffer, BIO_SECTOR_SIZE);
+				rq->buffer += BIO_SECTOR_SIZE;
 				--rq->nr_sectors;
 				--rq->current_nr_sectors;
 				++rq->sector;
@@ -1175,7 +1175,7 @@
 	struct request *rq = HWGROUP(drive)->rq;
 	unsigned short sectors_per_frame;
 
-	sectors_per_frame = queue_hardsect_size(drive->queue) >> SECTOR_BITS;
+	sectors_per_frame = queue_hardsect_size(drive->queue) >> CD_SECTOR_BITS;
 
 	/* Can't do anything if there's no buffer. */
 	if (info->buffer == NULL) return 0;
@@ -1190,9 +1190,9 @@
 
 		memcpy (rq->buffer,
 			info->buffer +
-			(rq->sector - info->sector_buffered) * SECTOR_SIZE,
-			SECTOR_SIZE);
-		rq->buffer += SECTOR_SIZE;
+			(rq->sector - info->sector_buffered) * BIO_SECTOR_SIZE,
+			BIO_SECTOR_SIZE);
+		rq->buffer += BIO_SECTOR_SIZE;
 		--rq->current_nr_sectors;
 		--rq->nr_sectors;
 		++rq->sector;
@@ -1236,7 +1236,7 @@
 	unsigned short sectors_per_frame;
 	int nskip;
 
-	sectors_per_frame = queue_hardsect_size(drive->queue) >> SECTOR_BITS;
+	sectors_per_frame = queue_hardsect_size(drive->queue) >> CD_SECTOR_BITS;
 
 	/* If the requested sector doesn't start on a cdrom block boundary,
 	   we must adjust the start of the transfer so that it does,
@@ -1298,7 +1298,7 @@
 	struct request *rq = HWGROUP(drive)->rq;
 	sector_t frame = rq->sector;
 
-	sector_div(frame, queue_hardsect_size(drive->queue) >> SECTOR_BITS);
+	sector_div(frame, queue_hardsect_size(drive->queue) >> CD_SECTOR_BITS);
 
 	memset(rq->cmd, 0, sizeof(rq->cmd));
 	rq->cmd[0] = GPCMD_SEEK;
@@ -1323,7 +1323,7 @@
 static void restore_request (struct request *rq)
 {
 	if (rq->buffer != bio_data(rq->bio)) {
-		sector_t n = (rq->buffer - (char *) bio_data(rq->bio)) / SECTOR_SIZE;
+		sector_t n = (rq->buffer - (char *) bio_data(rq->bio)) / BIO_SECTOR_SIZE;
 
 		rq->buffer = bio_data(rq->bio);
 		rq->nr_sectors += n;
@@ -1344,7 +1344,7 @@
 	struct request *rq = HWGROUP(drive)->rq;
 	unsigned short sectors_per_frame;
 
-	sectors_per_frame = queue_hardsect_size(drive->queue) >> SECTOR_BITS;
+	sectors_per_frame = queue_hardsect_size(drive->queue) >> CD_SECTOR_BITS;
 
 	/* We may be retrying this request after an error.  Fix up
 	   any weirdness which might be present in the request packet. */
@@ -1837,7 +1837,7 @@
 	if (cdrom_write_check_ireason(drive, len, ireason))
 		return ide_stopped;
 
-	sectors_to_transfer = len / SECTOR_SIZE;
+	sectors_to_transfer = len / BIO_SECTOR_SIZE;
 
 	/*
 	 * now loop and write out the data
@@ -1856,8 +1856,8 @@
 		this_transfer = min_t(int, sectors_to_transfer, rq->current_nr_sectors);
 
 		while (this_transfer > 0) {
-			HWIF(drive)->atapi_output_bytes(drive, rq->buffer, SECTOR_SIZE);
-			rq->buffer += SECTOR_SIZE;
+			HWIF(drive)->atapi_output_bytes(drive, rq->buffer, BIO_SECTOR_SIZE);
+			rq->buffer += BIO_SECTOR_SIZE;
 			--rq->nr_sectors;
 			--rq->current_nr_sectors;
 			++rq->sector;
@@ -1893,7 +1893,7 @@
 {
 	struct cdrom_info *info = drive->driver_data;
 	struct gendisk *g = drive->disk;
-	unsigned short sectors_per_frame = queue_hardsect_size(drive->queue) >> SECTOR_BITS;
+	unsigned short sectors_per_frame = queue_hardsect_size(drive->queue) >> CD_SECTOR_BITS;
 
 	/*
 	 * writes *must* be hardware frame aligned
@@ -2195,7 +2195,7 @@
 	if (stat == 0) {
 		*capacity = 1 + be32_to_cpu(capbuf.lba);
 		*sectors_per_frame =
-			be32_to_cpu(capbuf.blocklen) >> SECTOR_BITS;
+			be32_to_cpu(capbuf.blocklen) >> CD_SECTOR_BITS;
 	}
 
 	return stat;
@@ -2238,7 +2238,7 @@
 		struct atapi_toc_entry  ent;
 	} ms_tmp;
 	long last_written;
-	unsigned long sectors_per_frame = SECTORS_PER_FRAME;
+	unsigned long sectors_per_frame = CD_SECTORS_PER_FRAME;
 
 	if (toc == NULL) {
 		/* Try to allocate space. */
@@ -2266,7 +2266,7 @@
 
 	set_capacity(drive->disk, toc->capacity * sectors_per_frame);
 	blk_queue_hardsect_size(drive->queue,
-				sectors_per_frame << SECTOR_BITS);
+				sectors_per_frame << CD_SECTOR_BITS);
 
 	/* First read just the header, so we know how long the TOC is. */
 	stat = cdrom_read_tocentry(drive, 0, 1, 0, (char *) &toc->hdr,
@@ -3375,7 +3375,7 @@
 	drive->usage++;
 
 	if (!info->buffer)
-		info->buffer = kmalloc(SECTOR_BUFFER_SIZE,
+		info->buffer = kmalloc(CD_SECTOR_BUFFER_SIZE,
 					GFP_KERNEL|__GFP_REPEAT);
         if (!info->buffer || (rc = cdrom_open(&info->devinfo, inode, file)))
 		drive->usage--;
Index: cw-current/drivers/ide/ide-cd.h
===================================================================
--- cw-current.orig/drivers/ide/ide-cd.h	2004-10-26 22:59:51.656353382 -0700
+++ cw-current/drivers/ide/ide-cd.h	2004-10-27 11:35:13.242711276 -0700
@@ -43,14 +43,11 @@
 
 /************************************************************************/
 
-#define SECTOR_BITS 		9
-#ifndef SECTOR_SIZE
-#define SECTOR_SIZE		(1 << SECTOR_BITS)
-#endif
-#define SECTORS_PER_FRAME	(CD_FRAMESIZE >> SECTOR_BITS)
-#define SECTOR_BUFFER_SIZE	(CD_FRAMESIZE * 32)
-#define SECTORS_BUFFER		(SECTOR_BUFFER_SIZE >> SECTOR_BITS)
-#define SECTORS_MAX		(131072 >> SECTOR_BITS)
+#define CD_SECTOR_BITS 		9
+#define CD_SECTORS_PER_FRAME	(CD_FRAMESIZE >> CD_SECTOR_BITS)
+#define CD_SECTOR_BUFFER_SIZE	(CD_FRAMESIZE * 32)
+#define CD_SECTORS_BUFFER	(SECTOR_BUFFER_SIZE >> CD_SECTOR_BITS)
+#define CD_SECTORS_MAX		(131072 >> CD_SECTOR_BITS)
 
 #define BLOCKS_PER_FRAME	(CD_FRAMESIZE / BLOCK_SIZE)
 
@@ -84,7 +81,7 @@
 	__u8 supp_disc_present	: 1; /* Changer can report exact contents
 					of slots. */
 	__u8 limit_nframes	: 1; /* Drive does not provide data in
-					multiples of SECTOR_SIZE when more
+					multiples of CD_SECTOR_SIZE when more
 					than one interrupt is needed. */
 	__u8 seeking		: 1; /* Seeking in progress */
 	__u8 audio_play		: 1; /* can do audio related commands */
Index: cw-current/drivers/ide/ide-io.c
===================================================================
--- cw-current.orig/drivers/ide/ide-io.c	2004-10-26 22:59:51.668353797 -0700
+++ cw-current/drivers/ide/ide-io.c	2004-10-27 11:35:13.243711310 -0700
@@ -686,7 +686,7 @@
 	if ((rq->flags & REQ_DRIVE_TASKFILE) == 0) {
 		hwif->sg_nents = blk_rq_map_sg(drive->queue, rq, sg);
 	} else {
-		sg_init_one(sg, rq->buffer, rq->nr_sectors * SECTOR_SIZE);
+		sg_init_one(sg, rq->buffer, rq->nr_sectors * BIO_SECTOR_SIZE);
 		hwif->sg_nents = 1;
 	}
 }
Index: cw-current/drivers/ide/ide-taskfile.c
===================================================================
--- cw-current.orig/drivers/ide/ide-taskfile.c	2004-10-27 11:33:06.148315966 -0700
+++ cw-current/drivers/ide/ide-taskfile.c	2004-10-27 11:35:13.244711345 -0700
@@ -281,12 +281,12 @@
 	local_irq_save(flags);
 #endif
 	buf = kmap_atomic(page, KM_BIO_SRC_IRQ) +
-	      sg[hwif->cursg].offset + (hwif->cursg_ofs * SECTOR_SIZE);
+	      sg[hwif->cursg].offset + (hwif->cursg_ofs * BIO_SECTOR_SIZE);
 
 	hwif->nleft--;
 	hwif->cursg_ofs++;
 
-	if ((hwif->cursg_ofs * SECTOR_SIZE) == sg[hwif->cursg].length) {
+	if ((hwif->cursg_ofs * BIO_SECTOR_SIZE) == sg[hwif->cursg].length) {
 		hwif->cursg++;
 		hwif->cursg_ofs = 0;
 	}
@@ -481,7 +481,7 @@
 		if (data_size == 0)
 			rq.nr_sectors = (args->hobRegister[IDE_NSECTOR_OFFSET] << 8) | args->tfRegister[IDE_NSECTOR_OFFSET];
 		else
-			rq.nr_sectors = data_size / SECTOR_SIZE;
+			rq.nr_sectors = data_size / BIO_SECTOR_SIZE;
 
 		if (!rq.nr_sectors) {
 			printk(KERN_ERR "%s: in/out command without data\n",
Index: cw-current/drivers/ide/pci/siimage.c
===================================================================
--- cw-current.orig/drivers/ide/pci/siimage.c	2004-10-27 11:33:06.171316761 -0700
+++ cw-current/drivers/ide/pci/siimage.c	2004-10-27 11:35:13.245711379 -0700
@@ -470,7 +470,7 @@
 #ifdef SIIMAGE_VIRTUAL_DMAPIO
 	struct request *rq	= HWGROUP(drive)->rq;
 	ide_hwif_t *hwif	= HWIF(drive);
-	u32 count		= (rq->nr_sectors * SECTOR_SIZE);
+	u32 count		= (rq->nr_sectors * BIO_SECTOR_SIZE);
 	u32 rcount		= 0;
 	unsigned long addr	= siimage_selreg(hwif, 0x1C);
 
Index: cw-current/include/linux/ide.h
===================================================================
--- cw-current.orig/include/linux/ide.h	2004-10-27 11:33:06.237319044 -0700
+++ cw-current/include/linux/ide.h	2004-10-27 11:35:13.246711414 -0700
@@ -202,8 +202,8 @@
 #define PARTN_BITS	6	/* number of minor dev bits for partitions */
 #define PARTN_MASK	((1<<PARTN_BITS)-1)	/* a useful bit mask */
 #define MAX_DRIVES	2	/* per interface; 2 assumed by lots of code */
-#define SECTOR_SIZE	512
-#define SECTOR_WORDS	(SECTOR_SIZE / 4)	/* number of 32bit words per sector */
+#define BIO_SECTOR_SIZE	512
+#define SECTOR_WORDS	(BIO_SECTOR_SIZE / 4)	/* number of 32bit words per sector */
 #define IDE_LARGE_SEEK(b1,b2,t)	(((b1) > (b2) + (t)) || ((b2) > (b1) + (t)))
 
 /*

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

* Re: [PATCH] Rename SECTOR_SIZE to BIO_SECTOR_SIZE
  2004-10-27 19:05       ` [PATCH] Rename SECTOR_SIZE to BIO_SECTOR_SIZE Chris Wedgwood
@ 2004-10-27 20:27         ` Matt Mackall
  2004-10-27 20:29           ` Chris Wedgwood
  2004-10-27 20:45           ` J.A. Magallon
  0 siblings, 2 replies; 9+ messages in thread
From: Matt Mackall @ 2004-10-27 20:27 UTC (permalink / raw)
  To: Chris Wedgwood; +Cc: Jens Axboe, Jeff Garzik, LKML, Bartlomiej Zolnierkiewicz

On Wed, Oct 27, 2004 at 12:05:23PM -0700, Chris Wedgwood wrote:
> Rename (one of the uses of) SECTOR_SIZE to BIO_SECTOR_SIZE which is
> more appropriate.

> Index: cw-current/include/linux/ide.h
> ===================================================================
> --- cw-current.orig/include/linux/ide.h	2004-10-27 11:33:06.237319044 -0700
> +++ cw-current/include/linux/ide.h	2004-10-27 11:35:13.246711414 -0700
> @@ -202,8 +202,8 @@
>  #define PARTN_BITS	6	/* number of minor dev bits for partitions */
>  #define PARTN_MASK	((1<<PARTN_BITS)-1)	/* a useful bit mask */
>  #define MAX_DRIVES	2	/* per interface; 2 assumed by lots of code */
> -#define SECTOR_SIZE	512
> -#define SECTOR_WORDS	(SECTOR_SIZE / 4)	/* number of 32bit words per sector */
> +#define BIO_SECTOR_SIZE	512
> +#define SECTOR_WORDS	(BIO_SECTOR_SIZE / 4)	/* number of 32bit words per sector */
>  #define IDE_LARGE_SEEK(b1,b2,t)	(((b1) > (b2) + (t)) || ((b2) > (b1) + (t)))

So shouldn't this be in bio.h now?

-- 
Mathematics is the supreme nostalgia of our time.

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

* Re: [PATCH] Rename SECTOR_SIZE to BIO_SECTOR_SIZE
  2004-10-27 20:27         ` Matt Mackall
@ 2004-10-27 20:29           ` Chris Wedgwood
  2004-10-27 20:36             ` Bartlomiej Zolnierkiewicz
  2004-10-27 20:45           ` J.A. Magallon
  1 sibling, 1 reply; 9+ messages in thread
From: Chris Wedgwood @ 2004-10-27 20:29 UTC (permalink / raw)
  To: Matt Mackall; +Cc: Jens Axboe, Jeff Garzik, LKML, Bartlomiej Zolnierkiewicz

On Wed, Oct 27, 2004 at 03:27:33PM -0500, Matt Mackall wrote:

> So shouldn't this be in bio.h now?

in a sense, nobody else but IDE uses it, and i just noticed
SECTOR_WORDS is pretty much pointless so i can rediff fixing that
too...

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

* Re: [PATCH] Rename SECTOR_SIZE to BIO_SECTOR_SIZE
  2004-10-27 20:29           ` Chris Wedgwood
@ 2004-10-27 20:36             ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 9+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-10-27 20:36 UTC (permalink / raw)
  To: Chris Wedgwood; +Cc: Matt Mackall, Jens Axboe, Jeff Garzik, LKML

On Wed, 27 Oct 2004 13:29:24 -0700, Chris Wedgwood <cw@f00f.org> wrote:
> On Wed, Oct 27, 2004 at 03:27:33PM -0500, Matt Mackall wrote:
> 
> > So shouldn't this be in bio.h now?
> 
> in a sense, nobody else but IDE uses it, and i just noticed

Then whole rename doesn't make sense to me... sorry... :)

> SECTOR_WORDS is pretty much pointless so i can rediff fixing that
> too...

SECTOR_WORDS can die

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

* Re: [PATCH] Rename SECTOR_SIZE to BIO_SECTOR_SIZE
  2004-10-27 20:27         ` Matt Mackall
  2004-10-27 20:29           ` Chris Wedgwood
@ 2004-10-27 20:45           ` J.A. Magallon
  1 sibling, 0 replies; 9+ messages in thread
From: J.A. Magallon @ 2004-10-27 20:45 UTC (permalink / raw)
  To: Matt Mackall
  Cc: Chris Wedgwood, Jens Axboe, Jeff Garzik, LKML, Bartlomiej Zolnierkiewicz


On 2004.10.27, Matt Mackall wrote:
> On Wed, Oct 27, 2004 at 12:05:23PM -0700, Chris Wedgwood wrote:
> > Rename (one of the uses of) SECTOR_SIZE to BIO_SECTOR_SIZE which is
> > more appropriate.
> 
> > Index: cw-current/include/linux/ide.h
> > ===================================================================
> > --- cw-current.orig/include/linux/ide.h	2004-10-27 11:33:06.237319044 -0700
> > +++ cw-current/include/linux/ide.h	2004-10-27 11:35:13.246711414 -0700
> > @@ -202,8 +202,8 @@
> >  #define PARTN_BITS	6	/* number of minor dev bits for partitions */
> >  #define PARTN_MASK	((1<<PARTN_BITS)-1)	/* a useful bit mask */
> >  #define MAX_DRIVES	2	/* per interface; 2 assumed by lots of code */
> > -#define SECTOR_SIZE	512
> > -#define SECTOR_WORDS	(SECTOR_SIZE / 4)	/* number of 32bit words per sector */
> > +#define BIO_SECTOR_SIZE	512
> > +#define SECTOR_WORDS	(BIO_SECTOR_SIZE / 4)	/* number of 32bit words per sector */
> >  #define IDE_LARGE_SEEK(b1,b2,t)	(((b1) > (b2) + (t)) || ((b2) > (b1) + (t)))
> 
> So shouldn't this be in bio.h now?
> 

And for uniformity, SECTOR_WORDS -> BIO_SECTOR_WORDS ?

--
J.A. Magallon <jamagallon()able!es>     \               Software is like sex:
werewolf!able!es                         \         It's better when it's free
Mandrakelinux release 10.1 (Community) for i586
Linux 2.6.9-jam1 (gcc 3.4.1 (Mandrakelinux 10.1 3.4.1-4mdk)) #6



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

end of thread, other threads:[~2004-10-27 23:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-27  6:08 [RFC] Rename SECTOR_SIZE to IDE_SECTOR_SIZE Chris Wedgwood
2004-10-27  6:47 ` Jeff Garzik
2004-10-27  6:55   ` Chris Wedgwood
2004-10-27  7:22     ` Jens Axboe
2004-10-27 19:05       ` [PATCH] Rename SECTOR_SIZE to BIO_SECTOR_SIZE Chris Wedgwood
2004-10-27 20:27         ` Matt Mackall
2004-10-27 20:29           ` Chris Wedgwood
2004-10-27 20:36             ` Bartlomiej Zolnierkiewicz
2004-10-27 20:45           ` J.A. Magallon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.