|
From: | Supriya Kannery |
Subject: | Re: [Qemu-devel] [v9 Patch 4/6]Qemu: Add commandline -drive option 'hostcache' |
Date: | Thu, 17 Nov 2011 10:48:20 +0530 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.20) Gecko/20110817 Fedora/3.1.12-1.fc14 Thunderbird/3.1.12 |
On 11/17/2011 01:36 AM, Stefan Hajnoczi wrote:
On Fri, Nov 11, 2011 at 6:48 AM, Supriya Kannery <address@hidden> wrote:+ if ((hostcache = qemu_opt_get_bool(opts, "hostcache", -1)) != -1) {This does not work. qemu_opt_get_bool() takes a bool default argument and returns a bool. (bool)-1 == true. But (int)true == 1 and you cannot expect it to ever equal -1. Try this: if (qemu_opt_get(opts, "hostcache")&& !qemu_opt_get_bool(opts, "hostcache", false)) { bdrv_flags |= BDRV_O_NOCACHE; } Stefan
Thanks! for pointing this. Does the following look ok? if ((hostcache = qemu_opt_get_bool(opts, "hostcache", 1) == 0) { bdrv_flags |= BDRV_O_NOCACHE; } If either "hostcache" is not at all specified or it is specified as "on", qemu_opt_get_bool will return 1, which can be ignored as bdrv_flags is initialized to 0.
[Prev in Thread] | Current Thread | [Next in Thread] |