[Libosinfo] [PATCHv2 04/11] test-isodetect: Load volume size info
Zeeshan Ali (Khattak)
zeeshanak at gnome.org
Tue Mar 17 14:43:54 UTC 2015
Our data on various ISOs provide volume size information. Lets load
that information so that its part of our tests.
---
test/test-isodetect.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/test/test-isodetect.c b/test/test-isodetect.c
index 5bd211a..a051df7 100644
--- a/test/test-isodetect.c
+++ b/test/test-isodetect.c
@@ -93,6 +93,7 @@ static struct ISOInfo *load_iso(GFile *file, const gchar *shortid, const gchar *
GDataInputStream *dis = NULL;
gchar *line;
const gchar *arch;
+ gint64 vol_size = -1, blk_size;
if (!(fis = g_file_read(file, NULL, error)))
goto error;
@@ -148,9 +149,18 @@ static struct ISOInfo *load_iso(GFile *file, const gchar *shortid, const gchar *
osinfo_entity_set_param(OSINFO_ENTITY(info->media),
OSINFO_MEDIA_PROP_APPLICATION_ID,
line + 16);
+ } else if (g_str_has_prefix(line, "Logical block size is:")) {
+ blk_size = (gint64) atoll (line + 23);
+ } else if (g_str_has_prefix(line, "Volume size is:")) {
+ vol_size = atoll (line + 16);
}
}
+ if (vol_size > 0)
+ osinfo_entity_set_param_int64(OSINFO_ENTITY(info->media),
+ OSINFO_MEDIA_PROP_VOLUME_SIZE,
+ vol_size * blk_size);
+
if (*error)
goto error;
--
2.1.0
More information about the Libosinfo
mailing list