On 03/14/11 17:44, Alon Levy wrote:
> On Mon, Mar 14, 2011 at 04:41:02PM +0100, Jes Sorensen wrote:
>>> +#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 fix.
>
> Aside: Why do we care about packing something that has a single instance per
> device?
> isn't logical readable order more important in this case?
We don't care too much - use your own judgement for what makes sense in
this case. I am used to spotting those so I mention them, but I didn't
actually check how often the struct was used.
Cheers,
Jes