Re: Suggested dual human/binary interface for proc/devfs

From: jmcmullan@linuxcare.com
Date: Thu Apr 20 2000 - 12:00:59 EST


Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
>> - Most subsystems use an array of 256 entries to determine which minor
>> number goes to which device. This will have to be rewritten to work
>> correctly

> Almost none use arrays like that. The ones that do are fairly slack (like
> videodev which hey I wrote I admit to being lazy). A generic list is easy
> (its even in misc.c)

<ObPetPeeve>
        Actually, _ALL_ the block devices use MAJOR_NR -> driver
mappings in a way that almost makes _sure_ that you'll miss
initializing something.

  To quote from include/linux/blkdev.h:
----------------------------------------------
extern struct sec_size * blk_sec[MAX_BLKDEV];
extern struct blk_dev_struct blk_dev[MAX_BLKDEV];
...
extern int * blk_size[MAX_BLKDEV];
extern int * blksize_size[MAX_BLKDEV];
extern int * hardsect_size[MAX_BLKDEV];
extern int * max_readahead[MAX_BLKDEV];
extern int * max_sectors[MAX_BLKDEV];
extern int * max_segments[MAX_BLKDEV];
...
----------------------------------------------

  Personally, I would rather see:

----------------------------------------------
struct block_driver_info {
        struct blk_dev blk_dev;
        struct block_minor_info {
                struct sec_size blk_sec;
                int blk_size;
                int blksize_size;
                int hardsect_size;
                int max_readahead;
                int max_sectors;
                int max_segments;
        } *minor; /* Array of info, one for each minor */
} *block_driver;
----------------------------------------------

        But, ya know, I'm just an idiot.
</ObPetPeeve>

-- 
Jason McMullan, Senior Linux Consultant, Linuxcare, Inc.
412.422.8077 tel, 412.656.3519 cell, 415.701.0792 fax
jmcmullan@linuxcare.com, http://www.linuxcare.com/
Linuxcare. Support for the revolution.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Apr 23 2000 - 21:00:17 EST