summaryrefslogtreecommitdiffstats
path: root/src/hardware/lsblk.c
diff options
context:
space:
mode:
authorJan Synacek <jsynacek@redhat.com>2014-04-29 08:33:13 +0200
committerJan Synacek <jsynacek@redhat.com>2014-04-30 15:54:14 +0200
commit55f63d29f5d2b4e82979d71386df58394e87ef5a (patch)
tree34227f5696df9b3a85c5999d2fd48f50be82681f /src/hardware/lsblk.c
parentdab89c6afb2a2b339ebadea3d47e841cd749b5ef (diff)
downloadopenlmi-providers-55f63d29f5d2b4e82979d71386df58394e87ef5a.tar.gz
openlmi-providers-55f63d29f5d2b4e82979d71386df58394e87ef5a.tar.xz
openlmi-providers-55f63d29f5d2b4e82979d71386df58394e87ef5a.zip
libopenlmi: reorganize and gather
Make naming consistent. Gather common functionality into one library and try to use it across all providers. Introduce libtool-style versioning for libraries.
Diffstat (limited to 'src/hardware/lsblk.c')
-rw-r--r--src/hardware/lsblk.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/hardware/lsblk.c b/src/hardware/lsblk.c
index 512ccad..a6d2980 100644
--- a/src/hardware/lsblk.c
+++ b/src/hardware/lsblk.c
@@ -85,7 +85,7 @@ short check_lsblkhdd_attributes(LsblkHdd *hdd)
done:
if (ret != 0) {
- warn("Failed to allocate memory.");
+ lmi_warn("Failed to allocate memory.");
}
return ret;
@@ -95,7 +95,7 @@ short lsblk_get_hdds(LsblkHdd **hdds, unsigned *hdds_nb)
{
short ret = -1;
unsigned i, curr_hdd = 0, buffer_size = 0;
- char **buffer = NULL, *path, *type, *buf, errbuf[STRERROR_BUF_LEN];
+ char **buffer = NULL, *path, *type, *buf, errbuf[BUFLEN];
struct stat sb;
unsigned long capacity = 0;
@@ -112,14 +112,14 @@ short lsblk_get_hdds(LsblkHdd **hdds, unsigned *hdds_nb)
/* if no hard drive was found */
if (*hdds_nb < 1) {
- warn("Lsblk didn't recognize any hard drive.");
+ lmi_warn("Lsblk didn't recognize any hard drive.");
goto done;
}
/* allocate memory for hard drives */
*hdds = (LsblkHdd *)calloc(*hdds_nb, sizeof(LsblkHdd));
if (!(*hdds)) {
- warn("Failed to allocate memory.");
+ lmi_warn("Failed to allocate memory.");
*hdds_nb = 0;
goto done;
}
@@ -131,13 +131,13 @@ short lsblk_get_hdds(LsblkHdd **hdds, unsigned *hdds_nb)
continue;
}
if (stat(path, &sb) != 0) {
- warn("Stat() call on file \"%s\" failed: %s",
+ lmi_warn("Stat() call on file \"%s\" failed: %s",
path, strerror_r(errno, errbuf, sizeof(errbuf)));
free(path);
continue;
}
if ((sb.st_mode & S_IFMT) != S_IFBLK) {
- warn("File \"%s\" is not a block device.", path);
+ lmi_warn("File \"%s\" is not a block device.", path);
free(path);
continue;
}
@@ -181,7 +181,7 @@ short lsblk_get_hdds(LsblkHdd **hdds, unsigned *hdds_nb)
(*hdds)[curr_hdd].basename = strdup(basename(path));
if (!(*hdds)[curr_hdd].basename) {
- warn("Failed to allocate memory.");
+ lmi_warn("Failed to allocate memory.");
goto done;
}
@@ -189,11 +189,11 @@ short lsblk_get_hdds(LsblkHdd **hdds, unsigned *hdds_nb)
}
if (curr_hdd != *hdds_nb) {
- warn("Not all reported drives by lsblk were processed.");
+ lmi_warn("Not all reported drives by lsblk were processed.");
LsblkHdd *tmp_hdd = (LsblkHdd *)realloc(*hdds,
curr_hdd * sizeof(LsblkHdd));
if (!tmp_hdd) {
- warn("Failed to allocate memory.");
+ lmi_warn("Failed to allocate memory.");
goto done;
}
*hdds = tmp_hdd;