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 <al...@redhat.com> > > > > --- > [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