Rename SECTOR_SIZE to IDE_SECTOR_SIZE
Subsystems (2)
RFC 1/1 Rename SECTOR_SIZE to IDE_SECTOR_SIZE
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 =====
drivers/char/ftape/lowlevel/ftape-bsm.h +1 -1
@@ -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 =====
drivers/ide/ide-cd.c +27 -27
177 lines not on this page · raw message
===== drivers/ide/ide-cd.h 1.11 vs edited =====
drivers/ide/ide-cd.h +6 -9
@@ -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 contentsof 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 =====
drivers/ide/ide-io.c +1 -1
@@ -686,7 +686,7 @@ void ide_map_sg(ide_drive_t *drive, struif ((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 =====
drivers/ide/ide-taskfile.c +3 -3
@@ -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 *drivif (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 =====
drivers/ide/pci/siimage.c +1 -1
@@ -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 =====
include/linux/ide.h +2 -2
@@ -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)))/*
Quoted 4 lines · Chris Wedgwood
The token
SECTOR_SIZEis 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
Quoted 2 lines · Jeff Garzik
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
Quoted 2 lines
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 (?)
Quoted 10 lines · Chris Wedgwood
Quoted 2 lines · Jeff Garzik
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
Quoted 5 lines
Quoted 2 lines
Put it in a common header somewhere, and only rename the oddballs (if any).
we could have
UNIX_SECTOR_SIZEinblkdev.hbut 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.
Signature · 1 line
Jens Axboe
PATCH 1/1 Rename SECTOR_SIZE to BIO_SECTOR_SIZE
Rename (one of the uses of) SECTOR_SIZE to BIO_SECTOR_SIZE which is more appropriate.
---
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(-)
drivers/char/ftape/lowlevel/ftape-bsm.h +1 -1
@@ -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
drivers/ide/ide-cd.c +27 -27
177 lines not on this page · raw message
drivers/ide/ide-cd.h +6 -9
@@ -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 contentsof 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 -1
@@ -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 ; } }
drivers/ide/ide-taskfile.c +3 -3
@@ -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",
drivers/ide/pci/siimage.c +1 -1
@@ -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 );
include/linux/ide.h +2 -2
@@ -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)))/*
Re: [PATCH] Rename SECTOR_SIZE to BIO_SECTOR_SIZE
Quoted 8 lines · Chris Wedgwood
Rename (one of the uses of)
SECTOR_SIZEtoBIO_SECTOR_SIZEwhich is more appropriate.Index:
cw-current/include/linux/ide.h
===================================================================
include/linux/ide.h line 207
Quoted 8 lines
include/linux/ide.h +2
-2@@ -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?
Signature · 1 line
Mathematics is the supreme nostalgia of our time.
Re: [PATCH] Rename SECTOR_SIZE to BIO_SECTOR_SIZE
Quoted 1 line · Matt Mackall
So shouldn't this be in
bio.hnow?
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...
Re: [PATCH] Rename SECTOR_SIZE to BIO_SECTOR_SIZE
Quoted 5 lines · Chris Wedgwood
Quoted 1 line · Matt Mackall
So shouldn't this be in
bio.hnow?in a sense, nobody else but IDE uses it, and i just noticed
Then whole rename doesn't make sense to me... sorry... :)
Quoted 2 lines
SECTOR_WORDSis pretty much pointless so i can rediff fixing that too...
SECTOR_WORDS can die
Re: [PATCH] Rename SECTOR_SIZE to BIO_SECTOR_SIZE
In reply to Matt MackallQuoted 4 lines · Matt Mackall
Quoted 2 lines · Chris Wedgwood
Rename (one of the uses of)
SECTOR_SIZEtoBIO_SECTOR_SIZEwhich is more appropriate.
Quoted 16 lines
include/linux/ide.h line 207
Quoted 13 lines
Index:
cw-current/include/linux/ide.h
===================================================================include/linux/ide.h +2
-2@@ -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.hnow?
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