Commit graph

13 commits

Author SHA1 Message Date
Masatake YAMATO
3401af7c45 lsfd: declare local variables at the beginning of block
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2021-12-10 00:53:11 +09:00
Masatake YAMATO
57d5ee16ff lsfd: use the list of block devices in /proc/devices for decoding SOURCE column
For decoding the SOURCE column of a fd opening a block devices, the
origina code uses /proc/partitions only. However, this is not enough
for decoding /dev/nullb0. Though is is a block device node, the block
device behind the node is not listed in /proc/partitions.

This change uses the information min /proc/devices as the fallback of
/proc/partitions.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2021-12-09 00:39:38 +09:00
Masatake YAMATO
618db96498 lsfd: rename DEVNAME column to SOURCE
Reflecting the review comment:

    maybe rename DEVNAME to SOURCE as we have here things like 'devtmpfs' etc.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2021-10-06 11:01:54 +02:00
Masatake YAMATO
7591516d0e lsfd: add DEVTYPE column
Reflecting the review comment:

    add DEVTYPE for blk, char, and nodev

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2021-10-06 11:01:54 +02:00
Masatake YAMATO
6cdc99060a lsfd: rename the column DEVICE to MAJ:MIN
Reflecting the review comment:

    add MAJ:MIN for major and minor numbers, remove DEVICE (we use
    MAJ:MIN in other tools)

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2021-10-06 11:01:54 +02:00
Karel Zak
f9fa97d395 lsfd: cleanup new file initialization
Don't use new_<class>() functions if we have already have
file_class callbacks.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-10-06 11:01:54 +02:00
Karel Zak
2d95dc093b lsfd: use 'new_' prefix when we allocate something
It's more readable than rather than 'make_'.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-10-06 11:01:54 +02:00
Masatake YAMATO
63f3938581 lsfd: add MAPLEN column
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2021-10-06 11:01:53 +02:00
Masatake YAMATO
a500de3400 lsfd: introduce DEVNAME column and use it as default
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2021-10-06 11:01:53 +02:00
Masatake YAMATO
b3a23f4d3a lsfd: add PARTITION column
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2021-10-06 11:01:53 +02:00
Masatake YAMATO
353151b005 lsfd: read /proc/partitions
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2021-10-06 11:01:53 +02:00
Masatake YAMATO
14e16696ff lsfd: move file_class variants after their constructors
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2021-10-06 11:01:53 +02:00
Masatake YAMATO
26508d6325 lsfd: simplify class hierarchy
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2021-10-06 11:01:53 +02:00
Renamed from misc-utils/lsfd-bdev-file.c (Browse further)