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 31
14 #define IOC_DESCLEN 63
16 #define IOC_MAXMINOR 2047
17 #define IOC_LINESIZ 255
22 #define MAX_BLKDEV 255
25 #define K_NODEV "nodev"
27 #define IS_WHOLE(maj,min) ((min % ioconf[maj]->blkp->pcount) == 0)
30 * When is C going to get templates?
32 #define IOC_ALLOC(P,TYPE,SIZE) \
35 P = (TYPE *) malloc(SIZE); \
44 /* That dummy while allows ';' on the line that invokes the macro... */
48 char name[IOC_NAMELEN + 1]; /* device basename */
49 char cfmt[IOC_FMTLEN + 1]; /* controller format string */
50 char dfmt[IOC_FMTLEN + 1]; /* disk format string */
51 char pfmt[IOC_FMTLEN + 1]; /* partition format string */
52 /* ctrlno is in the ioc_entry */
53 unsigned int ctrl_explicit; /* use "cN" in name */
54 unsigned int dcount; /* number of devices handled by this major */
55 unsigned int pcount; /* partitions per device */
56 char desc[IOC_DESCLEN + 1];
57 /* disk info unit # conversion function */
58 char *(*cconv)(unsigned int);
60 /* extension properties (all this for initrd?) */
61 char ext_name[IOC_NAMELEN + 1];
62 unsigned int ext; /* flag - this is an extension record */
63 unsigned int ext_minor; /* which minor does this apply to */
66 #define BLK_CONFIG_SIZE (sizeof(struct blk_config))
70 int live; /* is this a Direct entry? */
71 unsigned int ctrlno; /* controller number */
72 unsigned int basemajor; /* Major number of the template */
73 char *desc; /* (dynamic) per-controller description */
74 struct blk_config *blkp; /* the real info, may be a shared ref */
77 #define IOC_ENTRY_SIZE (sizeof(struct ioc_entry))
80 extern int ioc_iswhole(unsigned int, unsigned int);
81 extern char *ioc_name(unsigned int, unsigned int);
82 extern char *transform_devmapname(unsigned int, unsigned int);