From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=48122 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q0E8y-000820-5q for qemu-devel@nongnu.org; Thu, 17 Mar 2011 10:25:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q0E8w-0001Nf-No for qemu-devel@nongnu.org; Thu, 17 Mar 2011 10:25:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45583) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q0E8w-0001Mq-ED for qemu-devel@nongnu.org; Thu, 17 Mar 2011 10:25:38 -0400 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.14.4/8.14.4) with ESMTP id p2HEPbBH007905 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 17 Mar 2011 10:25:37 -0400 Received: from [10.3.113.63] (ovpn-113-63.phx2.redhat.com [10.3.113.63]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p2HEPWH7001044 for ; Thu, 17 Mar 2011 10:25:36 -0400 Message-ID: <4D8219C3.9050102@redhat.com> Date: Thu, 17 Mar 2011 15:25:07 +0100 From: Jes Sorensen MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 5/7] ccid: add ccid-card-emulated device References: <1298460024-23591-1-git-send-email-alevy@redhat.com> <1298460024-23591-6-git-send-email-alevy@redhat.com> <4D7E370E.6090602@redhat.com> <20110317105416.GR7413@playa.tlv.redhat.com> In-Reply-To: <20110317105416.GR7413@playa.tlv.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On 03/17/11 11:54, Alon Levy wrote: > On Mon, Mar 14, 2011 at 04:41:02PM +0100, Jes Sorensen wrote: >>> +static const char *emul_event_to_string(uint32_t emul_event) >>> +{ >>> + switch (emul_event) { >>> + case EMUL_READER_INSERT: return "EMUL_READER_INSERT"; >>> + case EMUL_READER_REMOVE: return "EMUL_READER_REMOVE"; >>> + case EMUL_CARD_INSERT: return "EMUL_CARD_INSERT"; >>> + case EMUL_CARD_REMOVE: return "EMUL_CARD_REMOVE"; >>> + case EMUL_GUEST_APDU: return "EMUL_GUEST_APDU"; >>> + case EMUL_RESPONSE_APDU: return "EMUL_RESPONSE_APDU"; >>> + case EMUL_ERROR: return "EMUL_ERROR"; >> >> YUCK! > can we turn down the caps / disgust statements? I understand this > is a personal affront to you somehow? can we settle this at dawn > tommorrow? LOL, there is nothing in coding style allowing this, even if there's a couple of cases in the code still doing it. Tomorrow is ok - will you be taking an overnight flight here? :) >> >> No multi statements on a single line! >> >>> +#define MAX_ATR_SIZE 40 >>> +struct EmulatedState { >>> + CCIDCardState base; >>> + uint8_t debug; >>> + char *backend_str; >>> + uint32_t backend; >>> + char *cert1; >>> + char *cert2; >>> + char *cert3; >>> + char *db; >>> + uint8_t atr[MAX_ATR_SIZE]; >>> + uint8_t atr_length; >>> + QSIMPLEQ_HEAD(event_list, EmulEvent) event_list; >>> + pthread_mutex_t event_list_mutex; >>> + VReader *reader; >>> + QSIMPLEQ_HEAD(guest_apdu_list, EmulEvent) guest_apdu_list; >>> + pthread_mutex_t vreader_mutex; /* and guest_apdu_list mutex */ >>> + pthread_mutex_t handle_apdu_mutex; >>> + pthread_cond_t handle_apdu_cond; >>> + int pipe[2]; >>> + int quit_apdu_thread; >>> + pthread_mutex_t apdu_thread_quit_mutex; >>> + pthread_cond_t apdu_thread_quit_cond; >>> +}; >> >> Bad struct packing and wrong thread types. > will use qemu-thread. that's what you mean by wrong thread types, right? > s/pthread_thread_t/QemuThread/ etc. (Cond, Mutex) Yep Looks good! Cheers, Jes