+#define LEFTALIGN -1
+#define RIGHTALIGN 1
+
+typedef struct {
+ char *line1;
+ char *line2;
+ int colwidth;
+ int alignment;
+ bool visible;
+} column_format;
+
+enum {
+ COL_ZONE_NAME,
+ COL_ELEM_SIZE,
+ COL_CUR_SIZE,
+ COL_MAX_SIZE,
+ COL_CUR_ELTS,
+ COL_MAX_ELTS,
+ COL_CUR_INUSE,
+ COL_ALLOC_SIZE,
+ COL_ALLOC_COUNT,
+ COL_ZONE_FLAGS,
+ COL_FRAG_SIZE,
+ COL_FREE_SIZE,
+ COL_TOTAL_ALLOCS,
+ COL_MAX
+};
+
+/*
+ * The order in which the columns appear below should match
+ * the order in which the values are printed in colprintzone().
+ */
+static column_format columns[] = {
+ [COL_ZONE_NAME] = { "", "zone name", 25, LEFTALIGN, true },
+ [COL_ELEM_SIZE] = { "elem", "size", 6, RIGHTALIGN, true },
+ [COL_CUR_SIZE] = { "cur", "size", 11, RIGHTALIGN, true },
+ [COL_MAX_SIZE] = { "max", "size", 11, RIGHTALIGN, true },
+ [COL_CUR_ELTS] = { "cur", "#elts", 10, RIGHTALIGN, true },
+ [COL_MAX_ELTS] = { "max", "#elts", 11, RIGHTALIGN, true },
+ [COL_CUR_INUSE] = { "cur", "inuse", 11, RIGHTALIGN, true },
+ [COL_ALLOC_SIZE] = { "alloc", "size", 6, RIGHTALIGN, true },
+ [COL_ALLOC_COUNT] = { "alloc", "count", 6, RIGHTALIGN, true },
+ [COL_ZONE_FLAGS] = { "", "", 2, RIGHTALIGN, true },
+ /* additional columns for special flags, not visible by default */
+ [COL_FRAG_SIZE] = { "frag", "size", 9, RIGHTALIGN, false },
+ [COL_FREE_SIZE] = { "free", "size", 9, RIGHTALIGN, false },
+ [COL_TOTAL_ALLOCS] = { "total", "allocs", 17, RIGHTALIGN, false }
+};
+