From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGyM3-0002yZ-6U for qemu-devel@nongnu.org; Fri, 21 Feb 2014 17:14:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WGyLy-0000fz-5h for qemu-devel@nongnu.org; Fri, 21 Feb 2014 17:13:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:23813) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGyLx-0000fs-PD for qemu-devel@nongnu.org; Fri, 21 Feb 2014 17:13:54 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1LMDqLR018698 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 21 Feb 2014 17:13:52 -0500 From: Kevin Wolf Date: Fri, 21 Feb 2014 23:12:39 +0100 Message-Id: <1393020771-32712-43-git-send-email-kwolf@redhat.com> In-Reply-To: <1393020771-32712-1-git-send-email-kwolf@redhat.com> References: <1393020771-32712-1-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 42/54] quorum: Create BDRVQuorumState and BlkDriver and do init. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com From: Beno=C3=AEt Canet Create the structure holding the quorum settings and write the minimal bl= ock driver instanciation boilerplate. Signed-off-by: Benoit Canet Reviewed-by: Max Reitz Signed-off-by: Kevin Wolf --- block/quorum.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/block/quorum.c b/block/quorum.c index 950f5cc..375ffd5 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -15,6 +15,23 @@ =20 #include "block/block_int.h" =20 +/* the following structure holds the state of one quorum instance */ +typedef struct BDRVQuorumState { + BlockDriverState **bs; /* children BlockDriverStates */ + int num_children; /* children count */ + int threshold; /* if less than threshold children reads gave= the + * same result a quorum error occurs. + */ + bool is_blkverify; /* true if the driver is in blkverify mode + * Writes are mirrored on two children device= s. + * On reads the two children devices' content= s are + * compared and if a difference is spotted it= s + * location is printed and the code aborts. + * It is useful to debug other block drivers = by + * comparing them with a reference one. + */ +} BDRVQuorumState; + typedef struct QuorumAIOCB QuorumAIOCB; =20 /* Quorum will create one instance of the following structure per operat= ion it @@ -51,3 +68,17 @@ struct QuorumAIOCB { bool is_read; int vote_ret; }; + +static BlockDriver bdrv_quorum =3D { + .format_name =3D "quorum", + .protocol_name =3D "quorum", + + .instance_size =3D sizeof(BDRVQuorumState), +}; + +static void bdrv_quorum_init(void) +{ + bdrv_register(&bdrv_quorum); +} + +block_init(bdrv_quorum_init); --=20 1.8.1.4