diff --git a/block-migration.c b/block-migration.c index 258a88afcc..230d7ed59f 100644 --- a/block-migration.c +++ b/block-migration.c @@ -33,10 +33,10 @@ //#define DEBUG_BLK_MIGRATION #ifdef DEBUG_BLK_MIGRATION -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { printf("blk_migration: " fmt, ## __VA_ARGS__); } while (0) #else -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { } while (0) #endif @@ -332,7 +332,7 @@ static void flush_blks(QEMUFile* f) { BlkMigBlock *blk; - dprintf("%s Enter submitted %d read_done %d transferred %d\n", + DPRINTF("%s Enter submitted %d read_done %d transferred %d\n", __FUNCTION__, block_mig_state.submitted, block_mig_state.read_done, block_mig_state.transferred); @@ -355,7 +355,7 @@ static void flush_blks(QEMUFile* f) assert(block_mig_state.read_done >= 0); } - dprintf("%s Exit submitted %d read_done %d transferred %d\n", __FUNCTION__, + DPRINTF("%s Exit submitted %d read_done %d transferred %d\n", __FUNCTION__, block_mig_state.submitted, block_mig_state.read_done, block_mig_state.transferred); } @@ -400,7 +400,7 @@ static void blk_mig_cleanup(Monitor *mon) static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque) { - dprintf("Enter save live stage %d submitted %d transferred %d\n", + DPRINTF("Enter save live stage %d submitted %d transferred %d\n", stage, block_mig_state.submitted, block_mig_state.transferred); if (stage < 0) { diff --git a/block/curl.c b/block/curl.c index 5223ce8790..86ac81b268 100644 --- a/block/curl.c +++ b/block/curl.c @@ -29,9 +29,9 @@ // #define DEBUG_VERBOSE #ifdef DEBUG_CURL -#define dprintf(fmt, ...) do { printf(fmt, ## __VA_ARGS__); } while (0) +#define DPRINTF(fmt, ...) do { printf(fmt, ## __VA_ARGS__); } while (0) #else -#define dprintf(fmt, ...) do { } while (0) +#define DPRINTF(fmt, ...) do { } while (0) #endif #define CURL_NUM_STATES 8 @@ -80,7 +80,7 @@ static void curl_multi_do(void *arg); static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action, void *s, void *sp) { - dprintf("CURL (AIO): Sock action %d on fd %d\n", action, fd); + DPRINTF("CURL (AIO): Sock action %d on fd %d\n", action, fd); switch (action) { case CURL_POLL_IN: qemu_aio_set_fd_handler(fd, curl_multi_do, NULL, NULL, NULL, s); @@ -118,7 +118,7 @@ static size_t curl_read_cb(void *ptr, size_t size, size_t nmemb, void *opaque) size_t realsize = size * nmemb; int i; - dprintf("CURL: Just reading %lld bytes\n", (unsigned long long)realsize); + DPRINTF("CURL: Just reading %lld bytes\n", (unsigned long long)realsize); if (!s || !s->orig_buf) goto read_end; @@ -349,7 +349,7 @@ static int curl_open(BlockDriverState *bs, const char *filename, int flags) inited = 1; } - dprintf("CURL: Opening %s\n", file); + DPRINTF("CURL: Opening %s\n", file); s->url = file; state = curl_init_state(s); if (!state) @@ -368,7 +368,7 @@ static int curl_open(BlockDriverState *bs, const char *filename, int flags) s->len = (size_t)d; else if(!s->len) goto out; - dprintf("CURL: Size = %lld\n", (long long)s->len); + DPRINTF("CURL: Size = %lld\n", (long long)s->len); curl_clean_state(state); curl_easy_cleanup(state->curl); @@ -451,7 +451,7 @@ static BlockDriverAIOCB *curl_aio_readv(BlockDriverState *bs, state->acb[0] = acb; snprintf(state->range, 127, "%lld-%lld", (long long)start, (long long)end); - dprintf("CURL (AIO): Reading %d at %lld (%s)\n", (nb_sectors * SECTOR_SIZE), start, state->range); + DPRINTF("CURL (AIO): Reading %d at %lld (%s)\n", (nb_sectors * SECTOR_SIZE), start, state->range); curl_easy_setopt(state->curl, CURLOPT_RANGE, state->range); curl_multi_add_handle(s->multi, state->curl); @@ -465,7 +465,7 @@ static void curl_close(BlockDriverState *bs) BDRVCURLState *s = bs->opaque; int i; - dprintf("CURL: Close\n"); + DPRINTF("CURL: Close\n"); for (i=0; istates[i].in_use) curl_clean_state(&s->states[i]); diff --git a/buffered_file.c b/buffered_file.c index 217f75e60e..54dc6c29ba 100644 --- a/buffered_file.c +++ b/buffered_file.c @@ -39,10 +39,10 @@ typedef struct QEMUFileBuffered } QEMUFileBuffered; #ifdef DEBUG_BUFFERED_FILE -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { printf("buffered-file: " fmt, ## __VA_ARGS__); } while (0) #else -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { } while (0) #endif @@ -52,7 +52,7 @@ static void buffered_append(QEMUFileBuffered *s, if (size > (s->buffer_capacity - s->buffer_size)) { void *tmp; - dprintf("increasing buffer capacity from %zu by %zu\n", + DPRINTF("increasing buffer capacity from %zu by %zu\n", s->buffer_capacity, size + 1024); s->buffer_capacity += size + 1024; @@ -75,11 +75,11 @@ static void buffered_flush(QEMUFileBuffered *s) size_t offset = 0; if (s->has_error) { - dprintf("flush when error, bailing\n"); + DPRINTF("flush when error, bailing\n"); return; } - dprintf("flushing %zu byte(s) of data\n", s->buffer_size); + DPRINTF("flushing %zu byte(s) of data\n", s->buffer_size); while (offset < s->buffer_size) { ssize_t ret; @@ -87,22 +87,22 @@ static void buffered_flush(QEMUFileBuffered *s) ret = s->put_buffer(s->opaque, s->buffer + offset, s->buffer_size - offset); if (ret == -EAGAIN) { - dprintf("backend not ready, freezing\n"); + DPRINTF("backend not ready, freezing\n"); s->freeze_output = 1; break; } if (ret <= 0) { - dprintf("error flushing data, %zd\n", ret); + DPRINTF("error flushing data, %zd\n", ret); s->has_error = 1; break; } else { - dprintf("flushed %zd byte(s)\n", ret); + DPRINTF("flushed %zd byte(s)\n", ret); offset += ret; } } - dprintf("flushed %zu of %zu byte(s)\n", offset, s->buffer_size); + DPRINTF("flushed %zu of %zu byte(s)\n", offset, s->buffer_size); memmove(s->buffer, s->buffer + offset, s->buffer_size - offset); s->buffer_size -= offset; } @@ -113,45 +113,45 @@ static int buffered_put_buffer(void *opaque, const uint8_t *buf, int64_t pos, in int offset = 0; ssize_t ret; - dprintf("putting %d bytes at %" PRId64 "\n", size, pos); + DPRINTF("putting %d bytes at %" PRId64 "\n", size, pos); if (s->has_error) { - dprintf("flush when error, bailing\n"); + DPRINTF("flush when error, bailing\n"); return -EINVAL; } - dprintf("unfreezing output\n"); + DPRINTF("unfreezing output\n"); s->freeze_output = 0; buffered_flush(s); while (!s->freeze_output && offset < size) { if (s->bytes_xfer > s->xfer_limit) { - dprintf("transfer limit exceeded when putting\n"); + DPRINTF("transfer limit exceeded when putting\n"); break; } ret = s->put_buffer(s->opaque, buf + offset, size - offset); if (ret == -EAGAIN) { - dprintf("backend not ready, freezing\n"); + DPRINTF("backend not ready, freezing\n"); s->freeze_output = 1; break; } if (ret <= 0) { - dprintf("error putting\n"); + DPRINTF("error putting\n"); s->has_error = 1; offset = -EINVAL; break; } - dprintf("put %zd byte(s)\n", ret); + DPRINTF("put %zd byte(s)\n", ret); offset += ret; s->bytes_xfer += ret; } if (offset >= 0) { - dprintf("buffering %d bytes\n", size - offset); + DPRINTF("buffering %d bytes\n", size - offset); buffered_append(s, buf + offset, size - offset); offset = size; } @@ -164,7 +164,7 @@ static int buffered_close(void *opaque) QEMUFileBuffered *s = opaque; int ret; - dprintf("closing\n"); + DPRINTF("closing\n"); while (!s->has_error && s->buffer_size) { buffered_flush(s); diff --git a/hw/gt64xxx.c b/hw/gt64xxx.c index c8034e2aea..f47af43966 100644 --- a/hw/gt64xxx.c +++ b/hw/gt64xxx.c @@ -31,9 +31,9 @@ //#define DEBUG #ifdef DEBUG -#define dprintf(fmt, ...) fprintf(stderr, "%s: " fmt, __FUNCTION__, ##__VA_ARGS__) +#define DPRINTF(fmt, ...) fprintf(stderr, "%s: " fmt, __FUNCTION__, ##__VA_ARGS__) #else -#define dprintf(fmt, ...) +#define DPRINTF(fmt, ...) #endif #define GT_REGS (0x1000 >> 2) @@ -276,7 +276,7 @@ static void gt64120_isd_mapping(GT64120State *s) check_reserved_space(&start, &length); length = 0x1000; /* Map new address */ - dprintf("ISD: %x@%x -> %x@%x, %x\n", s->ISD_length, s->ISD_start, + DPRINTF("ISD: %x@%x -> %x@%x, %x\n", s->ISD_length, s->ISD_start, length, start, s->ISD_handle); s->ISD_start = start; s->ISD_length = length; @@ -423,7 +423,7 @@ static void gt64120_writel (void *opaque, target_phys_addr_t addr, case GT_DEV_B3: case GT_DEV_BOOT: /* Not implemented */ - dprintf ("Unimplemented device register offset 0x%x\n", saddr << 2); + DPRINTF ("Unimplemented device register offset 0x%x\n", saddr << 2); break; /* ECC */ @@ -457,7 +457,7 @@ static void gt64120_writel (void *opaque, target_phys_addr_t addr, case GT_DMA2_CUR: case GT_DMA3_CUR: /* Not implemented */ - dprintf ("Unimplemented DMA register offset 0x%x\n", saddr << 2); + DPRINTF ("Unimplemented DMA register offset 0x%x\n", saddr << 2); break; /* DMA Channel Control */ @@ -466,13 +466,13 @@ static void gt64120_writel (void *opaque, target_phys_addr_t addr, case GT_DMA2_CTRL: case GT_DMA3_CTRL: /* Not implemented */ - dprintf ("Unimplemented DMA register offset 0x%x\n", saddr << 2); + DPRINTF ("Unimplemented DMA register offset 0x%x\n", saddr << 2); break; /* DMA Arbiter */ case GT_DMA_ARB: /* Not implemented */ - dprintf ("Unimplemented DMA register offset 0x%x\n", saddr << 2); + DPRINTF ("Unimplemented DMA register offset 0x%x\n", saddr << 2); break; /* Timer/Counter */ @@ -482,7 +482,7 @@ static void gt64120_writel (void *opaque, target_phys_addr_t addr, case GT_TC3: case GT_TC_CONTROL: /* Not implemented */ - dprintf ("Unimplemented timer register offset 0x%x\n", saddr << 2); + DPRINTF ("Unimplemented timer register offset 0x%x\n", saddr << 2); break; /* PCI Internal */ @@ -539,19 +539,19 @@ static void gt64120_writel (void *opaque, target_phys_addr_t addr, /* not really implemented */ s->regs[saddr] = ~(~(s->regs[saddr]) | ~(val & 0xfffffffe)); s->regs[saddr] |= !!(s->regs[saddr] & 0xfffffffe); - dprintf("INTRCAUSE %x\n", val); + DPRINTF("INTRCAUSE %x\n", val); break; case GT_INTRMASK: s->regs[saddr] = val & 0x3c3ffffe; - dprintf("INTRMASK %x\n", val); + DPRINTF("INTRMASK %x\n", val); break; case GT_PCI0_ICMASK: s->regs[saddr] = val & 0x03fffffe; - dprintf("ICMASK %x\n", val); + DPRINTF("ICMASK %x\n", val); break; case GT_PCI0_SERR0MASK: s->regs[saddr] = val & 0x0000003f; - dprintf("SERR0MASK %x\n", val); + DPRINTF("SERR0MASK %x\n", val); break; /* Reserved when only PCI_0 is configured. */ @@ -575,7 +575,7 @@ static void gt64120_writel (void *opaque, target_phys_addr_t addr, break; default: - dprintf ("Bad register offset 0x%x\n", (int)addr); + DPRINTF ("Bad register offset 0x%x\n", (int)addr); break; } } @@ -815,19 +815,19 @@ static uint32_t gt64120_readl (void *opaque, /* Interrupts */ case GT_INTRCAUSE: val = s->regs[saddr]; - dprintf("INTRCAUSE %x\n", val); + DPRINTF("INTRCAUSE %x\n", val); break; case GT_INTRMASK: val = s->regs[saddr]; - dprintf("INTRMASK %x\n", val); + DPRINTF("INTRMASK %x\n", val); break; case GT_PCI0_ICMASK: val = s->regs[saddr]; - dprintf("ICMASK %x\n", val); + DPRINTF("ICMASK %x\n", val); break; case GT_PCI0_SERR0MASK: val = s->regs[saddr]; - dprintf("SERR0MASK %x\n", val); + DPRINTF("SERR0MASK %x\n", val); break; /* Reserved when only PCI_0 is configured. */ @@ -842,7 +842,7 @@ static uint32_t gt64120_readl (void *opaque, default: val = s->regs[saddr]; - dprintf ("Bad register offset 0x%x\n", (int)addr); + DPRINTF ("Bad register offset 0x%x\n", (int)addr); break; } diff --git a/hw/hpet.c b/hw/hpet.c index 6f397110c0..8729fb21c6 100644 --- a/hw/hpet.c +++ b/hw/hpet.c @@ -32,9 +32,9 @@ //#define HPET_DEBUG #ifdef HPET_DEBUG -#define dprintf printf +#define DPRINTF printf #else -#define dprintf(...) +#define DPRINTF(...) #endif static HPETState *hpet_statep; @@ -288,7 +288,7 @@ static uint32_t hpet_ram_readl(void *opaque, target_phys_addr_t addr) HPETState *s = (HPETState *)opaque; uint64_t cur_tick, index; - dprintf("qemu: Enter hpet_ram_readl at %" PRIx64 "\n", addr); + DPRINTF("qemu: Enter hpet_ram_readl at %" PRIx64 "\n", addr); index = addr; /*address range of all TN regs*/ if (index >= 0x100 && index <= 0x3ff) { @@ -311,7 +311,7 @@ static uint32_t hpet_ram_readl(void *opaque, target_phys_addr_t addr) case HPET_TN_ROUTE: return timer->fsb >> 32; default: - dprintf("qemu: invalid hpet_ram_readl\n"); + DPRINTF("qemu: invalid hpet_ram_readl\n"); break; } } else { @@ -323,26 +323,26 @@ static uint32_t hpet_ram_readl(void *opaque, target_phys_addr_t addr) case HPET_CFG: return s->config; case HPET_CFG + 4: - dprintf("qemu: invalid HPET_CFG + 4 hpet_ram_readl \n"); + DPRINTF("qemu: invalid HPET_CFG + 4 hpet_ram_readl \n"); return 0; case HPET_COUNTER: if (hpet_enabled()) cur_tick = hpet_get_ticks(); else cur_tick = s->hpet_counter; - dprintf("qemu: reading counter = %" PRIx64 "\n", cur_tick); + DPRINTF("qemu: reading counter = %" PRIx64 "\n", cur_tick); return cur_tick; case HPET_COUNTER + 4: if (hpet_enabled()) cur_tick = hpet_get_ticks(); else cur_tick = s->hpet_counter; - dprintf("qemu: reading counter + 4 = %" PRIx64 "\n", cur_tick); + DPRINTF("qemu: reading counter + 4 = %" PRIx64 "\n", cur_tick); return cur_tick >> 32; case HPET_STATUS: return s->isr; default: - dprintf("qemu: invalid hpet_ram_readl\n"); + DPRINTF("qemu: invalid hpet_ram_readl\n"); break; } } @@ -372,7 +372,7 @@ static void hpet_ram_writel(void *opaque, target_phys_addr_t addr, HPETState *s = (HPETState *)opaque; uint64_t old_val, new_val, val, index; - dprintf("qemu: Enter hpet_ram_writel at %" PRIx64 " = %#x\n", addr, value); + DPRINTF("qemu: Enter hpet_ram_writel at %" PRIx64 " = %#x\n", addr, value); index = addr; old_val = hpet_ram_readl(opaque, addr); new_val = value; @@ -380,12 +380,12 @@ static void hpet_ram_writel(void *opaque, target_phys_addr_t addr, /*address range of all TN regs*/ if (index >= 0x100 && index <= 0x3ff) { uint8_t timer_id = (addr - 0x100) / 0x20; - dprintf("qemu: hpet_ram_writel timer_id = %#x \n", timer_id); + DPRINTF("qemu: hpet_ram_writel timer_id = %#x \n", timer_id); HPETTimer *timer = &s->timer[timer_id]; switch ((addr - 0x100) % 0x20) { case HPET_TN_CFG: - dprintf("qemu: hpet_ram_writel HPET_TN_CFG\n"); + DPRINTF("qemu: hpet_ram_writel HPET_TN_CFG\n"); val = hpet_fixup_reg(new_val, old_val, HPET_TN_CFG_WRITE_MASK); timer->config = (timer->config & 0xffffffff00000000ULL) | val; if (new_val & HPET_TN_32BIT) { @@ -399,10 +399,10 @@ static void hpet_ram_writel(void *opaque, target_phys_addr_t addr, break; case HPET_TN_CFG + 4: // Interrupt capabilities - dprintf("qemu: invalid HPET_TN_CFG+4 write\n"); + DPRINTF("qemu: invalid HPET_TN_CFG+4 write\n"); break; case HPET_TN_CMP: // comparator register - dprintf("qemu: hpet_ram_writel HPET_TN_CMP \n"); + DPRINTF("qemu: hpet_ram_writel HPET_TN_CMP \n"); if (timer->config & HPET_TN_32BIT) new_val = (uint32_t)new_val; if (!timer_is_periodic(timer) || @@ -423,7 +423,7 @@ static void hpet_ram_writel(void *opaque, target_phys_addr_t addr, hpet_set_timer(timer); break; case HPET_TN_CMP + 4: // comparator register high order - dprintf("qemu: hpet_ram_writel HPET_TN_CMP + 4\n"); + DPRINTF("qemu: hpet_ram_writel HPET_TN_CMP + 4\n"); if (!timer_is_periodic(timer) || (timer->config & HPET_TN_SETVAL)) timer->cmp = (timer->cmp & 0xffffffffULL) @@ -443,10 +443,10 @@ static void hpet_ram_writel(void *opaque, target_phys_addr_t addr, hpet_set_timer(timer); break; case HPET_TN_ROUTE + 4: - dprintf("qemu: hpet_ram_writel HPET_TN_ROUTE + 4\n"); + DPRINTF("qemu: hpet_ram_writel HPET_TN_ROUTE + 4\n"); break; default: - dprintf("qemu: invalid hpet_ram_writel\n"); + DPRINTF("qemu: invalid hpet_ram_writel\n"); break; } return; @@ -479,7 +479,7 @@ static void hpet_ram_writel(void *opaque, target_phys_addr_t addr, } break; case HPET_CFG + 4: - dprintf("qemu: invalid HPET_CFG+4 write \n"); + DPRINTF("qemu: invalid HPET_CFG+4 write \n"); break; case HPET_STATUS: /* FIXME: need to handle level-triggered interrupts */ @@ -489,7 +489,7 @@ static void hpet_ram_writel(void *opaque, target_phys_addr_t addr, printf("qemu: Writing counter while HPET enabled!\n"); s->hpet_counter = (s->hpet_counter & 0xffffffff00000000ULL) | value; - dprintf("qemu: HPET counter written. ctr = %#x -> %" PRIx64 "\n", + DPRINTF("qemu: HPET counter written. ctr = %#x -> %" PRIx64 "\n", value, s->hpet_counter); break; case HPET_COUNTER + 4: @@ -497,11 +497,11 @@ static void hpet_ram_writel(void *opaque, target_phys_addr_t addr, printf("qemu: Writing counter while HPET enabled!\n"); s->hpet_counter = (s->hpet_counter & 0xffffffffULL) | (((uint64_t)value) << 32); - dprintf("qemu: HPET counter + 4 written. ctr = %#x -> %" PRIx64 "\n", + DPRINTF("qemu: HPET counter + 4 written. ctr = %#x -> %" PRIx64 "\n", value, s->hpet_counter); break; default: - dprintf("qemu: invalid hpet_ram_writel\n"); + DPRINTF("qemu: invalid hpet_ram_writel\n"); break; } } @@ -568,7 +568,7 @@ void hpet_init(qemu_irq *irq) { int i, iomemtype; HPETState *s; - dprintf ("hpet_init\n"); + DPRINTF ("hpet_init\n"); s = qemu_mallocz(sizeof(HPETState)); hpet_statep = s; diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c index 2cc246ce1a..5c5dc4a2a2 100644 --- a/hw/usb-ohci.c +++ b/hw/usb-ohci.c @@ -42,9 +42,9 @@ //#define OHCI_TIME_WARP 1 #ifdef DEBUG_OHCI -#define dprintf printf +#define DPRINTF printf #else -#define dprintf(...) +#define DPRINTF(...) #endif /* Number of Downstream Ports on the root hub. */ @@ -355,7 +355,7 @@ static void ohci_attach(USBPort *port1, USBDevice *dev) /* send the attach message */ usb_send_msg(dev, USB_MSG_ATTACH); - dprintf("usb-ohci: Attached port %d\n", port1->index); + DPRINTF("usb-ohci: Attached port %d\n", port1->index); } else { /* set connect status */ if (port->ctrl & OHCI_PORT_CCS) { @@ -373,7 +373,7 @@ static void ohci_attach(USBPort *port1, USBDevice *dev) usb_send_msg(dev, USB_MSG_DETACH); } port->port.dev = NULL; - dprintf("usb-ohci: Detached port %d\n", port1->index); + DPRINTF("usb-ohci: Detached port %d\n", port1->index); } if (old_state != port->ctrl) @@ -427,7 +427,7 @@ static void ohci_reset(void *opaque) usb_cancel_packet(&ohci->usb_packet); ohci->async_td = 0; } - dprintf("usb-ohci: Reset %s\n", ohci->name); + DPRINTF("usb-ohci: Reset %s\n", ohci->name); } /* Get an array of dwords from main memory */ @@ -593,7 +593,7 @@ static void ohci_async_complete_packet(USBPacket *packet, void *opaque) { OHCIState *ohci = opaque; #ifdef DEBUG_PACKET - dprintf("Async packet complete\n"); + DPRINTF("Async packet complete\n"); #endif ohci->async_complete = 1; ohci_process_lists(ohci, 1); @@ -648,12 +648,12 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed, #endif if (relative_frame_number < 0) { - dprintf("usb-ohci: ISO_TD R=%d < 0\n", relative_frame_number); + DPRINTF("usb-ohci: ISO_TD R=%d < 0\n", relative_frame_number); return 1; } else if (relative_frame_number > frame_count) { /* ISO TD expired - retire the TD to the Done Queue and continue with the next ISO TD of the same ED */ - dprintf("usb-ohci: ISO_TD R=%d > FC=%d\n", relative_frame_number, + DPRINTF("usb-ohci: ISO_TD R=%d > FC=%d\n", relative_frame_number, frame_count); OHCI_SET_BM(iso_td.flags, TD_CC, OHCI_CC_DATAOVERRUN); ed->head &= ~OHCI_DPTR_MASK; @@ -856,7 +856,7 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed) completion = (addr == ohci->async_td); if (completion && !ohci->async_complete) { #ifdef DEBUG_PACKET - dprintf("Skipping async TD\n"); + DPRINTF("Skipping async TD\n"); #endif return 1; } @@ -907,14 +907,14 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed) flag_r = (td.flags & OHCI_TD_R) != 0; #ifdef DEBUG_PACKET - dprintf(" TD @ 0x%.8x %" PRId64 " bytes %s r=%d cbp=0x%.8x be=0x%.8x\n", + DPRINTF(" TD @ 0x%.8x %" PRId64 " bytes %s r=%d cbp=0x%.8x be=0x%.8x\n", addr, len, str, flag_r, td.cbp, td.be); if (len > 0 && dir != OHCI_TD_DIR_IN) { - dprintf(" data:"); + DPRINTF(" data:"); for (i = 0; i < len; i++) printf(" %.2x", ohci->usb_buf[i]); - dprintf("\n"); + DPRINTF("\n"); } #endif if (completion) { @@ -935,7 +935,7 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed) timely manner. */ #ifdef DEBUG_PACKET - dprintf("Too many pending packets\n"); + DPRINTF("Too many pending packets\n"); #endif return 1; } @@ -951,7 +951,7 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed) break; } #ifdef DEBUG_PACKET - dprintf("ret=%d\n", ret); + DPRINTF("ret=%d\n", ret); #endif if (ret == USB_RET_ASYNC) { ohci->async_td = addr; @@ -962,10 +962,10 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed) if (dir == OHCI_TD_DIR_IN) { ohci_copy_td(ohci, &td, ohci->usb_buf, ret, 1); #ifdef DEBUG_PACKET - dprintf(" data:"); + DPRINTF(" data:"); for (i = 0; i < ret; i++) printf(" %.2x", ohci->usb_buf[i]); - dprintf("\n"); + DPRINTF("\n"); #endif } else { ret = len; @@ -994,21 +994,21 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed) ed->head |= OHCI_ED_C; } else { if (ret >= 0) { - dprintf("usb-ohci: Underrun\n"); + DPRINTF("usb-ohci: Underrun\n"); OHCI_SET_BM(td.flags, TD_CC, OHCI_CC_DATAUNDERRUN); } else { switch (ret) { case USB_RET_NODEV: OHCI_SET_BM(td.flags, TD_CC, OHCI_CC_DEVICENOTRESPONDING); case USB_RET_NAK: - dprintf("usb-ohci: got NAK\n"); + DPRINTF("usb-ohci: got NAK\n"); return 1; case USB_RET_STALL: - dprintf("usb-ohci: got STALL\n"); + DPRINTF("usb-ohci: got STALL\n"); OHCI_SET_BM(td.flags, TD_CC, OHCI_CC_STALL); break; case USB_RET_BABBLE: - dprintf("usb-ohci: got BABBLE\n"); + DPRINTF("usb-ohci: got BABBLE\n"); OHCI_SET_BM(td.flags, TD_CC, OHCI_CC_DATAOVERRUN); break; default: @@ -1067,7 +1067,7 @@ static int ohci_service_ed_list(OHCIState *ohci, uint32_t head, int completion) while ((ed.head & OHCI_DPTR_MASK) != ed.tail) { #ifdef DEBUG_PACKET - dprintf("ED @ 0x%.8x fa=%u en=%u d=%u s=%u k=%u f=%u mps=%u " + DPRINTF("ED @ 0x%.8x fa=%u en=%u d=%u s=%u k=%u f=%u mps=%u " "h=%u c=%u\n head=0x%.8x tailp=0x%.8x next=0x%.8x\n", cur, OHCI_BM(ed.flags, ED_FA), OHCI_BM(ed.flags, ED_EN), OHCI_BM(ed.flags, ED_D), (ed.flags & OHCI_ED_S)!= 0, @@ -1107,7 +1107,7 @@ static void ohci_process_lists(OHCIState *ohci, int completion) { if ((ohci->ctl & OHCI_CTL_CLE) && (ohci->status & OHCI_STATUS_CLF)) { if (ohci->ctrl_cur && ohci->ctrl_cur != ohci->ctrl_head) - dprintf("usb-ohci: head %x, cur %x\n", + DPRINTF("usb-ohci: head %x, cur %x\n", ohci->ctrl_head, ohci->ctrl_cur); if (!ohci_service_ed_list(ohci, ohci->ctrl_head, completion)) { ohci->ctrl_cur = 0; @@ -1191,7 +1191,7 @@ static int ohci_bus_start(OHCIState *ohci) return 0; } - dprintf("usb-ohci: %s: USB Operational\n", ohci->name); + DPRINTF("usb-ohci: %s: USB Operational\n", ohci->name); ohci_sof(ohci); @@ -1244,7 +1244,7 @@ static void ohci_set_frame_interval(OHCIState *ohci, uint16_t val) val &= OHCI_FMI_FI; if (val != ohci->fi) { - dprintf("usb-ohci: %s: FrameInterval = 0x%x (%u)\n", + DPRINTF("usb-ohci: %s: FrameInterval = 0x%x (%u)\n", ohci->name, ohci->fi, ohci->fi); } @@ -1283,14 +1283,14 @@ static void ohci_set_ctl(OHCIState *ohci, uint32_t val) break; case OHCI_USB_SUSPEND: ohci_bus_stop(ohci); - dprintf("usb-ohci: %s: USB Suspended\n", ohci->name); + DPRINTF("usb-ohci: %s: USB Suspended\n", ohci->name); break; case OHCI_USB_RESUME: - dprintf("usb-ohci: %s: USB Resume\n", ohci->name); + DPRINTF("usb-ohci: %s: USB Resume\n", ohci->name); break; case OHCI_USB_RESET: ohci_reset(ohci); - dprintf("usb-ohci: %s: USB Reset\n", ohci->name); + DPRINTF("usb-ohci: %s: USB Reset\n", ohci->name); break; } } @@ -1335,7 +1335,7 @@ static void ohci_set_hub_status(OHCIState *ohci, uint32_t val) for (i = 0; i < ohci->num_ports; i++) ohci_port_power(ohci, i, 0); - dprintf("usb-ohci: powered down all ports\n"); + DPRINTF("usb-ohci: powered down all ports\n"); } if (val & OHCI_RHS_LPSC) { @@ -1343,7 +1343,7 @@ static void ohci_set_hub_status(OHCIState *ohci, uint32_t val) for (i = 0; i < ohci->num_ports; i++) ohci_port_power(ohci, i, 1); - dprintf("usb-ohci: powered up all ports\n"); + DPRINTF("usb-ohci: powered up all ports\n"); } if (val & OHCI_RHS_DRWE) @@ -1375,10 +1375,10 @@ static void ohci_port_set_status(OHCIState *ohci, int portnum, uint32_t val) ohci_port_set_if_connected(ohci, portnum, val & OHCI_PORT_PES); if (ohci_port_set_if_connected(ohci, portnum, val & OHCI_PORT_PSS)) - dprintf("usb-ohci: port %d: SUSPEND\n", portnum); + DPRINTF("usb-ohci: port %d: SUSPEND\n", portnum); if (ohci_port_set_if_connected(ohci, portnum, val & OHCI_PORT_PRS)) { - dprintf("usb-ohci: port %d: RESET\n", portnum); + DPRINTF("usb-ohci: port %d: RESET\n", portnum); usb_send_msg(port->port.dev, USB_MSG_RESET); port->ctrl &= ~OHCI_PORT_PRS; /* ??? Should this also set OHCI_PORT_PESC. */ @@ -1680,7 +1680,7 @@ static void usb_ohci_init(OHCIState *ohci, DeviceState *dev, usb_bit_time = 1; } #endif - dprintf("usb-ohci: usb_bit_time=%" PRId64 " usb_frame_time=%" PRId64 "\n", + DPRINTF("usb-ohci: usb_bit_time=%" PRId64 " usb_frame_time=%" PRId64 "\n", usb_frame_time, usb_bit_time); } diff --git a/hw/usb-uhci.c b/hw/usb-uhci.c index fdbb4d180f..434070eeb2 100644 --- a/hw/usb-uhci.c +++ b/hw/usb-uhci.c @@ -71,7 +71,7 @@ #define NB_PORTS 2 #ifdef DEBUG -#define dprintf printf +#define DPRINTF printf static const char *pid2str(int pid) { @@ -84,7 +84,7 @@ static const char *pid2str(int pid) } #else -#define dprintf(...) +#define DPRINTF(...) #endif #ifdef DEBUG_DUMP_DATA @@ -198,7 +198,7 @@ static void uhci_async_unlink(UHCIState *s, UHCIAsync *async) static void uhci_async_cancel(UHCIState *s, UHCIAsync *async) { - dprintf("uhci: cancel td 0x%x token 0x%x done %u\n", + DPRINTF("uhci: cancel td 0x%x token 0x%x done %u\n", async->td, async->token, async->done); if (!async->done) @@ -329,7 +329,7 @@ static void uhci_reset(void *opaque) int i; UHCIPort *port; - dprintf("uhci: full reset\n"); + DPRINTF("uhci: full reset\n"); pci_conf = s->dev.config; @@ -427,7 +427,7 @@ static void uhci_ioport_writew(void *opaque, uint32_t addr, uint32_t val) UHCIState *s = opaque; addr &= 0x1f; - dprintf("uhci: writew port=0x%04x val=0x%04x\n", addr, val); + DPRINTF("uhci: writew port=0x%04x val=0x%04x\n", addr, val); switch(addr) { case 0x00: @@ -538,7 +538,7 @@ static uint32_t uhci_ioport_readw(void *opaque, uint32_t addr) break; } - dprintf("uhci: readw port=0x%04x val=0x%04x\n", addr, val); + DPRINTF("uhci: readw port=0x%04x val=0x%04x\n", addr, val); return val; } @@ -548,7 +548,7 @@ static void uhci_ioport_writel(void *opaque, uint32_t addr, uint32_t val) UHCIState *s = opaque; addr &= 0x1f; - dprintf("uhci: writel port=0x%04x val=0x%08x\n", addr, val); + DPRINTF("uhci: writel port=0x%04x val=0x%08x\n", addr, val); switch(addr) { case 0x08: @@ -639,7 +639,7 @@ static int uhci_broadcast_packet(UHCIState *s, USBPacket *p) { int i, ret; - dprintf("uhci: packet enter. pid %s addr 0x%02x ep %d len %d\n", + DPRINTF("uhci: packet enter. pid %s addr 0x%02x ep %d len %d\n", pid2str(p->pid), p->devaddr, p->devep, p->len); if (p->pid == USB_TOKEN_OUT || p->pid == USB_TOKEN_SETUP) dump_data(p->data, p->len); @@ -653,7 +653,7 @@ static int uhci_broadcast_packet(UHCIState *s, USBPacket *p) ret = dev->info->handle_packet(dev, p); } - dprintf("uhci: packet exit. ret %d len %d\n", ret, p->len); + DPRINTF("uhci: packet exit. ret %d len %d\n", ret, p->len); if (p->pid == USB_TOKEN_IN && ret > 0) dump_data(p->data, ret); @@ -709,7 +709,7 @@ static int uhci_complete_td(UHCIState *s, UHCI_TD *td, UHCIAsync *async, uint32_ if ((td->ctrl & TD_CTRL_SPD) && len < max_len) { *int_mask |= 0x02; /* short packet: do not update QH */ - dprintf("uhci: short packet. td 0x%x token 0x%x\n", async->td, async->token); + DPRINTF("uhci: short packet. td 0x%x token 0x%x\n", async->td, async->token); return 1; } } @@ -839,7 +839,7 @@ static void uhci_async_complete(USBPacket *packet, void *opaque) UHCIState *s = opaque; UHCIAsync *async = (UHCIAsync *) packet; - dprintf("uhci: async complete. td 0x%x token 0x%x\n", async->td, async->token); + DPRINTF("uhci: async complete. td 0x%x token 0x%x\n", async->td, async->token); async->done = 1; @@ -899,7 +899,7 @@ static void uhci_process_frame(UHCIState *s) frame_addr = s->fl_base_addr + ((s->frnum & 0x3ff) << 2); - dprintf("uhci: processing frame %d addr 0x%x\n" , s->frnum, frame_addr); + DPRINTF("uhci: processing frame %d addr 0x%x\n" , s->frnum, frame_addr); cpu_physical_memory_read(frame_addr, (uint8_t *)&link, 4); le32_to_cpus(&link); @@ -921,7 +921,7 @@ static void uhci_process_frame(UHCIState *s) * are already done, and async completion handler will re-process * the frame when something is ready. */ - dprintf("uhci: detected loop. qh 0x%x\n", link); + DPRINTF("uhci: detected loop. qh 0x%x\n", link); break; } @@ -929,7 +929,7 @@ static void uhci_process_frame(UHCIState *s) le32_to_cpus(&qh.link); le32_to_cpus(&qh.el_link); - dprintf("uhci: QH 0x%x load. link 0x%x elink 0x%x\n", + DPRINTF("uhci: QH 0x%x load. link 0x%x elink 0x%x\n", link, qh.link, qh.el_link); if (!is_valid(qh.el_link)) { @@ -951,7 +951,7 @@ static void uhci_process_frame(UHCIState *s) le32_to_cpus(&td.token); le32_to_cpus(&td.buffer); - dprintf("uhci: TD 0x%x load. link 0x%x ctrl 0x%x token 0x%x qh 0x%x\n", + DPRINTF("uhci: TD 0x%x load. link 0x%x ctrl 0x%x token 0x%x qh 0x%x\n", link, td.link, td.ctrl, td.token, curr_qh); old_td_ctrl = td.ctrl; @@ -969,7 +969,7 @@ static void uhci_process_frame(UHCIState *s) } if (ret == 2 || ret == 1) { - dprintf("uhci: TD 0x%x %s. link 0x%x ctrl 0x%x token 0x%x qh 0x%x\n", + DPRINTF("uhci: TD 0x%x %s. link 0x%x ctrl 0x%x token 0x%x qh 0x%x\n", link, ret == 2 ? "pend" : "skip", td.link, td.ctrl, td.token, curr_qh); @@ -979,7 +979,7 @@ static void uhci_process_frame(UHCIState *s) /* completed TD */ - dprintf("uhci: TD 0x%x done. link 0x%x ctrl 0x%x token 0x%x qh 0x%x\n", + DPRINTF("uhci: TD 0x%x done. link 0x%x ctrl 0x%x token 0x%x qh 0x%x\n", link, td.link, td.ctrl, td.token, curr_qh); link = td.link; @@ -994,7 +994,7 @@ static void uhci_process_frame(UHCIState *s) if (!depth_first(link)) { /* done with this QH */ - dprintf("uhci: QH 0x%x done. link 0x%x elink 0x%x\n", + DPRINTF("uhci: QH 0x%x done. link 0x%x elink 0x%x\n", curr_qh, qh.link, qh.el_link); curr_qh = 0; @@ -1019,7 +1019,7 @@ static void uhci_frame_timer(void *opaque) /* set hchalted bit in status - UHCI11D 2.1.2 */ s->status |= UHCI_STS_HCHALTED; - dprintf("uhci: halted\n"); + DPRINTF("uhci: halted\n"); return; } @@ -1033,7 +1033,7 @@ static void uhci_frame_timer(void *opaque) /* Start new frame */ s->frnum = (s->frnum + 1) & 0x7ff; - dprintf("uhci: new frame #%u\n" , s->frnum); + DPRINTF("uhci: new frame #%u\n" , s->frnum); uhci_async_validate_begin(s); diff --git a/migration-exec.c b/migration-exec.c index 87f645b68c..3edc026009 100644 --- a/migration-exec.c +++ b/migration-exec.c @@ -24,10 +24,10 @@ //#define DEBUG_MIGRATION_EXEC #ifdef DEBUG_MIGRATION_EXEC -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { printf("migration-exec: " fmt, ## __VA_ARGS__); } while (0) #else -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { } while (0) #endif @@ -43,7 +43,7 @@ static int file_write(FdMigrationState *s, const void * buf, size_t size) static int exec_close(FdMigrationState *s) { - dprintf("exec_close\n"); + DPRINTF("exec_close\n"); if (s->opaque) { qemu_fclose(s->opaque); s->opaque = NULL; @@ -66,13 +66,13 @@ MigrationState *exec_start_outgoing_migration(Monitor *mon, f = popen(command, "w"); if (f == NULL) { - dprintf("Unable to popen exec target\n"); + DPRINTF("Unable to popen exec target\n"); goto err_after_alloc; } s->fd = fileno(f); if (s->fd == -1) { - dprintf("Unable to retrieve file descriptor for popen'd handle\n"); + DPRINTF("Unable to retrieve file descriptor for popen'd handle\n"); goto err_after_open; } @@ -119,7 +119,7 @@ static void exec_accept_incoming_migration(void *opaque) goto err; } qemu_announce_self(); - dprintf("successfully loaded vm state\n"); + DPRINTF("successfully loaded vm state\n"); /* we've successfully migrated, close the fd */ qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL); if (autostart) @@ -133,10 +133,10 @@ int exec_start_incoming_migration(const char *command) { QEMUFile *f; - dprintf("Attempting to start an incoming migration\n"); + DPRINTF("Attempting to start an incoming migration\n"); f = qemu_popen_cmd(command, "r"); if(f == NULL) { - dprintf("Unable to apply qemu wrapper to popen file\n"); + DPRINTF("Unable to apply qemu wrapper to popen file\n"); return -errno; } diff --git a/migration-fd.c b/migration-fd.c index ef7edbc5ec..0cc74ad8b2 100644 --- a/migration-fd.c +++ b/migration-fd.c @@ -24,10 +24,10 @@ //#define DEBUG_MIGRATION_FD #ifdef DEBUG_MIGRATION_FD -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { printf("migration-fd: " fmt, ## __VA_ARGS__); } while (0) #else -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { } while (0) #endif @@ -43,7 +43,7 @@ static int fd_write(FdMigrationState *s, const void * buf, size_t size) static int fd_close(FdMigrationState *s) { - dprintf("fd_close\n"); + DPRINTF("fd_close\n"); if (s->fd != -1) { close(s->fd); s->fd = -1; @@ -64,12 +64,12 @@ MigrationState *fd_start_outgoing_migration(Monitor *mon, s->fd = monitor_get_fd(mon, fdname); if (s->fd == -1) { - dprintf("fd_migration: invalid file descriptor identifier\n"); + DPRINTF("fd_migration: invalid file descriptor identifier\n"); goto err_after_alloc; } if (fcntl(s->fd, F_SETFL, O_NONBLOCK) == -1) { - dprintf("Unable to set nonblocking mode on file descriptor\n"); + DPRINTF("Unable to set nonblocking mode on file descriptor\n"); goto err_after_open; } @@ -112,7 +112,7 @@ static void fd_accept_incoming_migration(void *opaque) goto err; } qemu_announce_self(); - dprintf("successfully loaded vm state\n"); + DPRINTF("successfully loaded vm state\n"); /* we've successfully migrated, close the fd */ qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL); if (autostart) @@ -127,12 +127,12 @@ int fd_start_incoming_migration(const char *infd) int fd; QEMUFile *f; - dprintf("Attempting to start an incoming migration via fd\n"); + DPRINTF("Attempting to start an incoming migration via fd\n"); fd = strtol(infd, NULL, 0); f = qemu_fdopen(fd, "rb"); if(f == NULL) { - dprintf("Unable to apply qemu wrapper to file descriptor\n"); + DPRINTF("Unable to apply qemu wrapper to file descriptor\n"); return -errno; } diff --git a/migration-tcp.c b/migration-tcp.c index 2cfa8cba59..e7f307ce90 100644 --- a/migration-tcp.c +++ b/migration-tcp.c @@ -22,10 +22,10 @@ //#define DEBUG_MIGRATION_TCP #ifdef DEBUG_MIGRATION_TCP -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { printf("migration-tcp: " fmt, ## __VA_ARGS__); } while (0) #else -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { } while (0) #endif @@ -41,7 +41,7 @@ static int socket_write(FdMigrationState *s, const void * buf, size_t size) static int tcp_close(FdMigrationState *s) { - dprintf("tcp_close\n"); + DPRINTF("tcp_close\n"); if (s->fd != -1) { close(s->fd); s->fd = -1; @@ -56,7 +56,7 @@ static void tcp_wait_for_connect(void *opaque) int val, ret; socklen_t valsize = sizeof(val); - dprintf("connect completed\n"); + DPRINTF("connect completed\n"); do { ret = getsockopt(s->fd, SOL_SOCKET, SO_ERROR, (void *) &val, &valsize); } while (ret == -1 && (s->get_error(s)) == EINTR); @@ -71,7 +71,7 @@ static void tcp_wait_for_connect(void *opaque) if (val == 0) migrate_fd_connect(s); else { - dprintf("error connecting %d\n", val); + DPRINTF("error connecting %d\n", val); migrate_fd_error(s); } } @@ -127,7 +127,7 @@ MigrationState *tcp_start_outgoing_migration(Monitor *mon, } while (ret == -EINTR); if (ret < 0 && ret != -EINPROGRESS && ret != -EWOULDBLOCK) { - dprintf("connect failed\n"); + DPRINTF("connect failed\n"); close(s->fd); qemu_free(s); return NULL; @@ -149,7 +149,7 @@ static void tcp_accept_incoming_migration(void *opaque) c = qemu_accept(s, (struct sockaddr *)&addr, &addrlen); } while (c == -1 && socket_error() == EINTR); - dprintf("accepted migration\n"); + DPRINTF("accepted migration\n"); if (c == -1) { fprintf(stderr, "could not accept migration connection\n"); @@ -168,7 +168,7 @@ static void tcp_accept_incoming_migration(void *opaque) goto out_fopen; } qemu_announce_self(); - dprintf("successfully loaded vm state\n"); + DPRINTF("successfully loaded vm state\n"); /* we've successfully migrated, close the server socket */ qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL); diff --git a/migration-unix.c b/migration-unix.c index a141dbbbe2..b7aab3843a 100644 --- a/migration-unix.c +++ b/migration-unix.c @@ -22,10 +22,10 @@ //#define DEBUG_MIGRATION_UNIX #ifdef DEBUG_MIGRATION_UNIX -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { printf("migration-unix: " fmt, ## __VA_ARGS__); } while (0) #else -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { } while (0) #endif @@ -41,7 +41,7 @@ static int unix_write(FdMigrationState *s, const void * buf, size_t size) static int unix_close(FdMigrationState *s) { - dprintf("unix_close\n"); + DPRINTF("unix_close\n"); if (s->fd != -1) { close(s->fd); s->fd = -1; @@ -55,7 +55,7 @@ static void unix_wait_for_connect(void *opaque) int val, ret; socklen_t valsize = sizeof(val); - dprintf("connect completed\n"); + DPRINTF("connect completed\n"); do { ret = getsockopt(s->fd, SOL_SOCKET, SO_ERROR, (void *) &val, &valsize); } while (ret == -1 && (s->get_error(s)) == EINTR); @@ -70,7 +70,7 @@ static void unix_wait_for_connect(void *opaque) if (val == 0) migrate_fd_connect(s); else { - dprintf("error connecting %d\n", val); + DPRINTF("error connecting %d\n", val); migrate_fd_error(s); } } @@ -106,7 +106,7 @@ MigrationState *unix_start_outgoing_migration(Monitor *mon, s->bandwidth_limit = bandwidth_limit; s->fd = qemu_socket(PF_UNIX, SOCK_STREAM, 0); if (s->fd < 0) { - dprintf("Unable to open socket"); + DPRINTF("Unable to open socket"); goto err_after_alloc; } @@ -122,7 +122,7 @@ MigrationState *unix_start_outgoing_migration(Monitor *mon, } while (ret == -EINTR); if (ret < 0 && ret != -EINPROGRESS && ret != -EWOULDBLOCK) { - dprintf("connect failed\n"); + DPRINTF("connect failed\n"); goto err_after_open; } @@ -155,7 +155,7 @@ static void unix_accept_incoming_migration(void *opaque) c = qemu_accept(s, (struct sockaddr *)&addr, &addrlen); } while (c == -1 && socket_error() == EINTR); - dprintf("accepted migration\n"); + DPRINTF("accepted migration\n"); if (c == -1) { fprintf(stderr, "could not accept migration connection\n"); @@ -174,7 +174,7 @@ static void unix_accept_incoming_migration(void *opaque) goto out_fopen; } qemu_announce_self(); - dprintf("successfully loaded vm state\n"); + DPRINTF("successfully loaded vm state\n"); /* we've successfully migrated, close the server socket */ qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL); @@ -191,7 +191,7 @@ int unix_start_incoming_migration(const char *path) struct sockaddr_un un; int sock; - dprintf("Attempting to start an incoming migration\n"); + DPRINTF("Attempting to start an incoming migration\n"); sock = qemu_socket(PF_UNIX, SOCK_STREAM, 0); if (sock < 0) { diff --git a/migration.c b/migration.c index 5b28e42f58..f20315fcfd 100644 --- a/migration.c +++ b/migration.c @@ -24,10 +24,10 @@ //#define DEBUG_MIGRATION #ifdef DEBUG_MIGRATION -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { printf("migration: " fmt, ## __VA_ARGS__); } while (0) #else -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { } while (0) #endif @@ -268,7 +268,7 @@ void migrate_fd_monitor_suspend(FdMigrationState *s, Monitor *mon) { s->mon = mon; if (monitor_suspend(mon) == 0) { - dprintf("suspending monitor\n"); + DPRINTF("suspending monitor\n"); } else { monitor_printf(mon, "terminal does not allow synchronous " "migration, continuing detached\n"); @@ -277,7 +277,7 @@ void migrate_fd_monitor_suspend(FdMigrationState *s, Monitor *mon) void migrate_fd_error(FdMigrationState *s) { - dprintf("setting error state\n"); + DPRINTF("setting error state\n"); s->state = MIG_STATE_ERROR; migrate_fd_cleanup(s); } @@ -287,7 +287,7 @@ void migrate_fd_cleanup(FdMigrationState *s) qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL); if (s->file) { - dprintf("closing file\n"); + DPRINTF("closing file\n"); qemu_fclose(s->file); s->file = NULL; } @@ -340,11 +340,11 @@ void migrate_fd_connect(FdMigrationState *s) migrate_fd_wait_for_unfreeze, migrate_fd_close); - dprintf("beginning savevm\n"); + DPRINTF("beginning savevm\n"); ret = qemu_savevm_state_begin(s->mon, s->file, s->mig_state.blk, s->mig_state.shared); if (ret < 0) { - dprintf("failed, %d\n", ret); + DPRINTF("failed, %d\n", ret); migrate_fd_error(s); return; } @@ -357,16 +357,16 @@ void migrate_fd_put_ready(void *opaque) FdMigrationState *s = opaque; if (s->state != MIG_STATE_ACTIVE) { - dprintf("put_ready returning because of non-active state\n"); + DPRINTF("put_ready returning because of non-active state\n"); return; } - dprintf("iterate\n"); + DPRINTF("iterate\n"); if (qemu_savevm_state_iterate(s->mon, s->file) == 1) { int state; int old_vm_running = vm_running; - dprintf("done iterating\n"); + DPRINTF("done iterating\n"); vm_stop(0); qemu_aio_flush(); @@ -397,7 +397,7 @@ void migrate_fd_cancel(MigrationState *mig_state) if (s->state != MIG_STATE_ACTIVE) return; - dprintf("cancelling migration\n"); + DPRINTF("cancelling migration\n"); s->state = MIG_STATE_CANCELLED; qemu_savevm_state_cancel(s->mon, s->file); @@ -409,7 +409,7 @@ void migrate_fd_release(MigrationState *mig_state) { FdMigrationState *s = migrate_to_fms(mig_state); - dprintf("releasing state\n"); + DPRINTF("releasing state\n"); if (s->state == MIG_STATE_ACTIVE) { s->state = MIG_STATE_CANCELLED; @@ -423,7 +423,7 @@ void migrate_fd_wait_for_unfreeze(void *opaque) FdMigrationState *s = opaque; int ret; - dprintf("wait for unfreeze\n"); + DPRINTF("wait for unfreeze\n"); if (s->state != MIG_STATE_ACTIVE) return; diff --git a/slirp/bootp.c b/slirp/bootp.c index 911ec712c5..261762a260 100644 --- a/slirp/bootp.c +++ b/slirp/bootp.c @@ -30,10 +30,10 @@ static const uint8_t rfc1533_cookie[] = { RFC1533_COOKIE }; #ifdef DEBUG -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do if (slirp_debug & DBG_CALL) { fprintf(dfd, fmt, ## __VA_ARGS__); fflush(dfd); } while (0) #else -#define dprintf(fmt, ...) +#define DPRINTF(fmt, ...) #endif static BOOTPClient *get_new_addr(Slirp *slirp, struct in_addr *paddr, @@ -116,7 +116,7 @@ static void dhcp_decode(const struct bootp_t *bp, int *pmsg_type, if (p >= p_end) break; len = *p++; - dprintf("dhcp: tag=%d len=%d\n", tag, len); + DPRINTF("dhcp: tag=%d len=%d\n", tag, len); switch(tag) { case RFC2132_MSG_TYPE: @@ -150,11 +150,11 @@ static void bootp_reply(Slirp *slirp, const struct bootp_t *bp) /* extract exact DHCP msg type */ dhcp_decode(bp, &dhcp_msg_type, &preq_addr); - dprintf("bootp packet op=%d msgtype=%d", bp->bp_op, dhcp_msg_type); + DPRINTF("bootp packet op=%d msgtype=%d", bp->bp_op, dhcp_msg_type); if (preq_addr) - dprintf(" req_addr=%08x\n", ntohl(preq_addr->s_addr)); + DPRINTF(" req_addr=%08x\n", ntohl(preq_addr->s_addr)); else - dprintf("\n"); + DPRINTF("\n"); if (dhcp_msg_type == 0) dhcp_msg_type = DHCPREQUEST; /* Force reply for old BOOTP clients */ @@ -185,7 +185,7 @@ static void bootp_reply(Slirp *slirp, const struct bootp_t *bp) new_addr: bc = get_new_addr(slirp, &daddr.sin_addr, slirp->client_ethaddr); if (!bc) { - dprintf("no address left\n"); + DPRINTF("no address left\n"); return; } } @@ -226,7 +226,7 @@ static void bootp_reply(Slirp *slirp, const struct bootp_t *bp) q += 4; if (bc) { - dprintf("%s addr=%08x\n", + DPRINTF("%s addr=%08x\n", (dhcp_msg_type == DHCPDISCOVER) ? "offered" : "ack'ed", ntohl(daddr.sin_addr.s_addr)); @@ -282,7 +282,7 @@ static void bootp_reply(Slirp *slirp, const struct bootp_t *bp) } else { static const char nak_msg[] = "requested address not available"; - dprintf("nak'ed addr=%08x\n", ntohl(preq_addr->s_addr)); + DPRINTF("nak'ed addr=%08x\n", ntohl(preq_addr->s_addr)); *q++ = RFC2132_MSG_TYPE; *q++ = 1; diff --git a/usb-linux.c b/usb-linux.c index 122cdbf962..a9c15c6d1d 100644 --- a/usb-linux.c +++ b/usb-linux.c @@ -68,9 +68,9 @@ typedef int USBScanFunc(void *opaque, int bus_num, int addr, int class_id, //#define DEBUG #ifdef DEBUG -#define dprintf printf +#define DPRINTF printf #else -#define dprintf(...) +#define DPRINTF(...) #endif #define USBDBG_DEVOPENED "husb: opened %s/devices\n" @@ -234,13 +234,13 @@ static void async_complete(void *opaque) return; } - dprintf("husb: async. reap urb failed errno %d\n", errno); + DPRINTF("husb: async. reap urb failed errno %d\n", errno); return; } p = aurb->packet; - dprintf("husb: async completed. aurb %p status %d alen %d\n", + DPRINTF("husb: async completed. aurb %p status %d alen %d\n", aurb, aurb->urb.status, aurb->urb.actual_length); if (p) { @@ -273,14 +273,14 @@ static void async_cancel(USBPacket *unused, void *opaque) AsyncURB *aurb = opaque; USBHostDevice *s = aurb->hdev; - dprintf("husb: async cancel. aurb %p\n", aurb); + DPRINTF("husb: async cancel. aurb %p\n", aurb); /* Mark it as dead (see async_complete above) */ aurb->packet = NULL; int r = ioctl(s->fd, USBDEVFS_DISCARDURB, aurb); if (r < 0) { - dprintf("husb: async. discard urb failed errno %d\n", errno); + DPRINTF("husb: async. discard urb failed errno %d\n", errno); } } @@ -293,7 +293,7 @@ static int usb_host_claim_interfaces(USBHostDevice *dev, int configuration) if (configuration == 0) /* address state - ignore */ return 1; - dprintf("husb: claiming interfaces. config %d\n", configuration); + DPRINTF("husb: claiming interfaces. config %d\n", configuration); i = 0; dev_descr_len = dev->descr[0]; @@ -303,7 +303,7 @@ static int usb_host_claim_interfaces(USBHostDevice *dev, int configuration) i += dev_descr_len; while (i < dev->descr_len) { - dprintf("husb: i is %d, descr_len is %d, dl %d, dt %d\n", i, dev->descr_len, + DPRINTF("husb: i is %d, descr_len is %d, dl %d, dt %d\n", i, dev->descr_len, dev->descr[i], dev->descr[i+1]); if (dev->descr[i+1] != USB_DT_CONFIG) { @@ -370,7 +370,7 @@ static int usb_host_release_interfaces(USBHostDevice *s) { int ret, i; - dprintf("husb: releasing interfaces\n"); + DPRINTF("husb: releasing interfaces\n"); for (i = 0; i < s->ninterfaces; i++) { ret = ioctl(s->fd, USBDEVFS_RELEASEINTERFACE, &i); @@ -387,7 +387,7 @@ static void usb_host_handle_reset(USBDevice *dev) { USBHostDevice *s = DO_UPCAST(USBHostDevice, dev, dev); - dprintf("husb: reset device %u.%u\n", s->bus_num, s->addr); + DPRINTF("husb: reset device %u.%u\n", s->bus_num, s->addr); ioctl(s->fd, USBDEVFS_RESET); @@ -424,7 +424,7 @@ static int usb_host_handle_data(USBHostDevice *s, USBPacket *p) if (is_halted(s, p->devep)) { ret = ioctl(s->fd, USBDEVFS_CLEAR_HALT, &urb->endpoint); if (ret < 0) { - dprintf("husb: failed to clear halt. ep 0x%x errno %d\n", + DPRINTF("husb: failed to clear halt. ep 0x%x errno %d\n", urb->endpoint, errno); return USB_RET_NAK; } @@ -449,10 +449,10 @@ static int usb_host_handle_data(USBHostDevice *s, USBPacket *p) ret = ioctl(s->fd, USBDEVFS_SUBMITURB, urb); - dprintf("husb: data submit. ep 0x%x len %u aurb %p\n", urb->endpoint, p->len, aurb); + DPRINTF("husb: data submit. ep 0x%x len %u aurb %p\n", urb->endpoint, p->len, aurb); if (ret < 0) { - dprintf("husb: submit failed. errno %d\n", errno); + DPRINTF("husb: submit failed. errno %d\n", errno); async_free(aurb); switch(errno) { @@ -478,7 +478,7 @@ static int ctrl_error(void) static int usb_host_set_address(USBHostDevice *s, int addr) { - dprintf("husb: ctrl set addr %u\n", addr); + DPRINTF("husb: ctrl set addr %u\n", addr); s->dev.addr = addr; return 0; } @@ -489,7 +489,7 @@ static int usb_host_set_config(USBHostDevice *s, int config) int ret = ioctl(s->fd, USBDEVFS_SETCONFIGURATION, &config); - dprintf("husb: ctrl set config %d ret %d errno %d\n", config, ret, errno); + DPRINTF("husb: ctrl set config %d ret %d errno %d\n", config, ret, errno); if (ret < 0) return ctrl_error(); @@ -507,7 +507,7 @@ static int usb_host_set_interface(USBHostDevice *s, int iface, int alt) si.altsetting = alt; ret = ioctl(s->fd, USBDEVFS_SETINTERFACE, &si); - dprintf("husb: ctrl set iface %d altset %d ret %d errno %d\n", + DPRINTF("husb: ctrl set iface %d altset %d ret %d errno %d\n", iface, alt, ret, errno); if (ret < 0) @@ -531,7 +531,7 @@ static int usb_host_handle_control(USBHostDevice *s, USBPacket *p) value = le16_to_cpu(s->ctrl.req.wValue); index = le16_to_cpu(s->ctrl.req.wIndex); - dprintf("husb: ctrl type 0x%x req 0x%x val 0x%x index %u len %u\n", + DPRINTF("husb: ctrl type 0x%x req 0x%x val 0x%x index %u len %u\n", s->ctrl.req.bRequestType, s->ctrl.req.bRequest, value, index, s->ctrl.len); @@ -580,10 +580,10 @@ static int usb_host_handle_control(USBHostDevice *s, USBPacket *p) ret = ioctl(s->fd, USBDEVFS_SUBMITURB, urb); - dprintf("husb: submit ctrl. len %u aurb %p\n", urb->buffer_length, aurb); + DPRINTF("husb: submit ctrl. len %u aurb %p\n", urb->buffer_length, aurb); if (ret < 0) { - dprintf("husb: submit failed. errno %d\n", errno); + DPRINTF("husb: submit failed. errno %d\n", errno); async_free(aurb); switch(errno) { @@ -786,7 +786,7 @@ static int usb_linux_update_endp_table(USBHostDevice *s) if (descriptors[i + 1] != USB_DT_CONFIG || descriptors[i + 5] != configuration) { - dprintf("invalid descriptor data - configuration\n"); + DPRINTF("invalid descriptor data - configuration\n"); return 1; } i += descriptors[i]; @@ -847,7 +847,7 @@ static int usb_linux_update_endp_table(USBHostDevice *s) type = USBDEVFS_URB_TYPE_INTERRUPT; break; default: - dprintf("usb_host: malformed endpoint type\n"); + DPRINTF("usb_host: malformed endpoint type\n"); type = USBDEVFS_URB_TYPE_BULK; } s->endp_table[(devep & 0xf) - 1].type = type; @@ -882,7 +882,7 @@ static int usb_host_open(USBHostDevice *dev, int bus_num, perror(buf); goto fail; } - dprintf("husb: opened %s\n", buf); + DPRINTF("husb: opened %s\n", buf); dev->bus_num = bus_num; dev->addr = addr; @@ -1313,7 +1313,7 @@ static int usb_host_scan(void *opaque, USBScanFunc *func) strcpy(devpath, USBDEVBUS_PATH); usb_fs_type = USB_FS_SYS; closedir(dir); - dprintf(USBDBG_DEVOPENED, USBSYSBUS_PATH); + DPRINTF(USBDBG_DEVOPENED, USBSYSBUS_PATH); goto found_devices; } f = fopen(USBPROCBUS_PATH "/devices", "r"); @@ -1322,7 +1322,7 @@ static int usb_host_scan(void *opaque, USBScanFunc *func) strcpy(devpath, USBPROCBUS_PATH); usb_fs_type = USB_FS_PROC; fclose(f); - dprintf(USBDBG_DEVOPENED, USBPROCBUS_PATH); + DPRINTF(USBDBG_DEVOPENED, USBPROCBUS_PATH); goto found_devices; } /* try additional methods if an access method hasn't been found yet */ @@ -1332,7 +1332,7 @@ static int usb_host_scan(void *opaque, USBScanFunc *func) strcpy(devpath, USBDEVBUS_PATH); usb_fs_type = USB_FS_DEV; fclose(f); - dprintf(USBDBG_DEVOPENED, USBDEVBUS_PATH); + DPRINTF(USBDBG_DEVOPENED, USBDEVBUS_PATH); goto found_devices; } found_devices: @@ -1399,7 +1399,7 @@ static int usb_host_auto_scan(void *opaque, int bus_num, int addr, if (s->fd != -1) return 0; - dprintf("husb: auto open: bus_num %d addr %d\n", bus_num, addr); + DPRINTF("husb: auto open: bus_num %d addr %d\n", bus_num, addr); usb_host_open(s, bus_num, addr, product_name); }