2 * ioconf: ioconf configuration file handling code
3 * Original code (C) 2004 by Red Hat (Charlie Bennett <ccb@redhat.com>)
5 * Modified and maintained by Sebastien GODARD (sysstat <at> orange.fr)
11 #include "sysconfig.h"
13 #define IOC_NAMELEN 32
14 #define IOC_DESCLEN 64
16 #define IOC_LINESIZ 256
18 #define IOC_XFMTLEN (IOC_FMTLEN + IOC_NAMELEN + 3)
23 #define IOC_MAXMINOR ((1U << MINORBITS) - 1)
25 /* #define MAX_BLKDEV ((1U << (32 - MINORBITS)) - 1) */
26 /* Use a lower value since this value is used to allocate arrays statically in ioconf.c */
27 #define MAX_BLKDEV 511
30 #define K_NODEV "nodev"
32 #define IS_WHOLE(maj,min) ((min % ioconf[maj]->blkp->pcount) == 0)
35 * When is C going to get templates?
37 #define IOC_ALLOC(P,TYPE,SIZE) \
40 P = (TYPE *) malloc(SIZE); \
44 goto free_and_return; \
49 /* That dummy while allows ';' on the line that invokes the macro... */
53 char name[IOC_NAMELEN]; /* device basename */
54 char cfmt[IOC_XFMTLEN]; /* controller format string */
55 char dfmt[IOC_FMTLEN]; /* disk format string */
56 char pfmt[IOC_FMTLEN + 2]; /* partition format string */
57 /* ctrlno is in the ioc_entry */
58 unsigned int ctrl_explicit; /* use "cN" in name */
59 unsigned int dcount; /* number of devices handled by this major */
60 unsigned int pcount; /* partitions per device */
61 char desc[IOC_DESCLEN];
62 /* disk info unit # conversion function */
63 char *(*cconv)(unsigned int);
65 /* extension properties (all this for initrd?) */
66 char ext_name[IOC_NAMELEN];
67 unsigned int ext; /* flag - this is an extension record */
68 unsigned int ext_minor; /* which minor does this apply to */
71 #define BLK_CONFIG_SIZE (sizeof(struct blk_config))
75 int live; /* is this a Direct entry? */
76 unsigned int ctrlno; /* controller number */
77 unsigned int basemajor; /* Major number of the template */
78 char *desc; /* (dynamic) per-controller description */
79 struct blk_config *blkp; /* the real info, may be a shared ref */
82 #define IOC_ENTRY_SIZE (sizeof(struct ioc_entry))
86 (unsigned int, unsigned int);
88 (unsigned int, unsigned int);
89 char *transform_devmapname
90 (unsigned int, unsigned int);