From 24328dfac8e350bf4ebadbd130bb5ead85b6a9ac Mon Sep 17 00:00:00 2001 From: Anthony Liguori Date: Sat, 6 Aug 2011 10:07:26 -0500 Subject: [PATCH] Some more renaming --- gdbstub.c | 6 +++--- hw/ccid-card-passthru.c | 2 +- hw/mips_malta.c | 4 ++-- hw/omap2.c | 2 +- hw/omap_uart.c | 8 ++++---- hw/usb-serial.c | 6 +++--- hw/xen_console.c | 2 +- qemu-char.c | 12 ++++++------ qemu-char.h | 18 ++++++++++-------- usb-redir.c | 2 +- vl.c | 10 +++++----- 11 files changed, 37 insertions(+), 35 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index b0ab39b5d7..eff54a8ecf 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -2499,7 +2499,7 @@ void gdb_exit(CPUState *env, int code) #ifndef CONFIG_USER_ONLY if (s->chr) { - qemu_chr_close(s->chr); + qemu_chr_fe_delete(s->chr); } #endif } @@ -2763,7 +2763,7 @@ int gdbserver_start(const char *device) sigaction(SIGINT, &act, NULL); } #endif - chr = qemu_chr_open("gdb", device, NULL); + chr = qemu_chr_new("gdb", device, NULL); if (!chr) return -1; @@ -2785,7 +2785,7 @@ int gdbserver_start(const char *device) monitor_init(mon_chr, 0); } else { if (s->chr) - qemu_chr_close(s->chr); + qemu_chr_fe_delete(s->chr); mon_chr = s->mon_chr; memset(s, 0, sizeof(GDBState)); } diff --git a/hw/ccid-card-passthru.c b/hw/ccid-card-passthru.c index 4608400c51..60b4e2b77d 100644 --- a/hw/ccid-card-passthru.c +++ b/hw/ccid-card-passthru.c @@ -198,7 +198,7 @@ static void ccid_card_vscard_handle_message(PassthruState *card, static void ccid_card_vscard_drop_connection(PassthruState *card) { - qemu_chr_close(card->cs); + qemu_chr_fe_delete(card->cs); card->vscard_in_pos = card->vscard_in_hdr = 0; ccid_card_vscard_update_handlers(card); } diff --git a/hw/mips_malta.c b/hw/mips_malta.c index ed2a483c9b..933b4743db 100644 --- a/hw/mips_malta.c +++ b/hw/mips_malta.c @@ -443,7 +443,7 @@ static MaltaFPGAState *malta_fpga_init(target_phys_addr_t base, qemu_irq uart_ir /* 0xa00 is less than a page, so will still get the right offsets. */ cpu_register_physical_memory(base + 0xa00, 0x100000 - 0xa00, malta); - s->display = qemu_chr_open("fpga", "vc:320x200", malta_fpga_led_init); + s->display = qemu_chr_new("fpga", "vc:320x200", malta_fpga_led_init); #ifdef TARGET_WORDS_BIGENDIAN s->uart = serial_mm_init(base + 0x900, 3, uart_irq, 230400, uart_chr, 1, 1); @@ -784,7 +784,7 @@ void mips_malta_init (ram_addr_t ram_size, if (!serial_hds[i]) { char label[32]; snprintf(label, sizeof(label), "serial%d", i); - serial_hds[i] = qemu_chr_open(label, "null", NULL); + serial_hds[i] = qemu_chr_new(label, "null", NULL); } } diff --git a/hw/omap2.c b/hw/omap2.c index 919318f478..cb860dc701 100644 --- a/hw/omap2.c +++ b/hw/omap2.c @@ -782,7 +782,7 @@ static struct omap_sti_s *omap_sti_init(struct omap_target_agent_s *ta, s->irq = irq; omap_sti_reset(s); - s->chr = chr ?: qemu_chr_open("null", "null", NULL); + s->chr = chr ?: qemu_chr_new("null", "null", NULL); iomemtype = l4_register_io_memory(omap_sti_readfn, omap_sti_writefn, s); diff --git a/hw/omap_uart.c b/hw/omap_uart.c index 9cee81d7c9..bdf62121f3 100644 --- a/hw/omap_uart.c +++ b/hw/omap_uart.c @@ -62,11 +62,11 @@ struct omap_uart_s *omap_uart_init(target_phys_addr_t base, s->irq = irq; #ifdef TARGET_WORDS_BIGENDIAN s->serial = serial_mm_init(base, 2, irq, omap_clk_getrate(fclk)/16, - chr ?: qemu_chr_open(label, "null", NULL), 1, + chr ?: qemu_chr_new(label, "null", NULL), 1, 1); #else s->serial = serial_mm_init(base, 2, irq, omap_clk_getrate(fclk)/16, - chr ?: qemu_chr_open(label, "null", NULL), 1, + chr ?: qemu_chr_new(label, "null", NULL), 1, 0); #endif return s; @@ -185,12 +185,12 @@ void omap_uart_attach(struct omap_uart_s *s, CharDriverState *chr) #ifdef TARGET_WORDS_BIGENDIAN s->serial = serial_mm_init(s->base, 2, s->irq, omap_clk_getrate(s->fclk) / 16, - chr ?: qemu_chr_open("null", "null", NULL), 1, + chr ?: qemu_chr_new("null", "null", NULL), 1, 1); #else s->serial = serial_mm_init(s->base, 2, s->irq, omap_clk_getrate(s->fclk) / 16, - chr ?: qemu_chr_open("null", "null", NULL), 1, + chr ?: qemu_chr_new("null", "null", NULL), 1, 0); #endif } diff --git a/hw/usb-serial.c b/hw/usb-serial.c index b81bfb584b..a74d813231 100644 --- a/hw/usb-serial.c +++ b/hw/usb-serial.c @@ -433,7 +433,7 @@ static void usb_serial_handle_destroy(USBDevice *dev) { USBSerialState *s = (USBSerialState *)dev; - qemu_chr_close(s->cs); + qemu_chr_fe_delete(s->cs); } static int usb_serial_can_read(void *opaque) @@ -569,7 +569,7 @@ static USBDevice *usb_serial_init(const char *filename) filename++; snprintf(label, sizeof(label), "usbserial%d", index++); - cdrv = qemu_chr_open(label, filename, NULL); + cdrv = qemu_chr_new(label, filename, NULL); if (!cdrv) return NULL; @@ -592,7 +592,7 @@ static USBDevice *usb_braille_init(const char *unused) USBDevice *dev; CharDriverState *cdrv; - cdrv = qemu_chr_open("braille", "braille", NULL); + cdrv = qemu_chr_new("braille", "braille", NULL); if (!cdrv) return NULL; diff --git a/hw/xen_console.c b/hw/xen_console.c index d042b67476..2e24714048 100644 --- a/hw/xen_console.c +++ b/hw/xen_console.c @@ -212,7 +212,7 @@ static int con_init(struct XenDevice *xendev) con->chr = serial_hds[con->xendev.dev]; } else { snprintf(label, sizeof(label), "xencons%d", con->xendev.dev); - con->chr = qemu_chr_open(label, output, NULL); + con->chr = qemu_chr_new(label, output, NULL); } xenstore_store_pv_console_info(con->xendev.dev, con->chr); diff --git a/qemu-char.c b/qemu-char.c index 6a5c5f1c32..6da548cbea 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -327,7 +327,7 @@ int qemu_chr_fe_ioctl(CharDriverState *s, int cmd, void *arg) return s->chr_ioctl(s->opaque, cmd, arg); } -void qemu_chr_printf(CharDriverState *s, const char *fmt, ...) +void qemu_chr_fe_printf(CharDriverState *s, const char *fmt, ...) { char buf[READ_BUF_LEN]; va_list ap; @@ -2225,7 +2225,7 @@ QString *qemu_chr_mem_to_qs(CharDriverState *chr) return qstring_from_substr((char *) d->outbuf, 0, d->outbuf_size - 1); } -/* NOTE: this driver can not be closed with qemu_chr_close()! */ +/* NOTE: this driver can not be closed with qemu_chr_fe_delete()! */ void qemu_chr_close_mem(CharDriverState *chr) { MemoryDriver *d = chr->opaque; @@ -2398,7 +2398,7 @@ static const struct { #endif }; -CharDriverState *qemu_chr_open_opts(QemuOpts *opts, +CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts, void (*init)(struct CharDriverState *s)) { CharDriverState *chr; @@ -2442,7 +2442,7 @@ CharDriverState *qemu_chr_open_opts(QemuOpts *opts, return chr; } -CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*init)(struct CharDriverState *s)) +CharDriverState *qemu_chr_new(const char *label, const char *filename, void (*init)(struct CharDriverState *s)) { const char *p; CharDriverState *chr; @@ -2456,7 +2456,7 @@ CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*i if (!opts) return NULL; - chr = qemu_chr_open_opts(opts, init); + chr = qemu_chr_new_from_opts(opts, init); qemu_opts_del(opts); return chr; } @@ -2479,7 +2479,7 @@ void qemu_chr_fe_close(struct CharDriverState *chr) chr->fe_opened--; } -void qemu_chr_close(CharDriverState *chr) +void qemu_chr_fe_delete(CharDriverState *chr) { QTAILQ_REMOVE(&chardevs, chr, next); if (chr->chr_close) diff --git a/qemu-char.h b/qemu-char.h index 73e74ee7ba..d36ff9cfed 100644 --- a/qemu-char.h +++ b/qemu-char.h @@ -90,14 +90,14 @@ struct CharDriverState { }; QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename); -CharDriverState *qemu_chr_open_opts(QemuOpts *opts, +CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts, void (*init)(struct CharDriverState *s)); -CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*init)(struct CharDriverState *s)); +CharDriverState *qemu_chr_new(const char *label, const char *filename, void (*init)(struct CharDriverState *s)); void qemu_chr_fe_open(struct CharDriverState *chr); void qemu_chr_fe_close(struct CharDriverState *chr); -void qemu_chr_close(CharDriverState *chr); -void qemu_chr_printf(CharDriverState *s, const char *fmt, ...) +void qemu_chr_fe_delete(CharDriverState *chr); +void qemu_chr_fe_printf(CharDriverState *s, const char *fmt, ...) GCC_FMT_ATTR(2, 3); int qemu_chr_fe_write(CharDriverState *s, const uint8_t *buf, int len); int qemu_chr_fe_read(CharDriverState *s, uint8_t *buf, int len); @@ -109,11 +109,17 @@ void qemu_chr_fe_set_handlers(CharDriverState *s, void *opaque); int qemu_chr_fe_ioctl(CharDriverState *s, int cmd, void *arg); + void qemu_chr_generic_open(CharDriverState *s); + int qemu_chr_be_can_write(CharDriverState *s); int qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len); int qemu_chr_be_read(CharDriverState *s, uint8_t *buf, int len); +void qemu_chr_info_print(Monitor *mon, const QObject *ret_data); +void qemu_chr_info(Monitor *mon, QObject **ret_data); +CharDriverState *qemu_chr_find(const char *name); + static inline int qemu_chr_fe_get_msgfd(CharDriverState *s) { int fd = -1; @@ -132,10 +138,6 @@ static inline void qemu_chr_fe_set_echo(CharDriverState *chr, bool echo) qemu_chr_fe_ioctl(chr, CHR_SET_ECHO, &echo); } -void qemu_chr_info_print(Monitor *mon, const QObject *ret_data); -void qemu_chr_info(Monitor *mon, QObject **ret_data); -CharDriverState *qemu_chr_find(const char *name); - /* add an eventfd to the qemu devices that are polled */ CharDriverState *qemu_chr_open_eventfd(int eventfd); diff --git a/usb-redir.c b/usb-redir.c index f599afde1f..9802200e44 100644 --- a/usb-redir.c +++ b/usb-redir.c @@ -842,7 +842,7 @@ static void usbredir_handle_destroy(USBDevice *udev) { USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev); - qemu_chr_close(dev->cs); + qemu_chr_fe_delete(dev->cs); /* Note must be done after qemu_chr_close, as that causes a close event */ qemu_bh_delete(dev->open_close_bh); diff --git a/vl.c b/vl.c index c7141274f7..c389c275ed 100644 --- a/vl.c +++ b/vl.c @@ -1689,7 +1689,7 @@ static int chardev_init_func(QemuOpts *opts, void *opaque) { CharDriverState *chr; - chr = qemu_chr_open_opts(opts, NULL); + chr = qemu_chr_new_from_opts(opts, NULL); if (!chr) return -1; return 0; @@ -1828,7 +1828,7 @@ static int serial_parse(const char *devname) exit(1); } snprintf(label, sizeof(label), "serial%d", index); - serial_hds[index] = qemu_chr_open(label, devname, NULL); + serial_hds[index] = qemu_chr_new(label, devname, NULL); if (!serial_hds[index]) { fprintf(stderr, "qemu: could not open serial device '%s': %s\n", devname, strerror(errno)); @@ -1850,7 +1850,7 @@ static int parallel_parse(const char *devname) exit(1); } snprintf(label, sizeof(label), "parallel%d", index); - parallel_hds[index] = qemu_chr_open(label, devname, NULL); + parallel_hds[index] = qemu_chr_new(label, devname, NULL); if (!parallel_hds[index]) { fprintf(stderr, "qemu: could not open parallel device '%s': %s\n", devname, strerror(errno)); @@ -1881,7 +1881,7 @@ static int virtcon_parse(const char *devname) qemu_opt_set(dev_opts, "driver", "virtconsole"); snprintf(label, sizeof(label), "virtcon%d", index); - virtcon_hds[index] = qemu_chr_open(label, devname, NULL); + virtcon_hds[index] = qemu_chr_new(label, devname, NULL); if (!virtcon_hds[index]) { fprintf(stderr, "qemu: could not open virtio console '%s': %s\n", devname, strerror(errno)); @@ -1897,7 +1897,7 @@ static int debugcon_parse(const char *devname) { QemuOpts *opts; - if (!qemu_chr_open("debugcon", devname, NULL)) { + if (!qemu_chr_new("debugcon", devname, NULL)) { exit(1); } opts = qemu_opts_create(qemu_find_opts("device"), "debugcon", 1); -- 2.11.4.GIT