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