From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=39891 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q4BLZ-0005fG-2P for qemu-devel@nongnu.org; Mon, 28 Mar 2011 08:15:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q4BLX-0003J0-1w for qemu-devel@nongnu.org; Mon, 28 Mar 2011 08:15:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1720) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q4BLW-0003Ik-Nn for qemu-devel@nongnu.org; Mon, 28 Mar 2011 08:14:59 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2SCEwQB009253 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 28 Mar 2011 08:14:58 -0400 Date: Mon, 28 Mar 2011 14:14:53 +0200 From: Alon Levy Subject: Re: [Qemu-devel] [PATCH v23 05/11] ccid: add passthru card device Message-ID: <20110328121453.GD28224@playa.redhat.com> References: <1300886393-2799-1-git-send-email-alevy@redhat.com> <1300886393-2799-6-git-send-email-alevy@redhat.com> <4D907A4D.1000103@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4D907A4D.1000103@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jes Sorensen Cc: qemu-devel@nongnu.org On Mon, Mar 28, 2011 at 02:08:45PM +0200, Jes Sorensen wrote: > On 03/23/11 14:19, Alon Levy wrote: > > The passthru ccid card is a device sitting on the usb-ccid bus and > > using a chardevice to communicate with a remote device using the > > VSCard protocol defined in libcacard/vscard_common.h > > > > Usage docs available in following patch in docs/ccid.txt > > > > Signed-off-by: Alon Levy > > > > --- > [snip] > > > +static void ccid_card_vscard_send_error(PassthruState *s, > > + uint32_t reader_id, VSCErrorCode code) > > +{ > > + VSCMsgError msg = {.code = htonl(code)}; > > + > > + ccid_card_vscard_send_msg( > > + s, VSC_Error, reader_id, (uint8_t *)&msg, sizeof(msg)); > > +} > > + > > +static void ccid_card_vscard_send_init(PassthruState *s) > > +{ > > + VSCMsgInit msg = { > > + .version = htonl(VSCARD_VERSION), > > + .magic = VSCARD_MAGIC, > > + .capabilities = {0} > > + }; > > + > > If this goes over the wire, don't you need to htonl(VSCARD_MAGIC) here > if someone tries to run passthrough from a big endian system to a little > endian system, or vice versa? The VSCARD_MAGIC definition is actually a cast of a string, so it is already in the correct byte order: libcacard/vscard_common.h:#define VSCARD_MAGIC (*(uint32_t *)"VSCD") > > Otherwise it looks ok to me. > > Cheers, > Jes