size_t column_index)
{
char *str = NULL;
- const char *partition;
+ const char *partition, *devdrv;
switch(column_id) {
case COL_TYPE:
if (scols_line_set_data(ln, column_index, "BLK"))
err(EXIT_FAILURE, _("failed to add output data"));
return true;
+ case COL_BLKDRV:
+ devdrv = get_blkdrv(major(file->stat.st_rdev));
+ if (devdrv)
+ str = strdup(devdrv);
+ else
+ xasprintf(&str, "%u",
+ major(file->stat.st_rdev));
+ break;
case COL_DEVTYPE:
if (scols_line_set_data(ln, column_index,
"blk"))
str = strdup(partition);
break;
}
+ devdrv = get_blkdrv(major(file->stat.st_rdev));
+ if (devdrv) {
+ xasprintf(&str, "%s:%u", devdrv,
+ minor(file->stat.st_rdev));
+ break;
+ }
/* FALL THROUGH */
case COL_MAJMIN:
xasprintf(&str, "%u:%u",
ASSOC <__string__>::
Association between file and process.
+BLKDRV <__string__>::
+Block device driver name resolved by _/proc/devices_.
+
CHRDRV <__string__>::
Character device driver name resolved by _/proc/devices_.
static struct colinfo infos[] = {
[COL_ASSOC] = { "ASSOC", 0, SCOLS_FL_RIGHT, SCOLS_JSON_STRING,
N_("association between file and process") },
+ [COL_BLKDRV] = { "BLKDRV", 0, SCOLS_FL_RIGHT, SCOLS_JSON_STRING,
+ N_("block device driver name resolved by /proc/devices") },
[COL_CHRDRV] = { "CHRDRV", 0, SCOLS_FL_RIGHT, SCOLS_JSON_STRING,
N_("character device driver name resolved by /proc/devices") },
[COL_COMMAND] = { "COMMAND",0.3, SCOLS_FL_TRUNC, SCOLS_JSON_STRING,