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