diff options
author | Karel Zak | 2018-09-19 11:04:35 +0200 |
---|---|---|
committer | Karel Zak | 2018-09-19 11:40:17 +0200 |
commit | baad6dcc6e29503542440584ffdc4b6edd201aba (patch) | |
tree | 36cfca522418c506641066e7103d833927cbb1d5 /misc-utils/lsblk.h | |
parent | tests: update sfdisk resize (diff) | |
download | kernel-qcow2-util-linux-baad6dcc6e29503542440584ffdc4b6edd201aba.tar.gz kernel-qcow2-util-linux-baad6dcc6e29503542440584ffdc4b6edd201aba.tar.xz kernel-qcow2-util-linux-baad6dcc6e29503542440584ffdc4b6edd201aba.zip |
lsblk: cleanup udev/blkid properties code
* split properties to separate struct which is allocated only when
udev or blkid provides some information
* use separate function for udev and blkid and hide details in generic
get_device_properties()
* make sure we do not overwrite stuff udev and blkid (but this is only
theoretic issue as we do not call get_properties_by_blkid() directly
from code)
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/lsblk.h')
-rw-r--r-- | misc-utils/lsblk.h | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/misc-utils/lsblk.h b/misc-utils/lsblk.h index 13e8e754d..df274e523 100644 --- a/misc-utils/lsblk.h +++ b/misc-utils/lsblk.h @@ -48,8 +48,24 @@ struct lsblk { extern struct lsblk *lsblk; /* global handler */ +struct lsblk_devprop { + char *fstype; /* detected fs, NULL or "?" if cannot detect */ + char *uuid; /* filesystem UUID (or stack uuid) */ + char *ptuuid; /* partition table UUID */ + char *pttype; /* partition table type */ + char *label; /* filesystem label */ + char *parttype; /* partition type UUID */ + char *partuuid; /* partition UUID */ + char *partlabel; /* partition label */ + char *partflags; /* partition flags */ + char *wwn; /* storage WWN */ + char *serial; /* disk serial number */ + char *model; /* disk model */ +}; + struct blkdev_cxt { struct blkdev_cxt *parent; + struct lsblk_devprop *properties; struct libscols_line *scols_line; struct stat st; @@ -63,20 +79,6 @@ struct blkdev_cxt { int partition; /* is partition? TRUE/FALSE */ - int probed; /* already probed */ - char *fstype; /* detected fs, NULL or "?" if cannot detect */ - char *uuid; /* filesystem UUID (or stack uuid) */ - char *ptuuid; /* partition table UUID */ - char *pttype; /* partition table type */ - char *label; /* filesystem label */ - char *parttype; /* partition type UUID */ - char *partuuid; /* partition UUID */ - char *partlabel; /* partition label */ - char *partflags; /* partition flags */ - char *wwn; /* storage WWN */ - char *serial; /* disk serial number */ - char *model; /* disk model */ - char *mountpoint; /* device mountpoint */ struct statvfs fsstat; /* statvfs() result */ @@ -90,7 +92,9 @@ struct blkdev_cxt { uint64_t size; /* device size */ unsigned int is_mounted : 1, - is_swap : 1; + is_swap : 1, + udev_requested : 1, + blkid_requested : 1; }; /* lsblk-mnt.c */ |