[COL_PATH] = { "PATH", 0, SCOLS_FL_TRUNC, N_("path of the locked file")},
[COL_BLOCKER] = { "BLOCKER", 0, SCOLS_FL_RIGHT, N_("PID of the process blocking the lock") }
};
-#define NCOLS ARRAY_SIZE(infos)
-static int columns[NCOLS], ncolumns;
+
+static int columns[ARRAY_SIZE(infos) * 2];
+static int ncolumns;
+
static pid_t pid = 0;
static struct libmnt_table *tab; /* /proc/self/mountinfo */
{
size_t i;
- for (i = 0; i < NCOLS; i++)
+ for (i = 0; i < ARRAY_SIZE(infos); i++)
infos[i].flags &= ~SCOLS_FL_TRUNC;
}
assert(name);
- for (i = 0; i < NCOLS; i++) {
+ for (i = 0; i < ARRAY_SIZE(infos); i++) {
const char *cn = infos[i].name;
if (!strncasecmp(name, cn, namesz) && !*(cn + namesz))
static inline int get_column_id(int num)
{
- assert(ARRAY_SIZE(columns) == NCOLS);
assert(num < ncolumns);
- assert(columns[num] < (int) NCOLS);
+ assert(columns[num] < (int) ARRAY_SIZE(infos));
return columns[num];
}
fputs(_("\nAvailable columns (for --output):\n"), out);
- for (i = 0; i < NCOLS; i++)
+ for (i = 0; i < ARRAY_SIZE(infos); i++)
fprintf(out, " %11s %s\n", infos[i].name, _(infos[i].help));
fprintf(out, USAGE_MAN_TAIL("lslocks(8)"));