Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NKB0N-0006lZ-Cd for qemu-devel@nongnu.org; Mon, 14 Dec 2009 08:30:27 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NKB0I-0006hO-Ck for qemu-devel@nongnu.org; Mon, 14 Dec 2009 08:30:26 -0500 Received: from [199.232.76.173] (port=54005 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NKB0I-0006hF-4K for qemu-devel@nongnu.org; Mon, 14 Dec 2009 08:30:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:5022) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NKB0H-0003ij-R2 for qemu-devel@nongnu.org; Mon, 14 Dec 2009 08:30:22 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nBEDULsf031755 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 14 Dec 2009 08:30:21 -0500 From: Markus Armbruster Subject: Re: [Qemu-devel] Re: [PATCH RFC] virtio: add features qdev property References: <20091213204341.GA25823@redhat.com> <4B260846.9020503@redhat.com> <20091214094255.GA32140@redhat.com> <4B261269.7080801@redhat.com> <20091214111046.GB32355@redhat.com> <4B262379.1060009@redhat.com> Date: Mon, 14 Dec 2009 14:30:19 +0100 In-Reply-To: <4B262379.1060009@redhat.com> (Gerd Hoffmann's message of "Mon, 14 Dec 2009 12:37:29 +0100") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" Gerd Hoffmann writes: > On 12/14/09 12:10, Michael S. Tsirkin wrote: >> On Mon, Dec 14, 2009 at 11:24:41AM +0100, Gerd Hoffmann wrote: >> for block: >> if (strcmp(s->serial_str, "0")) >> features |= 1<< VIRTIO_BLK_F_IDENTIFY; >> >> if (bdrv_is_read_only(s->bs)) >> features |= 1<< VIRTIO_BLK_F_RO; > > Sure you want these be configurable? > >> Also, I'd like these things to be saved in bits and not add a ton >> of fields in device. Ideas how to do this? > > I guess you only want disable features? > > You could have a bitmap property then, which accepts names for the > bits. It would need a table like this ... > > char *bitnames[] = { > [ VIRTIO_BLK_F_IDENTIFY ] = "blk-identify", > [ VIRTIO_BLK_F_RO [ = "blk-ro", > [ ... ] > }; > > Then the property parser would accepts strings such as 'bit1|bit2' and > you can have > > -device 'virtio-blk-pci,disable=blk-identify|ring-indirect' > > The driver will just do 'vdev->host_features &= ~disable'. Use of '|' in option argument syntax is user-hostile, because it requires quoting in the shell. What about '+'?