Re: [PATCH] struct char_device

From: Martin Dalecki (dalecki@evision-ventures.com)
Date: Tue May 22 2001 - 17:47:18 EST


And if we are at the topic... Those are the places where blk_size[]
get's
abused, since it's in fact a property of a FS in fact and not the
property of
a particular device... blksect_size is the array describing the physical
access limits of a device and blk_size get's usually checked against it.
However due to the bad naming and the fact that this information is
associated with major/minor number usage same device driver writers got
*very* confused as you can see below:

./fs/block_dev.c: Here this information should be passed entierly insice
the request.

./fs/partitions/check.c: Here it basically get's reset or ignored

Here it's serving the purpose of a sector size, which is bogous!

./mm/swapfile.c:#include <linux/blkdev.h> /* for blk_size */
./mm/swapfile.c: if (!dev || (blk_size[MAJOR(dev)] &&
./mm/swapfile.c: !blk_size[MAJOR(dev)][MINOR(dev)]))
./mm/swapfile.c: if (blk_size[MAJOR(dev)])
./mm/swapfile.c: swapfilesize = blk_size[MAJOR(dev)][MINOR(dev)]

Here it shouldn't be needed
./drivers/block/ll_rw_blk.c:

./drivers/block/floppy.c: blk_size[MAJOR_NR] = floppy_sizes;
./drivers/block/nbd.c: blk_size[MAJOR_NR] = nbd_sizes;
./drivers/block/rd.c: * and set blk_size for -ENOSPC, Werner Fink
<werner@suse.de>, Apr '99
./drivers/block/amiflop.c: blk_size[MAJOR_NR] = floppy_sizes;
./drivers/block/loop.c: if (blk_size[MAJOR(lodev)])
./drivers/block/ataflop.c: * - Set blk_size for proper size checking
./drivers/block/ataflop.c: blk_size[MAJOR_NR] = floppy_sizes;
./drivers/block/cpqarray.c: drv->blk_size;
./drivers/block/z2ram.c: blk_size[ MAJOR_NR ] = z2_sizes;
./drivers/block/swim3.c: blk_size[MAJOR_NR] = floppy_sizes;
./drivers/block/swim_iop.c: blk_size[MAJOR_NR] = floppy_sizes;
./drivers/char/raw.c: if (blk_size[MAJOR(dev)])
./drivers/scsi/advansys.c: ASC_DCNT blk_size;
./drivers/scsi/sd.c: blk_size[SD_MAJOR(i)] = NULL;
./drivers/scsi/sr.c: blk_size[MAJOR_NR] = sr_sizes;
./drivers/scsi/sr.c: blk_size[MAJOR_NR] = NULL;
./drivers/sbus/char/jsflash.c: blk_size[JSFD_MAJOR] = jsfd_sizes;
./drivers/ide/ide-cd.c: blk_size[HWIF(drive)->major] =
HWIF(drive)->gd->sizes;
./drivers/ide/ide-floppy.c: * Revalidate the new media. Should set
blk_size[]
./drivers/acorn/block/fd1772.c: blk_size[MAJOR_NR] = floppy_sizes;
./drivers/i2o/i2o_block.c: blk_size[MAJOR_NR] = i2ob_sizes;

In the following they are REALLY confusing it and then compensating for
this misunderstanding in lvm.h by redefining the corresponding default
values.

./drivers/s390/*

And then some minor confusions follow...

./drivers/mtd/mtdblock.c: blk_size[MAJOR_NR] = NULL;
./drivers/md/md.c: if (blk_size[MAJOR(dev)])
./arch/m68k/atari/stram.c: blk_size[STRAM_MAJOR] = stram_sizes;

Basically one should just stop setting blk_size[][] inside *ANY* driver
and anything should still work fine unless the driver is broken...

Well that's the point for another fine kernel experiment I will do
and report whatever it works really out like this in reality 8-)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 23 2001 - 21:00:49 EST