Revision d0f2c4c6 block/curl.c

b/block/curl.c
29 29
// #define DEBUG_VERBOSE
30 30

  
31 31
#ifdef DEBUG_CURL
32
#define dprintf(fmt, ...) do { printf(fmt, ## __VA_ARGS__); } while (0)
32
#define DPRINTF(fmt, ...) do { printf(fmt, ## __VA_ARGS__); } while (0)
33 33
#else
34
#define dprintf(fmt, ...) do { } while (0)
34
#define DPRINTF(fmt, ...) do { } while (0)
35 35
#endif
36 36

  
37 37
#define CURL_NUM_STATES 8
......
80 80
static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
81 81
                        void *s, void *sp)
82 82
{
83
    dprintf("CURL (AIO): Sock action %d on fd %d\n", action, fd);
83
    DPRINTF("CURL (AIO): Sock action %d on fd %d\n", action, fd);
84 84
    switch (action) {
85 85
        case CURL_POLL_IN:
86 86
            qemu_aio_set_fd_handler(fd, curl_multi_do, NULL, NULL, NULL, s);
......
118 118
    size_t realsize = size * nmemb;
119 119
    int i;
120 120

  
121
    dprintf("CURL: Just reading %lld bytes\n", (unsigned long long)realsize);
121
    DPRINTF("CURL: Just reading %lld bytes\n", (unsigned long long)realsize);
122 122

  
123 123
    if (!s || !s->orig_buf)
124 124
        goto read_end;
......
349 349
        inited = 1;
350 350
    }
351 351

  
352
    dprintf("CURL: Opening %s\n", file);
352
    DPRINTF("CURL: Opening %s\n", file);
353 353
    s->url = file;
354 354
    state = curl_init_state(s);
355 355
    if (!state)
......
368 368
        s->len = (size_t)d;
369 369
    else if(!s->len)
370 370
        goto out;
371
    dprintf("CURL: Size = %lld\n", (long long)s->len);
371
    DPRINTF("CURL: Size = %lld\n", (long long)s->len);
372 372

  
373 373
    curl_clean_state(state);
374 374
    curl_easy_cleanup(state->curl);
......
451 451
    state->acb[0] = acb;
452 452

  
453 453
    snprintf(state->range, 127, "%lld-%lld", (long long)start, (long long)end);
454
    dprintf("CURL (AIO): Reading %d at %lld (%s)\n", (nb_sectors * SECTOR_SIZE), start, state->range);
454
    DPRINTF("CURL (AIO): Reading %d at %lld (%s)\n", (nb_sectors * SECTOR_SIZE), start, state->range);
455 455
    curl_easy_setopt(state->curl, CURLOPT_RANGE, state->range);
456 456

  
457 457
    curl_multi_add_handle(s->multi, state->curl);
......
465 465
    BDRVCURLState *s = bs->opaque;
466 466
    int i;
467 467

  
468
    dprintf("CURL: Close\n");
468
    DPRINTF("CURL: Close\n");
469 469
    for (i=0; i<CURL_NUM_STATES; i++) {
470 470
        if (s->states[i].in_use)
471 471
            curl_clean_state(&s->states[i]);

Also available in: Unified diff