]> granicus.if.org Git - sysstat/blobdiff - ioconf.h
sar/sadf: Test values returned by functions
[sysstat] / ioconf.h
index 0d74555bccac3691fdf804ae137ea40dd1f228cc..15af3482a2ca1cf5ae294d899c4ef8baa56bdb69 100644 (file)
--- a/ioconf.h
+++ b/ioconf.h
 
 #include "sysconfig.h"
 
-#define IOC_NAMELEN    31
-#define IOC_DESCLEN    63
-#define IOC_DEVLEN     47
-#define IOC_MAXMINOR   2047
-#define IOC_LINESIZ    255
-#define IOC_FMTLEN     15
-
+#define IOC_NAMELEN    32
+#define IOC_DESCLEN    64
+#define IOC_DEVLEN     48
+#define IOC_LINESIZ    256
+#define IOC_FMTLEN     16
+#define IOC_XFMTLEN    (IOC_FMTLEN + IOC_NAMELEN + 3)
+
+#ifndef MINORBITS
+#define MINORBITS      20
+#endif
+#define IOC_MAXMINOR   ((1U << MINORBITS) - 1)
 #ifndef MAX_BLKDEV
-#define MAX_BLKDEV     255
+/* #define MAX_BLKDEV  ((1U << (32 - MINORBITS)) - 1) */
+/* Use a lower value since this value is used to allocate arrays statically in ioconf.c */
+#define MAX_BLKDEV     511
 #endif
 
 #define K_NODEV        "nodev"
 
 
 struct blk_config {
-       char name[IOC_NAMELEN + 1];     /* device basename */
-       char cfmt[IOC_FMTLEN + 1];      /* controller format string */
-       char dfmt[IOC_FMTLEN + 1];      /* disk format string */
-       char pfmt[IOC_FMTLEN + 1];      /* partition format string */
+       char name[IOC_NAMELEN]; /* device basename */
+       char cfmt[IOC_XFMTLEN]; /* controller format string */
+       char dfmt[IOC_FMTLEN];  /* disk format string */
+       char pfmt[IOC_FMTLEN + 2];      /* partition format string */
        /* ctrlno is in the ioc_entry */
        unsigned int ctrl_explicit;     /* use "cN" in name */
        unsigned int dcount;            /* number of devices handled by this major */
        unsigned int pcount;            /* partitions per device */
-       char desc[IOC_DESCLEN + 1];
+       char desc[IOC_DESCLEN];
        /* disk info unit # conversion function */
        char *(*cconv)(unsigned int);
 
        /* extension properties (all this for initrd?) */
-       char ext_name[IOC_NAMELEN + 1];
+       char ext_name[IOC_NAMELEN];
        unsigned int ext;               /* flag - this is an extension record */
        unsigned int ext_minor;         /* which minor does this apply to */
 };
@@ -76,8 +82,11 @@ struct ioc_entry {
 #define IOC_ENTRY_SIZE (sizeof(struct ioc_entry))
 
 
-extern int   ioc_iswhole(unsigned int, unsigned int);
-extern char *ioc_name(unsigned int, unsigned int);
-extern char *transform_devmapname(unsigned int, unsigned int);
+int ioc_iswhole
+       (unsigned int, unsigned int);
+char *ioc_name
+       (unsigned int, unsigned int);
+char *transform_devmapname
+       (unsigned int, unsigned int);
 
 #endif