qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 5/7] ccid: add ccid-card-emulated device


From: Jes Sorensen
Subject: Re: [Qemu-devel] [PATCH 5/7] ccid: add ccid-card-emulated device
Date: Thu, 17 Mar 2011 15:25:07 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]