* [Qemu-devel] [7181] qemu-io: Fix handling of bdrv_is_allocated() return value ( Kevin Wolf)
@ 2009-04-18 15:36 Anthony Liguori
0 siblings, 0 replies; only message in thread
From: Anthony Liguori @ 2009-04-18 15:36 UTC (permalink / raw)
To: qemu-devel
Revision: 7181
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7181
Author: aliguori
Date: 2009-04-18 15:36:19 +0000 (Sat, 18 Apr 2009)
Log Message:
-----------
qemu-io: Fix handling of bdrv_is_allocated() return value (Kevin Wolf)
bdrv_is_allocated() returns a boolean which indicates if the offset is
allocated, not 0 on success and everything else is an error.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Modified Paths:
--------------
trunk/qemu-io.c
Modified: trunk/qemu-io.c
===================================================================
--- trunk/qemu-io.c 2009-04-18 15:36:15 UTC (rev 7180)
+++ trunk/qemu-io.c 2009-04-18 15:36:19 UTC (rev 7181)
@@ -794,6 +794,7 @@
char s1[64];
int num;
int ret;
+ const char *retstr;
offset = cvtnum(argv[1]);
if (offset & 0x1ff) {
@@ -808,18 +809,15 @@
nb_sectors = 1;
ret = bdrv_is_allocated(bs, offset >> 9, nb_sectors, &num);
- if (ret) {
- printf("is_allocated: %s", strerror(ret));
- return 0;
- }
cvtstr(offset, s1, sizeof(s1));
+ retstr = ret ? "allocated" : "not allocated";
if (nb_sectors == 1)
- printf("sector allocated at offset %s\n", s1);
+ printf("sector %s at offset %s\n", retstr, s1);
else
- printf("%d/%d sectors allocated at offset %s\n",
- num, nb_sectors, s1);
+ printf("%d/%d sectors %s at offset %s\n",
+ num, nb_sectors, retstr, s1);
return 0;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-04-18 15:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-18 15:36 [Qemu-devel] [7181] qemu-io: Fix handling of bdrv_is_allocated() return value ( Kevin Wolf) Anthony Liguori
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).