diff options
author | Karel Zak | 2018-10-09 12:46:28 +0200 |
---|---|---|
committer | Karel Zak | 2018-12-07 12:32:57 +0100 |
commit | fed34a1e631594d4c4337a1b2a7e9507715e11c6 (patch) | |
tree | 8c756e2fbd26d4b2e270326a007aa4fc27e48726 /misc-utils/lsblk-properties.c | |
parent | build-sys: do not require crypt() (diff) | |
download | kernel-qcow2-util-linux-fed34a1e631594d4c4337a1b2a7e9507715e11c6.tar.gz kernel-qcow2-util-linux-fed34a1e631594d4c4337a1b2a7e9507715e11c6.tar.xz kernel-qcow2-util-linux-fed34a1e631594d4c4337a1b2a7e9507715e11c6.zip |
lsblk: rename blkdev_cxt to lsblk_device
The patch does not change code logic and semantic -- just rename.
* set_cxt() to set_device()
* struct blkdev_cxt to lsblk_device
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/lsblk-properties.c')
-rw-r--r-- | misc-utils/lsblk-properties.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/misc-utils/lsblk-properties.c b/misc-utils/lsblk-properties.c index 10a9846e5..30168dd48 100644 --- a/misc-utils/lsblk-properties.c +++ b/misc-utils/lsblk-properties.c @@ -36,18 +36,18 @@ void lsblk_device_free_properties(struct lsblk_devprop *p) } #ifndef HAVE_LIBUDEV -static struct lsblk_devprop *get_properties_by_udev(struct blkdev_cxt *cxt +static struct lsblk_devprop *get_properties_by_udev(struct lsblk_device *dev __attribute__((__unused__))) { return NULL; } #else -static struct lsblk_devprop *get_properties_by_udev(struct blkdev_cxt *cxt) +static struct lsblk_devprop *get_properties_by_udev(struct lsblk_device *ld) { struct udev_device *dev; - if (cxt->udev_requested) - return cxt->properties; + if (ld->udev_requested) + return ld->properties; if (lsblk->sysroot) goto done; @@ -56,14 +56,14 @@ static struct lsblk_devprop *get_properties_by_udev(struct blkdev_cxt *cxt) if (!udev) goto done; - dev = udev_device_new_from_subsystem_sysname(udev, "block", cxt->name); + dev = udev_device_new_from_subsystem_sysname(udev, "block", ld->name); if (dev) { const char *data; struct lsblk_devprop *prop; - if (cxt->properties) - lsblk_device_free_properties(cxt->properties); - prop = cxt->properties = xcalloc(1, sizeof(*cxt->properties)); + if (ld->properties) + lsblk_device_free_properties(ld->properties); + prop = ld->properties = xcalloc(1, sizeof(*ld->properties)); if ((data = udev_device_get_property_value(dev, "ID_FS_LABEL_ENC"))) { prop->label = xstrdup(data); @@ -102,28 +102,28 @@ static struct lsblk_devprop *get_properties_by_udev(struct blkdev_cxt *cxt) prop->model = xstrdup(data); udev_device_unref(dev); - DBG(DEV, ul_debugobj(cxt, "%s: found udev properties", cxt->name)); + DBG(DEV, ul_debugobj(ld, "%s: found udev properties", ld->name)); } done: - cxt->udev_requested = 1; - return cxt->properties; + ld->udev_requested = 1; + return ld->properties; } #endif /* HAVE_LIBUDEV */ -static struct lsblk_devprop *get_properties_by_blkid(struct blkdev_cxt *cxt) +static struct lsblk_devprop *get_properties_by_blkid(struct lsblk_device *dev) { blkid_probe pr = NULL; - if (cxt->blkid_requested) - return cxt->properties; + if (dev->blkid_requested) + return dev->properties; - if (!cxt->size) + if (!dev->size) goto done; if (getuid() != 0) goto done;; /* no permissions to read from the device */ - pr = blkid_new_probe_from_filename(cxt->filename); + pr = blkid_new_probe_from_filename(dev->filename); if (!pr) goto done; @@ -138,9 +138,9 @@ static struct lsblk_devprop *get_properties_by_blkid(struct blkdev_cxt *cxt) const char *data = NULL; struct lsblk_devprop *prop; - if (cxt->properties) - lsblk_device_free_properties(cxt->properties); - prop = cxt->properties = xcalloc(1, sizeof(*cxt->properties)); + if (dev->properties) + lsblk_device_free_properties(dev->properties); + prop = dev->properties = xcalloc(1, sizeof(*dev->properties)); if (!blkid_probe_lookup_value(pr, "TYPE", &data, NULL)) prop->fstype = xstrdup(data); @@ -161,22 +161,22 @@ static struct lsblk_devprop *get_properties_by_blkid(struct blkdev_cxt *cxt) if (!blkid_probe_lookup_value(pr, "PART_ENTRY_FLAGS", &data, NULL)) prop->partflags = xstrdup(data); - DBG(DEV, ul_debugobj(cxt, "%s: found blkid properties", cxt->name)); + DBG(DEV, ul_debugobj(dev, "%s: found blkid properties", dev->name)); } done: blkid_free_probe(pr); - cxt->blkid_requested = 1; - return cxt->properties; + dev->blkid_requested = 1; + return dev->properties; } -struct lsblk_devprop *lsblk_device_get_properties(struct blkdev_cxt *cxt) +struct lsblk_devprop *lsblk_device_get_properties(struct lsblk_device *dev) { - struct lsblk_devprop *p = get_properties_by_udev(cxt); + struct lsblk_devprop *p = get_properties_by_udev(dev); if (!p) - p = get_properties_by_blkid(cxt); + p = get_properties_by_blkid(dev); return p; } |