All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 00/14] char: flow control part I
@ 2011-08-15 16:17 Anthony Liguori
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 01/14] char: rename qemu_chr_write() -> qemu_chr_fe_write() Anthony Liguori
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: Anthony Liguori @ 2011-08-15 16:17 UTC (permalink / raw)
  To: qemu-devel

This is a dump of some of the easier stuff to merge from my character backend
flow control branch.  It's mostly just renaming functions and adding
documentation.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH 01/14] char: rename qemu_chr_write() -> qemu_chr_fe_write()
  2011-08-15 16:17 [Qemu-devel] [PATCH 00/14] char: flow control part I Anthony Liguori
@ 2011-08-15 16:17 ` Anthony Liguori
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 02/14] char: rename qemu_chr_printf() -> qemu_chr_fe_printf() Anthony Liguori
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Anthony Liguori @ 2011-08-15 16:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 gdbstub.c               |    2 +-
 hw/ccid-card-passthru.c |    4 ++--
 hw/debugcon.c           |    2 +-
 hw/escc.c               |    2 +-
 hw/etraxfs_ser.c        |    2 +-
 hw/grlib_apbuart.c      |    2 +-
 hw/lm32_juart.c         |    2 +-
 hw/lm32_uart.c          |    2 +-
 hw/mcf_uart.c           |    2 +-
 hw/milkymist-uart.c     |    2 +-
 hw/omap2.c              |    6 +++---
 hw/parallel.c           |    2 +-
 hw/pl011.c              |    2 +-
 hw/pxa2xx.c             |    2 +-
 hw/serial.c             |    2 +-
 hw/sh_serial.c          |    2 +-
 hw/spapr_vty.c          |    4 ++--
 hw/strongarm.c          |    2 +-
 hw/syborg_serial.c      |    4 ++--
 hw/usb-serial.c         |    2 +-
 hw/virtio-console.c     |    2 +-
 hw/xen_console.c        |    2 +-
 hw/xilinx_uartlite.c    |    2 +-
 monitor.c               |    2 +-
 qemu-char.c             |    4 ++--
 qemu-char.h             |    2 +-
 slirp/slirp.c           |    2 +-
 usb-redir.c             |    2 +-
 28 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/gdbstub.c b/gdbstub.c
index 27b0cfa..d6c362e 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -382,7 +382,7 @@ static void put_buffer(GDBState *s, const uint8_t *buf, int len)
         }
     }
 #else
-    qemu_chr_write(s->chr, buf, len);
+    qemu_chr_fe_write(s->chr, buf, len);
 #endif
 }
 
diff --git a/hw/ccid-card-passthru.c b/hw/ccid-card-passthru.c
index 28eb9d1..082fd82 100644
--- a/hw/ccid-card-passthru.c
+++ b/hw/ccid-card-passthru.c
@@ -72,8 +72,8 @@ static void ccid_card_vscard_send_msg(PassthruState *s,
     scr_msg_header.type = htonl(type);
     scr_msg_header.reader_id = htonl(reader_id);
     scr_msg_header.length = htonl(length);
-    qemu_chr_write(s->cs, (uint8_t *)&scr_msg_header, sizeof(VSCMsgHeader));
-    qemu_chr_write(s->cs, payload, length);
+    qemu_chr_fe_write(s->cs, (uint8_t *)&scr_msg_header, sizeof(VSCMsgHeader));
+    qemu_chr_fe_write(s->cs, payload, length);
 }
 
 static void ccid_card_vscard_send_apdu(PassthruState *s,
diff --git a/hw/debugcon.c b/hw/debugcon.c
index 5ee6821..c9ee6d9 100644
--- a/hw/debugcon.c
+++ b/hw/debugcon.c
@@ -51,7 +51,7 @@ static void debugcon_ioport_write(void *opaque, uint32_t addr, uint32_t val)
     printf("debugcon: write addr=0x%04x val=0x%02x\n", addr, val);
 #endif
 
-    qemu_chr_write(s->chr, &ch, 1);
+    qemu_chr_fe_write(s->chr, &ch, 1);
 }
 
 
diff --git a/hw/escc.c b/hw/escc.c
index bea5873..f281caa 100644
--- a/hw/escc.c
+++ b/hw/escc.c
@@ -579,7 +579,7 @@ static void escc_mem_write(void *opaque, target_phys_addr_t addr,
         s->tx = val;
         if (s->wregs[W_TXCTRL2] & TXCTRL2_TXEN) { // tx enabled
             if (s->chr)
-                qemu_chr_write(s->chr, &s->tx, 1);
+                qemu_chr_fe_write(s->chr, &s->tx, 1);
             else if (s->type == kbd && !s->disabled) {
                 handle_kbd_command(s, val);
             }
diff --git a/hw/etraxfs_ser.c b/hw/etraxfs_ser.c
index 28b86ea..0036037 100644
--- a/hw/etraxfs_ser.c
+++ b/hw/etraxfs_ser.c
@@ -119,7 +119,7 @@ ser_writel (void *opaque, target_phys_addr_t addr, uint32_t value)
     switch (addr)
     {
         case RW_DOUT:
-            qemu_chr_write(s->chr, &ch, 1);
+            qemu_chr_fe_write(s->chr, &ch, 1);
             s->regs[R_INTR] |= 3;
             s->pending_tx = 1;
             s->regs[addr] = value;
diff --git a/hw/grlib_apbuart.c b/hw/grlib_apbuart.c
index 169a56e..c90b810 100644
--- a/hw/grlib_apbuart.c
+++ b/hw/grlib_apbuart.c
@@ -114,7 +114,7 @@ grlib_apbuart_writel(void *opaque, target_phys_addr_t addr, uint32_t value)
     switch (addr) {
     case DATA_OFFSET:
         c = value & 0xFF;
-        qemu_chr_write(uart->chr, &c, 1);
+        qemu_chr_fe_write(uart->chr, &c, 1);
         return;
 
     case STATUS_OFFSET:
diff --git a/hw/lm32_juart.c b/hw/lm32_juart.c
index fddcf7e..5454aa4 100644
--- a/hw/lm32_juart.c
+++ b/hw/lm32_juart.c
@@ -72,7 +72,7 @@ void lm32_juart_set_jtx(DeviceState *d, uint32_t jtx)
 
     s->jtx = jtx;
     if (s->chr) {
-        qemu_chr_write(s->chr, &ch, 1);
+        qemu_chr_fe_write(s->chr, &ch, 1);
     }
 }
 
diff --git a/hw/lm32_uart.c b/hw/lm32_uart.c
index 09090e9..3678545 100644
--- a/hw/lm32_uart.c
+++ b/hw/lm32_uart.c
@@ -169,7 +169,7 @@ static void uart_write(void *opaque, target_phys_addr_t addr, uint32_t value)
     switch (addr) {
     case R_RXTX:
         if (s->chr) {
-            qemu_chr_write(s->chr, &ch, 1);
+            qemu_chr_fe_write(s->chr, &ch, 1);
         }
         break;
     case R_IER:
diff --git a/hw/mcf_uart.c b/hw/mcf_uart.c
index 905e116..747bc36 100644
--- a/hw/mcf_uart.c
+++ b/hw/mcf_uart.c
@@ -110,7 +110,7 @@ static void mcf_uart_do_tx(mcf_uart_state *s)
 {
     if (s->tx_enabled && (s->sr & MCF_UART_TxEMP) == 0) {
         if (s->chr)
-            qemu_chr_write(s->chr, (unsigned char *)&s->tb, 1);
+            qemu_chr_fe_write(s->chr, (unsigned char *)&s->tb, 1);
         s->sr |= MCF_UART_TxEMP;
     }
     if (s->tx_enabled) {
diff --git a/hw/milkymist-uart.c b/hw/milkymist-uart.c
index 56c90da..e8e309d 100644
--- a/hw/milkymist-uart.c
+++ b/hw/milkymist-uart.c
@@ -77,7 +77,7 @@ static void uart_write(void *opaque, target_phys_addr_t addr, uint32_t value)
     switch (addr) {
     case R_RXTX:
         if (s->chr) {
-            qemu_chr_write(s->chr, &ch, 1);
+            qemu_chr_fe_write(s->chr, &ch, 1);
         }
         trace_milkymist_uart_pulse_irq_tx();
         qemu_irq_pulse(s->tx_irq);
diff --git a/hw/omap2.c b/hw/omap2.c
index c9b3540..919318f 100644
--- a/hw/omap2.c
+++ b/hw/omap2.c
@@ -748,14 +748,14 @@ static void omap_sti_fifo_write(void *opaque, target_phys_addr_t addr,
 
     if (ch == STI_TRACE_CONTROL_CHANNEL) {
         /* Flush channel <i>value</i>.  */
-        qemu_chr_write(s->chr, (const uint8_t *) "\r", 1);
+        qemu_chr_fe_write(s->chr, (const uint8_t *) "\r", 1);
     } else if (ch == STI_TRACE_CONSOLE_CHANNEL || 1) {
         if (value == 0xc0 || value == 0xc3) {
             /* Open channel <i>ch</i>.  */
         } else if (value == 0x00)
-            qemu_chr_write(s->chr, (const uint8_t *) "\n", 1);
+            qemu_chr_fe_write(s->chr, (const uint8_t *) "\n", 1);
         else
-            qemu_chr_write(s->chr, &byte, 1);
+            qemu_chr_fe_write(s->chr, &byte, 1);
     }
 }
 
diff --git a/hw/parallel.c b/hw/parallel.c
index cc853a5..f3e8219 100644
--- a/hw/parallel.c
+++ b/hw/parallel.c
@@ -120,7 +120,7 @@ parallel_ioport_write_sw(void *opaque, uint32_t addr, uint32_t val)
             if (val & PARA_CTR_STROBE) {
                 s->status &= ~PARA_STS_BUSY;
                 if ((s->control & PARA_CTR_STROBE) == 0)
-                    qemu_chr_write(s->chr, &s->dataw, 1);
+                    qemu_chr_fe_write(s->chr, &s->dataw, 1);
             } else {
                 if (s->control & PARA_CTR_INTEN) {
                     s->irq_pending = 1;
diff --git a/hw/pl011.c b/hw/pl011.c
index 997ce84..707a161 100644
--- a/hw/pl011.c
+++ b/hw/pl011.c
@@ -133,7 +133,7 @@ static void pl011_write(void *opaque, target_phys_addr_t offset,
         /* ??? Check if transmitter is enabled.  */
         ch = value;
         if (s->chr)
-            qemu_chr_write(s->chr, &ch, 1);
+            qemu_chr_fe_write(s->chr, &ch, 1);
         s->int_level |= PL011_INT_TX;
         pl011_update(s);
         break;
diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c
index cf93110..7516454 100644
--- a/hw/pxa2xx.c
+++ b/hw/pxa2xx.c
@@ -1923,7 +1923,7 @@ static void pxa2xx_fir_write(void *opaque, target_phys_addr_t addr,
         else
             ch = ~value;
         if (s->chr && s->enable && (s->control[0] & (1 << 3)))	/* TXE */
-            qemu_chr_write(s->chr, &ch, 1);
+            qemu_chr_fe_write(s->chr, &ch, 1);
         break;
     case ICSR0:
         s->status[0] &= ~(value & 0x66);
diff --git a/hw/serial.c b/hw/serial.c
index 0ee61dd..dc6d1f8 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -334,7 +334,7 @@ static void serial_xmit(void *opaque)
     if (s->mcr & UART_MCR_LOOP) {
         /* in loopback mode, say that we just received a char */
         serial_receive1(s, &s->tsr, 1);
-    } else if (qemu_chr_write(s->chr, &s->tsr, 1) != 1) {
+    } else if (qemu_chr_fe_write(s->chr, &s->tsr, 1) != 1) {
         if ((s->tsr_retry > 0) && (s->tsr_retry <= MAX_XMIT_RETRY)) {
             s->tsr_retry++;
             qemu_mod_timer(s->transmit_timer,  new_xmit_ts + s->char_transmit_time);
diff --git a/hw/sh_serial.c b/hw/sh_serial.c
index 191f4a6..eabd726 100644
--- a/hw/sh_serial.c
+++ b/hw/sh_serial.c
@@ -105,7 +105,7 @@ static void sh_serial_write(void *opaque, uint32_t offs, uint32_t val)
     case 0x0c: /* FTDR / TDR */
         if (s->chr) {
             ch = val;
-            qemu_chr_write(s->chr, &ch, 1);
+            qemu_chr_fe_write(s->chr, &ch, 1);
 	}
 	s->dr = val;
 	s->flags &= ~SH_SERIAL_FLAG_TDE;
diff --git a/hw/spapr_vty.c b/hw/spapr_vty.c
index 6fc0105..f5046d9 100644
--- a/hw/spapr_vty.c
+++ b/hw/spapr_vty.c
@@ -50,8 +50,8 @@ void vty_putchars(VIOsPAPRDevice *sdev, uint8_t *buf, int len)
 {
     VIOsPAPRVTYDevice *dev = (VIOsPAPRVTYDevice *)sdev;
 
-    /* FIXME: should check the qemu_chr_write() return value */
-    qemu_chr_write(dev->chardev, buf, len);
+    /* FIXME: should check the qemu_chr_fe_write() return value */
+    qemu_chr_fe_write(dev->chardev, buf, len);
 }
 
 static int spapr_vty_init(VIOsPAPRDevice *sdev)
diff --git a/hw/strongarm.c b/hw/strongarm.c
index 0e03d61..50fe0c0 100644
--- a/hw/strongarm.c
+++ b/hw/strongarm.c
@@ -1067,7 +1067,7 @@ static void strongarm_uart_tx(void *opaque)
     if (s->utcr3 & UTCR3_LBM) /* loopback */ {
         strongarm_uart_receive(s, &s->tx_fifo[s->tx_start], 1);
     } else if (s->chr) {
-        qemu_chr_write(s->chr, &s->tx_fifo[s->tx_start], 1);
+        qemu_chr_fe_write(s->chr, &s->tx_fifo[s->tx_start], 1);
     }
 
     s->tx_start = (s->tx_start + 1) % 8;
diff --git a/hw/syborg_serial.c b/hw/syborg_serial.c
index 2ef7175..25c6c9d 100644
--- a/hw/syborg_serial.c
+++ b/hw/syborg_serial.c
@@ -119,7 +119,7 @@ static void do_dma_tx(SyborgSerialState *s, uint32_t count)
         /* optimize later. Now, 1 byte per iteration */
         while (count--) {
             cpu_physical_memory_read(s->dma_tx_ptr, &ch, 1);
-            qemu_chr_write(s->chr, &ch, 1);
+            qemu_chr_fe_write(s->chr, &ch, 1);
             s->dma_tx_ptr++;
         }
     } else {
@@ -203,7 +203,7 @@ static void syborg_serial_write(void *opaque, target_phys_addr_t offset,
     case SERIAL_DATA:
         ch = value;
         if (s->chr)
-            qemu_chr_write(s->chr, &ch, 1);
+            qemu_chr_fe_write(s->chr, &ch, 1);
         break;
     case SERIAL_INT_ENABLE:
         s->int_enable = value;
diff --git a/hw/usb-serial.c b/hw/usb-serial.c
index bf2b775..8ed0fa6 100644
--- a/hw/usb-serial.c
+++ b/hw/usb-serial.c
@@ -371,7 +371,7 @@ static int usb_serial_handle_data(USBDevice *dev, USBPacket *p)
             goto fail;
         for (i = 0; i < p->iov.niov; i++) {
             iov = p->iov.iov + i;
-            qemu_chr_write(s->cs, iov->iov_base, iov->iov_len);
+            qemu_chr_fe_write(s->cs, iov->iov_base, iov->iov_len);
         }
         break;
 
diff --git a/hw/virtio-console.c b/hw/virtio-console.c
index fe5e188..6c386fa 100644
--- a/hw/virtio-console.c
+++ b/hw/virtio-console.c
@@ -27,7 +27,7 @@ static ssize_t flush_buf(VirtIOSerialPort *port, const uint8_t *buf, size_t len)
     VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
     ssize_t ret;
 
-    ret = qemu_chr_write(vcon->chr, buf, len);
+    ret = qemu_chr_fe_write(vcon->chr, buf, len);
     trace_virtio_console_flush_buf(port->id, len, ret);
 
     if (ret < 0) {
diff --git a/hw/xen_console.c b/hw/xen_console.c
index 8ef104c..e218bb8 100644
--- a/hw/xen_console.c
+++ b/hw/xen_console.c
@@ -156,7 +156,7 @@ static void xencons_send(struct XenConsole *con)
 
     size = con->buffer.size - con->buffer.consumed;
     if (con->chr)
-        len = qemu_chr_write(con->chr, con->buffer.data + con->buffer.consumed,
+        len = qemu_chr_fe_write(con->chr, con->buffer.data + con->buffer.consumed,
                              size);
     else
         len = size;
diff --git a/hw/xilinx_uartlite.c b/hw/xilinx_uartlite.c
index 9b94e98..467a26c 100644
--- a/hw/xilinx_uartlite.c
+++ b/hw/xilinx_uartlite.c
@@ -129,7 +129,7 @@ uart_writel (void *opaque, target_phys_addr_t addr, uint32_t value)
 
         case R_TX:
             if (s->chr)
-                qemu_chr_write(s->chr, &ch, 1);
+                qemu_chr_fe_write(s->chr, &ch, 1);
 
             s->regs[addr] = value;
 
diff --git a/monitor.c b/monitor.c
index 1b8ba2c..38d4544 100644
--- a/monitor.c
+++ b/monitor.c
@@ -247,7 +247,7 @@ static int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func,
 void monitor_flush(Monitor *mon)
 {
     if (mon && mon->outbuf_index != 0 && !mon->mux_out) {
-        qemu_chr_write(mon->chr, mon->outbuf, mon->outbuf_index);
+        qemu_chr_fe_write(mon->chr, mon->outbuf, mon->outbuf_index);
         mon->outbuf_index = 0;
     }
 }
diff --git a/qemu-char.c b/qemu-char.c
index 8e8cf31..fe5b28e 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -139,7 +139,7 @@ void qemu_chr_generic_open(CharDriverState *s)
     }
 }
 
-int qemu_chr_write(CharDriverState *s, const uint8_t *buf, int len)
+int qemu_chr_fe_write(CharDriverState *s, const uint8_t *buf, int len)
 {
     return s->chr_write(s, buf, len);
 }
@@ -185,7 +185,7 @@ void qemu_chr_printf(CharDriverState *s, const char *fmt, ...)
     va_list ap;
     va_start(ap, fmt);
     vsnprintf(buf, sizeof(buf), fmt, ap);
-    qemu_chr_write(s, (uint8_t *)buf, strlen(buf));
+    qemu_chr_fe_write(s, (uint8_t *)buf, strlen(buf));
     va_end(ap);
 }
 
diff --git a/qemu-char.h b/qemu-char.h
index f361c6d..a4865fc 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -87,7 +87,7 @@ void qemu_chr_guest_close(struct CharDriverState *chr);
 void qemu_chr_close(CharDriverState *chr);
 void qemu_chr_printf(CharDriverState *s, const char *fmt, ...)
     GCC_FMT_ATTR(2, 3);
-int qemu_chr_write(CharDriverState *s, const uint8_t *buf, int len);
+int qemu_chr_fe_write(CharDriverState *s, const uint8_t *buf, int len);
 void qemu_chr_send_event(CharDriverState *s, int event);
 void qemu_chr_add_handlers(CharDriverState *s,
                            IOCanReadHandler *fd_can_read,
diff --git a/slirp/slirp.c b/slirp/slirp.c
index 2c242ef..80aaca7 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -818,7 +818,7 @@ int slirp_add_exec(Slirp *slirp, int do_pty, const void *args,
 ssize_t slirp_send(struct socket *so, const void *buf, size_t len, int flags)
 {
 	if (so->s == -1 && so->extra) {
-		qemu_chr_write(so->extra, buf, len);
+		qemu_chr_fe_write(so->extra, buf, len);
 		return len;
 	}
 
diff --git a/usb-redir.c b/usb-redir.c
index 9e5fce2..9916dea 100644
--- a/usb-redir.c
+++ b/usb-redir.c
@@ -225,7 +225,7 @@ static int usbredir_write(void *priv, uint8_t *data, int count)
 {
     USBRedirDevice *dev = priv;
 
-    return qemu_chr_write(dev->cs, data, count);
+    return qemu_chr_fe_write(dev->cs, data, count);
 }
 
 /*
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH 02/14] char: rename qemu_chr_printf() -> qemu_chr_fe_printf()
  2011-08-15 16:17 [Qemu-devel] [PATCH 00/14] char: flow control part I Anthony Liguori
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 01/14] char: rename qemu_chr_write() -> qemu_chr_fe_write() Anthony Liguori
@ 2011-08-15 16:17 ` Anthony Liguori
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 03/14] char: rename qemu_chr_read() -> qemu_chr_be_write() Anthony Liguori
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Anthony Liguori @ 2011-08-15 16:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 hw/mips_malta.c |   22 +++++++++++-----------
 qemu-char.c     |    2 +-
 qemu-char.h     |    2 +-
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/hw/mips_malta.c b/hw/mips_malta.c
index ed2a483..9021752 100644
--- a/hw/mips_malta.c
+++ b/hw/mips_malta.c
@@ -92,8 +92,8 @@ static void malta_fpga_update_display(void *opaque)
     }
     leds_text[8] = '\0';
 
-    qemu_chr_printf(s->display, "\e[H\n\n|\e[32m%-8.8s\e[00m|\r\n", leds_text);
-    qemu_chr_printf(s->display, "\n\n\n\n|\e[31m%-8.8s\e[00m|", s->display_text);
+    qemu_chr_fe_printf(s->display, "\e[H\n\n|\e[32m%-8.8s\e[00m|\r\n", leds_text);
+    qemu_chr_fe_printf(s->display, "\n\n\n\n|\e[31m%-8.8s\e[00m|", s->display_text);
 }
 
 /*
@@ -417,15 +417,15 @@ static void malta_fpga_reset(void *opaque)
 
 static void malta_fpga_led_init(CharDriverState *chr)
 {
-    qemu_chr_printf(chr, "\e[HMalta LEDBAR\r\n");
-    qemu_chr_printf(chr, "+--------+\r\n");
-    qemu_chr_printf(chr, "+        +\r\n");
-    qemu_chr_printf(chr, "+--------+\r\n");
-    qemu_chr_printf(chr, "\n");
-    qemu_chr_printf(chr, "Malta ASCII\r\n");
-    qemu_chr_printf(chr, "+--------+\r\n");
-    qemu_chr_printf(chr, "+        +\r\n");
-    qemu_chr_printf(chr, "+--------+\r\n");
+    qemu_chr_fe_printf(chr, "\e[HMalta LEDBAR\r\n");
+    qemu_chr_fe_printf(chr, "+--------+\r\n");
+    qemu_chr_fe_printf(chr, "+        +\r\n");
+    qemu_chr_fe_printf(chr, "+--------+\r\n");
+    qemu_chr_fe_printf(chr, "\n");
+    qemu_chr_fe_printf(chr, "Malta ASCII\r\n");
+    qemu_chr_fe_printf(chr, "+--------+\r\n");
+    qemu_chr_fe_printf(chr, "+        +\r\n");
+    qemu_chr_fe_printf(chr, "+--------+\r\n");
 }
 
 static MaltaFPGAState *malta_fpga_init(target_phys_addr_t base, qemu_irq uart_irq, CharDriverState *uart_chr)
diff --git a/qemu-char.c b/qemu-char.c
index fe5b28e..0e092fa 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -179,7 +179,7 @@ void qemu_chr_accept_input(CharDriverState *s)
         s->chr_accept_input(s);
 }
 
-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;
diff --git a/qemu-char.h b/qemu-char.h
index a4865fc..72c457b 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -85,7 +85,7 @@ void qemu_chr_set_echo(struct CharDriverState *chr, bool echo);
 void qemu_chr_guest_open(struct CharDriverState *chr);
 void qemu_chr_guest_close(struct CharDriverState *chr);
 void qemu_chr_close(CharDriverState *chr);
-void qemu_chr_printf(CharDriverState *s, const char *fmt, ...)
+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);
 void qemu_chr_send_event(CharDriverState *s, int event);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH 03/14] char: rename qemu_chr_read() -> qemu_chr_be_write()
  2011-08-15 16:17 [Qemu-devel] [PATCH 00/14] char: flow control part I Anthony Liguori
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 01/14] char: rename qemu_chr_write() -> qemu_chr_fe_write() Anthony Liguori
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 02/14] char: rename qemu_chr_printf() -> qemu_chr_fe_printf() Anthony Liguori
@ 2011-08-15 16:17 ` Anthony Liguori
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 04/14] char: rename qemu_chr_can_read() -> qemu_chr_be_can_read() Anthony Liguori
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Anthony Liguori @ 2011-08-15 16:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 console.c         |    2 +-
 gdbstub.c         |    2 +-
 hw/baum.c         |    8 ++++----
 hw/msmouse.c      |    2 +-
 qemu-char.c       |   18 +++++++++---------
 qemu-char.h       |    2 +-
 spice-qemu-char.c |    2 +-
 7 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/console.c b/console.c
index 242086c..b831b6b 100644
--- a/console.c
+++ b/console.c
@@ -1130,7 +1130,7 @@ static void kbd_send_chars(void *opaque)
         if (len > sizeof(buf))
             len = sizeof(buf);
         qemu_fifo_read(&s->out_fifo, buf, len);
-        qemu_chr_read(s->chr, buf, len);
+        qemu_chr_be_write(s->chr, buf, len);
     }
     /* characters are pending: we send them a bit later (XXX:
        horrible, should change char device API) */
diff --git a/gdbstub.c b/gdbstub.c
index d6c362e..058c626 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -2194,7 +2194,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
             hextomem(mem_buf, p + 5, len);
             len = len / 2;
             mem_buf[len++] = 0;
-            qemu_chr_read(s->mon_chr, mem_buf, len);
+            qemu_chr_be_write(s->mon_chr, mem_buf, len);
             put_packet(s, "OK");
             break;
         }
diff --git a/hw/baum.c b/hw/baum.c
index 33a22a7..efd9edb 100644
--- a/hw/baum.c
+++ b/hw/baum.c
@@ -231,12 +231,12 @@ static void baum_accept_input(struct CharDriverState *chr)
 
     first = BUF_SIZE - baum->out_buf_ptr;
     if (room > first) {
-        qemu_chr_read(chr, baum->out_buf + baum->out_buf_ptr, first);
+        qemu_chr_be_write(chr, baum->out_buf + baum->out_buf_ptr, first);
         baum->out_buf_ptr = 0;
         baum->out_buf_used -= first;
         room -= first;
     }
-    qemu_chr_read(chr, baum->out_buf + baum->out_buf_ptr, room);
+    qemu_chr_be_write(chr, baum->out_buf + baum->out_buf_ptr, room);
     baum->out_buf_ptr += room;
     baum->out_buf_used -= room;
 }
@@ -254,12 +254,12 @@ static void baum_write_packet(BaumDriverState *baum, const uint8_t *buf, int len
     len = cur - io_buf;
     if (len <= room) {
         /* Fits */
-        qemu_chr_read(baum->chr, io_buf, len);
+        qemu_chr_be_write(baum->chr, io_buf, len);
     } else {
         int first;
         uint8_t out;
         /* Can't fit all, send what can be, and store the rest. */
-        qemu_chr_read(baum->chr, io_buf, room);
+        qemu_chr_be_write(baum->chr, io_buf, room);
         len -= room;
         cur = io_buf + room;
         if (len > BUF_SIZE - baum->out_buf_used) {
diff --git a/hw/msmouse.c b/hw/msmouse.c
index 67c6cd4..fbed80b 100644
--- a/hw/msmouse.c
+++ b/hw/msmouse.c
@@ -50,7 +50,7 @@ static void msmouse_event(void *opaque,
     /* We always send the packet of, so that we do not have to keep track
        of previous state of the middle button. This can potentially confuse
        some very old drivers for two button mice though. */
-    qemu_chr_read(chr, bytes, 4);
+    qemu_chr_be_write(chr, bytes, 4);
 }
 
 static int msmouse_chr_write (struct CharDriverState *s, const uint8_t *buf, int len)
diff --git a/qemu-char.c b/qemu-char.c
index 0e092fa..ad5a458 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -158,7 +158,7 @@ int qemu_chr_can_read(CharDriverState *s)
     return s->chr_can_read(s->handler_opaque);
 }
 
-void qemu_chr_read(CharDriverState *s, uint8_t *buf, int len)
+void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len)
 {
     s->chr_read(s->handler_opaque, buf, len);
 }
@@ -589,7 +589,7 @@ static void fd_chr_read(void *opaque)
         return;
     }
     if (size > 0) {
-        qemu_chr_read(chr, buf, size);
+        qemu_chr_be_write(chr, buf, size);
     }
 }
 
@@ -700,7 +700,7 @@ static int stdio_read_poll(void *opaque)
 
     /* try to flush the queue if needed */
     if (term_fifo_size != 0 && qemu_chr_can_read(chr) > 0) {
-        qemu_chr_read(chr, term_fifo, 1);
+        qemu_chr_be_write(chr, term_fifo, 1);
         term_fifo_size = 0;
     }
     /* see if we can absorb more chars */
@@ -725,7 +725,7 @@ static void stdio_read(void *opaque)
     }
     if (size > 0) {
         if (qemu_chr_can_read(chr) > 0) {
-            qemu_chr_read(chr, buf, 1);
+            qemu_chr_be_write(chr, buf, 1);
         } else if (term_fifo_size == 0) {
             term_fifo[term_fifo_size++] = buf[0];
         }
@@ -914,7 +914,7 @@ static void pty_chr_read(void *opaque)
     }
     if (size > 0) {
         pty_chr_state(chr, 1);
-        qemu_chr_read(chr, buf, size);
+        qemu_chr_be_write(chr, buf, size);
     }
 }
 
@@ -1624,7 +1624,7 @@ static void win_chr_readfile(CharDriverState *chr)
     }
 
     if (size > 0) {
-        qemu_chr_read(chr, buf, size);
+        qemu_chr_be_write(chr, buf, size);
     }
 }
 
@@ -1846,7 +1846,7 @@ static int udp_chr_read_poll(void *opaque)
      * first
      */
     while (s->max_size > 0 && s->bufptr < s->bufcnt) {
-        qemu_chr_read(chr, &s->buf[s->bufptr], 1);
+        qemu_chr_be_write(chr, &s->buf[s->bufptr], 1);
         s->bufptr++;
         s->max_size = qemu_chr_can_read(chr);
     }
@@ -1867,7 +1867,7 @@ static void udp_chr_read(void *opaque)
 
     s->bufptr = 0;
     while (s->max_size > 0 && s->bufptr < s->bufcnt) {
-        qemu_chr_read(chr, &s->buf[s->bufptr], 1);
+        qemu_chr_be_write(chr, &s->buf[s->bufptr], 1);
         s->bufptr++;
         s->max_size = qemu_chr_can_read(chr);
     }
@@ -2109,7 +2109,7 @@ static void tcp_chr_read(void *opaque)
         if (s->do_telnetopt)
             tcp_chr_process_IAC_bytes(chr, s, buf, &size);
         if (size > 0)
-            qemu_chr_read(chr, buf, size);
+            qemu_chr_be_write(chr, buf, size);
     }
 }
 
diff --git a/qemu-char.h b/qemu-char.h
index 72c457b..b16e566 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -97,7 +97,7 @@ void qemu_chr_add_handlers(CharDriverState *s,
 int qemu_chr_ioctl(CharDriverState *s, int cmd, void *arg);
 void qemu_chr_generic_open(CharDriverState *s);
 int qemu_chr_can_read(CharDriverState *s);
-void qemu_chr_read(CharDriverState *s, uint8_t *buf, int len);
+void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len);
 int qemu_chr_get_msgfd(CharDriverState *s);
 void qemu_chr_accept_input(CharDriverState *s);
 int qemu_chr_add_client(CharDriverState *s, int fd);
diff --git a/spice-qemu-char.c b/spice-qemu-char.c
index 95bf6b6..25f1508 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -39,7 +39,7 @@ static int vmc_write(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len)
         if (qemu_chr_can_read(scd->chr) < last_out) {
             break;
         }
-        qemu_chr_read(scd->chr, p, last_out);
+        qemu_chr_be_write(scd->chr, p, last_out);
         out += last_out;
         len -= last_out;
         p += last_out;
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH 04/14] char: rename qemu_chr_can_read() -> qemu_chr_be_can_read()
  2011-08-15 16:17 [Qemu-devel] [PATCH 00/14] char: flow control part I Anthony Liguori
                   ` (2 preceding siblings ...)
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 03/14] char: rename qemu_chr_read() -> qemu_chr_be_write() Anthony Liguori
@ 2011-08-15 16:17 ` Anthony Liguori
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 05/14] char: rename qemu_chr_guest_open() -> qemu_chr_fe_open() Anthony Liguori
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Anthony Liguori @ 2011-08-15 16:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 console.c         |    2 +-
 hw/baum.c         |    4 ++--
 qemu-char.c       |   20 ++++++++++----------
 qemu-char.h       |    2 +-
 spice-qemu-char.c |    2 +-
 5 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/console.c b/console.c
index b831b6b..489c74c 100644
--- a/console.c
+++ b/console.c
@@ -1123,7 +1123,7 @@ static void kbd_send_chars(void *opaque)
     int len;
     uint8_t buf[16];
 
-    len = qemu_chr_can_read(s->chr);
+    len = qemu_chr_be_can_write(s->chr);
     if (len > s->out_fifo.count)
         len = s->out_fifo.count;
     if (len > 0) {
diff --git a/hw/baum.c b/hw/baum.c
index efd9edb..244eee5 100644
--- a/hw/baum.c
+++ b/hw/baum.c
@@ -223,7 +223,7 @@ static void baum_accept_input(struct CharDriverState *chr)
 
     if (!baum->out_buf_used)
         return;
-    room = qemu_chr_can_read(chr);
+    room = qemu_chr_be_can_write(chr);
     if (!room)
         return;
     if (room > baum->out_buf_used)
@@ -250,7 +250,7 @@ static void baum_write_packet(BaumDriverState *baum, const uint8_t *buf, int len
     while (len--)
         if ((*cur++ = *buf++) == ESC)
             *cur++ = ESC;
-    room = qemu_chr_can_read(baum->chr);
+    room = qemu_chr_be_can_write(baum->chr);
     len = cur - io_buf;
     if (len <= room) {
         /* Fits */
diff --git a/qemu-char.c b/qemu-char.c
index ad5a458..8758b2a 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -151,7 +151,7 @@ int qemu_chr_ioctl(CharDriverState *s, int cmd, void *arg)
     return s->chr_ioctl(s, cmd, arg);
 }
 
-int qemu_chr_can_read(CharDriverState *s)
+int qemu_chr_be_can_write(CharDriverState *s)
 {
     if (!s->chr_can_read)
         return 0;
@@ -565,7 +565,7 @@ static int fd_chr_read_poll(void *opaque)
     CharDriverState *chr = opaque;
     FDCharDriver *s = chr->opaque;
 
-    s->max_size = qemu_chr_can_read(chr);
+    s->max_size = qemu_chr_be_can_write(chr);
     return s->max_size;
 }
 
@@ -699,7 +699,7 @@ static int stdio_read_poll(void *opaque)
     CharDriverState *chr = opaque;
 
     /* try to flush the queue if needed */
-    if (term_fifo_size != 0 && qemu_chr_can_read(chr) > 0) {
+    if (term_fifo_size != 0 && qemu_chr_be_can_write(chr) > 0) {
         qemu_chr_be_write(chr, term_fifo, 1);
         term_fifo_size = 0;
     }
@@ -724,7 +724,7 @@ static void stdio_read(void *opaque)
         return;
     }
     if (size > 0) {
-        if (qemu_chr_can_read(chr) > 0) {
+        if (qemu_chr_be_can_write(chr) > 0) {
             qemu_chr_be_write(chr, buf, 1);
         } else if (term_fifo_size == 0) {
             term_fifo[term_fifo_size++] = buf[0];
@@ -890,7 +890,7 @@ static int pty_chr_read_poll(void *opaque)
     CharDriverState *chr = opaque;
     PtyCharDriver *s = chr->opaque;
 
-    s->read_bytes = qemu_chr_can_read(chr);
+    s->read_bytes = qemu_chr_be_can_write(chr);
     return s->read_bytes;
 }
 
@@ -1602,7 +1602,7 @@ static int win_chr_read_poll(CharDriverState *chr)
 {
     WinCharState *s = chr->opaque;
 
-    s->max_size = qemu_chr_can_read(chr);
+    s->max_size = qemu_chr_be_can_write(chr);
     return s->max_size;
 }
 
@@ -1840,7 +1840,7 @@ static int udp_chr_read_poll(void *opaque)
     CharDriverState *chr = opaque;
     NetCharDriver *s = chr->opaque;
 
-    s->max_size = qemu_chr_can_read(chr);
+    s->max_size = qemu_chr_be_can_write(chr);
 
     /* If there were any stray characters in the queue process them
      * first
@@ -1848,7 +1848,7 @@ static int udp_chr_read_poll(void *opaque)
     while (s->max_size > 0 && s->bufptr < s->bufcnt) {
         qemu_chr_be_write(chr, &s->buf[s->bufptr], 1);
         s->bufptr++;
-        s->max_size = qemu_chr_can_read(chr);
+        s->max_size = qemu_chr_be_can_write(chr);
     }
     return s->max_size;
 }
@@ -1869,7 +1869,7 @@ static void udp_chr_read(void *opaque)
     while (s->max_size > 0 && s->bufptr < s->bufcnt) {
         qemu_chr_be_write(chr, &s->buf[s->bufptr], 1);
         s->bufptr++;
-        s->max_size = qemu_chr_can_read(chr);
+        s->max_size = qemu_chr_be_can_write(chr);
     }
 }
 
@@ -1963,7 +1963,7 @@ static int tcp_chr_read_poll(void *opaque)
     TCPCharDriver *s = chr->opaque;
     if (!s->connected)
         return 0;
-    s->max_size = qemu_chr_can_read(chr);
+    s->max_size = qemu_chr_be_can_write(chr);
     return s->max_size;
 }
 
diff --git a/qemu-char.h b/qemu-char.h
index b16e566..3500a57 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -96,7 +96,7 @@ void qemu_chr_add_handlers(CharDriverState *s,
                            void *opaque);
 int qemu_chr_ioctl(CharDriverState *s, int cmd, void *arg);
 void qemu_chr_generic_open(CharDriverState *s);
-int qemu_chr_can_read(CharDriverState *s);
+int qemu_chr_be_can_write(CharDriverState *s);
 void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len);
 int qemu_chr_get_msgfd(CharDriverState *s);
 void qemu_chr_accept_input(CharDriverState *s);
diff --git a/spice-qemu-char.c b/spice-qemu-char.c
index 25f1508..3d06ac4 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -36,7 +36,7 @@ static int vmc_write(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len)
 
     while (len > 0) {
         last_out = MIN(len, VMC_MAX_HOST_WRITE);
-        if (qemu_chr_can_read(scd->chr) < last_out) {
+        if (qemu_chr_be_can_write(scd->chr) < last_out) {
             break;
         }
         qemu_chr_be_write(scd->chr, p, last_out);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH 05/14] char: rename qemu_chr_guest_open() -> qemu_chr_fe_open()
  2011-08-15 16:17 [Qemu-devel] [PATCH 00/14] char: flow control part I Anthony Liguori
                   ` (3 preceding siblings ...)
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 04/14] char: rename qemu_chr_can_read() -> qemu_chr_be_can_read() Anthony Liguori
@ 2011-08-15 16:17 ` Anthony Liguori
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 06/14] char: rename qemu_chr_guest_close() -> qemu_chr_fe_close() Anthony Liguori
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Anthony Liguori @ 2011-08-15 16:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 hw/virtio-console.c |    2 +-
 qemu-char.c         |    2 +-
 qemu-char.h         |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/virtio-console.c b/hw/virtio-console.c
index 6c386fa..21f752b 100644
--- a/hw/virtio-console.c
+++ b/hw/virtio-console.c
@@ -52,7 +52,7 @@ static void guest_open(VirtIOSerialPort *port)
 {
     VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
 
-    qemu_chr_guest_open(vcon->chr);
+    qemu_chr_fe_open(vcon->chr);
 }
 
 /* Callback function that's called when the guest closes the port */
diff --git a/qemu-char.c b/qemu-char.c
index 8758b2a..f532223 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2632,7 +2632,7 @@ void qemu_chr_set_echo(struct CharDriverState *chr, bool echo)
     }
 }
 
-void qemu_chr_guest_open(struct CharDriverState *chr)
+void qemu_chr_fe_open(struct CharDriverState *chr)
 {
     if (chr->chr_guest_open) {
         chr->chr_guest_open(chr);
diff --git a/qemu-char.h b/qemu-char.h
index 3500a57..ad770cd 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -82,7 +82,7 @@ CharDriverState *qemu_chr_open_opts(QemuOpts *opts,
                                     void (*init)(struct CharDriverState *s));
 CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*init)(struct CharDriverState *s));
 void qemu_chr_set_echo(struct CharDriverState *chr, bool echo);
-void qemu_chr_guest_open(struct CharDriverState *chr);
+void qemu_chr_fe_open(struct CharDriverState *chr);
 void qemu_chr_guest_close(struct CharDriverState *chr);
 void qemu_chr_close(CharDriverState *chr);
 void qemu_chr_fe_printf(CharDriverState *s, const char *fmt, ...)
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH 06/14] char: rename qemu_chr_guest_close() -> qemu_chr_fe_close()
  2011-08-15 16:17 [Qemu-devel] [PATCH 00/14] char: flow control part I Anthony Liguori
                   ` (4 preceding siblings ...)
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 05/14] char: rename qemu_chr_guest_open() -> qemu_chr_fe_open() Anthony Liguori
@ 2011-08-15 16:17 ` Anthony Liguori
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 07/14] char: qemu_chr_ioctl() -> qemu_chr_fe_ioctl() Anthony Liguori
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Anthony Liguori @ 2011-08-15 16:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 hw/virtio-console.c |    2 +-
 qemu-char.c         |    2 +-
 qemu-char.h         |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/virtio-console.c b/hw/virtio-console.c
index 21f752b..d3351c8 100644
--- a/hw/virtio-console.c
+++ b/hw/virtio-console.c
@@ -60,7 +60,7 @@ static void guest_close(VirtIOSerialPort *port)
 {
     VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
 
-    qemu_chr_guest_close(vcon->chr);
+    qemu_chr_fe_close(vcon->chr);
 }
 
 /* Readiness of the guest to accept data on a port */
diff --git a/qemu-char.c b/qemu-char.c
index f532223..88a0a93 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2639,7 +2639,7 @@ void qemu_chr_fe_open(struct CharDriverState *chr)
     }
 }
 
-void qemu_chr_guest_close(struct CharDriverState *chr)
+void qemu_chr_fe_close(struct CharDriverState *chr)
 {
     if (chr->chr_guest_close) {
         chr->chr_guest_close(chr);
diff --git a/qemu-char.h b/qemu-char.h
index ad770cd..c95b554 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -83,7 +83,7 @@ CharDriverState *qemu_chr_open_opts(QemuOpts *opts,
 CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*init)(struct CharDriverState *s));
 void qemu_chr_set_echo(struct CharDriverState *chr, bool echo);
 void qemu_chr_fe_open(struct CharDriverState *chr);
-void qemu_chr_guest_close(struct CharDriverState *chr);
+void qemu_chr_fe_close(struct CharDriverState *chr);
 void qemu_chr_close(CharDriverState *chr);
 void qemu_chr_fe_printf(CharDriverState *s, const char *fmt, ...)
     GCC_FMT_ATTR(2, 3);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH 07/14] char: qemu_chr_ioctl() -> qemu_chr_fe_ioctl()
  2011-08-15 16:17 [Qemu-devel] [PATCH 00/14] char: flow control part I Anthony Liguori
                   ` (5 preceding siblings ...)
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 06/14] char: rename qemu_chr_guest_close() -> qemu_chr_fe_close() Anthony Liguori
@ 2011-08-15 16:17 ` Anthony Liguori
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 08/14] char: rename qemu_chr_set_echo() -> qemu_chr_fe_set_echo() Anthony Liguori
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Anthony Liguori @ 2011-08-15 16:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 hw/escc.c       |    2 +-
 hw/parallel.c   |   30 +++++++++++++++---------------
 hw/serial.c     |   10 +++++-----
 hw/strongarm.c  |    2 +-
 hw/usb-serial.c |   10 +++++-----
 qemu-char.c     |    2 +-
 qemu-char.h     |    2 +-
 7 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/hw/escc.c b/hw/escc.c
index f281caa..58d2e1b 100644
--- a/hw/escc.c
+++ b/hw/escc.c
@@ -487,7 +487,7 @@ static void escc_update_parameters(ChannelState *s)
     ssp.stop_bits = stop_bits;
     SER_DPRINTF("channel %c: speed=%d parity=%c data=%d stop=%d\n", CHN_C(s),
                 speed, parity, data_bits, stop_bits);
-    qemu_chr_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
+    qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
 }
 
 static void escc_mem_write(void *opaque, target_phys_addr_t addr,
diff --git a/hw/parallel.c b/hw/parallel.c
index f3e8219..a721c35 100644
--- a/hw/parallel.c
+++ b/hw/parallel.c
@@ -150,7 +150,7 @@ static void parallel_ioport_write_hw(void *opaque, uint32_t addr, uint32_t val)
         if (s->dataw == val)
             return;
         pdebug("wd%02x\n", val);
-        qemu_chr_ioctl(s->chr, CHR_IOCTL_PP_WRITE_DATA, &parm);
+        qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_PP_WRITE_DATA, &parm);
         s->dataw = val;
         break;
     case PARA_REG_STS:
@@ -170,11 +170,11 @@ static void parallel_ioport_write_hw(void *opaque, uint32_t addr, uint32_t val)
             } else {
                 dir = 0;
             }
-            qemu_chr_ioctl(s->chr, CHR_IOCTL_PP_DATA_DIR, &dir);
+            qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_PP_DATA_DIR, &dir);
             parm &= ~PARA_CTR_DIR;
         }
 
-        qemu_chr_ioctl(s->chr, CHR_IOCTL_PP_WRITE_CONTROL, &parm);
+        qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_PP_WRITE_CONTROL, &parm);
         s->control = val;
         break;
     case PARA_REG_EPP_ADDR:
@@ -183,7 +183,7 @@ static void parallel_ioport_write_hw(void *opaque, uint32_t addr, uint32_t val)
             pdebug("wa%02x s\n", val);
         else {
             struct ParallelIOArg ioarg = { .buffer = &parm, .count = 1 };
-            if (qemu_chr_ioctl(s->chr, CHR_IOCTL_PP_EPP_WRITE_ADDR, &ioarg)) {
+            if (qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_PP_EPP_WRITE_ADDR, &ioarg)) {
                 s->epp_timeout = 1;
                 pdebug("wa%02x t\n", val);
             }
@@ -197,7 +197,7 @@ static void parallel_ioport_write_hw(void *opaque, uint32_t addr, uint32_t val)
             pdebug("we%02x s\n", val);
         else {
             struct ParallelIOArg ioarg = { .buffer = &parm, .count = 1 };
-            if (qemu_chr_ioctl(s->chr, CHR_IOCTL_PP_EPP_WRITE, &ioarg)) {
+            if (qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_PP_EPP_WRITE, &ioarg)) {
                 s->epp_timeout = 1;
                 pdebug("we%02x t\n", val);
             }
@@ -222,7 +222,7 @@ parallel_ioport_eppdata_write_hw2(void *opaque, uint32_t addr, uint32_t val)
         pdebug("we%04x s\n", val);
         return;
     }
-    err = qemu_chr_ioctl(s->chr, CHR_IOCTL_PP_EPP_WRITE, &ioarg);
+    err = qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_PP_EPP_WRITE, &ioarg);
     if (err) {
         s->epp_timeout = 1;
         pdebug("we%04x t\n", val);
@@ -245,7 +245,7 @@ parallel_ioport_eppdata_write_hw4(void *opaque, uint32_t addr, uint32_t val)
         pdebug("we%08x s\n", val);
         return;
     }
-    err = qemu_chr_ioctl(s->chr, CHR_IOCTL_PP_EPP_WRITE, &ioarg);
+    err = qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_PP_EPP_WRITE, &ioarg);
     if (err) {
         s->epp_timeout = 1;
         pdebug("we%08x t\n", val);
@@ -297,13 +297,13 @@ static uint32_t parallel_ioport_read_hw(void *opaque, uint32_t addr)
     addr &= 7;
     switch(addr) {
     case PARA_REG_DATA:
-        qemu_chr_ioctl(s->chr, CHR_IOCTL_PP_READ_DATA, &ret);
+        qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_PP_READ_DATA, &ret);
         if (s->last_read_offset != addr || s->datar != ret)
             pdebug("rd%02x\n", ret);
         s->datar = ret;
         break;
     case PARA_REG_STS:
-        qemu_chr_ioctl(s->chr, CHR_IOCTL_PP_READ_STATUS, &ret);
+        qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_PP_READ_STATUS, &ret);
         ret &= ~PARA_STS_TMOUT;
         if (s->epp_timeout)
             ret |= PARA_STS_TMOUT;
@@ -315,7 +315,7 @@ static uint32_t parallel_ioport_read_hw(void *opaque, uint32_t addr)
         /* s->control has some bits fixed to 1. It is zero only when
            it has not been yet written to.  */
         if (s->control == 0) {
-            qemu_chr_ioctl(s->chr, CHR_IOCTL_PP_READ_CONTROL, &ret);
+            qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_PP_READ_CONTROL, &ret);
             if (s->last_read_offset != addr)
                 pdebug("rc%02x\n", ret);
             s->control = ret;
@@ -332,7 +332,7 @@ static uint32_t parallel_ioport_read_hw(void *opaque, uint32_t addr)
             pdebug("ra%02x s\n", ret);
         else {
             struct ParallelIOArg ioarg = { .buffer = &ret, .count = 1 };
-            if (qemu_chr_ioctl(s->chr, CHR_IOCTL_PP_EPP_READ_ADDR, &ioarg)) {
+            if (qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_PP_EPP_READ_ADDR, &ioarg)) {
                 s->epp_timeout = 1;
                 pdebug("ra%02x t\n", ret);
             }
@@ -346,7 +346,7 @@ static uint32_t parallel_ioport_read_hw(void *opaque, uint32_t addr)
             pdebug("re%02x s\n", ret);
         else {
             struct ParallelIOArg ioarg = { .buffer = &ret, .count = 1 };
-            if (qemu_chr_ioctl(s->chr, CHR_IOCTL_PP_EPP_READ, &ioarg)) {
+            if (qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_PP_EPP_READ, &ioarg)) {
                 s->epp_timeout = 1;
                 pdebug("re%02x t\n", ret);
             }
@@ -374,7 +374,7 @@ parallel_ioport_eppdata_read_hw2(void *opaque, uint32_t addr)
         pdebug("re%04x s\n", eppdata);
         return eppdata;
     }
-    err = qemu_chr_ioctl(s->chr, CHR_IOCTL_PP_EPP_READ, &ioarg);
+    err = qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_PP_EPP_READ, &ioarg);
     ret = le16_to_cpu(eppdata);
 
     if (err) {
@@ -401,7 +401,7 @@ parallel_ioport_eppdata_read_hw4(void *opaque, uint32_t addr)
         pdebug("re%08x s\n", eppdata);
         return eppdata;
     }
-    err = qemu_chr_ioctl(s->chr, CHR_IOCTL_PP_EPP_READ, &ioarg);
+    err = qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_PP_EPP_READ, &ioarg);
     ret = le32_to_cpu(eppdata);
 
     if (err) {
@@ -473,7 +473,7 @@ static int parallel_isa_initfn(ISADevice *dev)
     isa_init_irq(dev, &s->irq, isa->isairq);
     qemu_register_reset(parallel_reset, s);
 
-    if (qemu_chr_ioctl(s->chr, CHR_IOCTL_PP_READ_STATUS, &dummy) == 0) {
+    if (qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_PP_READ_STATUS, &dummy) == 0) {
         s->hw_driver = 1;
         s->status = dummy;
     }
diff --git a/hw/serial.c b/hw/serial.c
index dc6d1f8..90cca8d 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -274,7 +274,7 @@ static void serial_update_parameters(SerialState *s)
     ssp.data_bits = data_bits;
     ssp.stop_bits = stop_bits;
     s->char_transmit_time =  (get_ticks_per_sec() / speed) * frame_size;
-    qemu_chr_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
+    qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
 
     DPRINTF("speed=%d parity=%c data=%d stop=%d\n",
            speed, parity, data_bits, stop_bits);
@@ -287,7 +287,7 @@ static void serial_update_msl(SerialState *s)
 
     qemu_del_timer(s->modem_status_poll);
 
-    if (qemu_chr_ioctl(s->chr,CHR_IOCTL_SERIAL_GET_TIOCM, &flags) == -ENOTSUP) {
+    if (qemu_chr_fe_ioctl(s->chr,CHR_IOCTL_SERIAL_GET_TIOCM, &flags) == -ENOTSUP) {
         s->poll_msl = -1;
         return;
     }
@@ -467,7 +467,7 @@ static void serial_ioport_write(void *opaque, uint32_t addr, uint32_t val)
             break_enable = (val >> 6) & 1;
             if (break_enable != s->last_break_enable) {
                 s->last_break_enable = break_enable;
-                qemu_chr_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_BREAK,
+                qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_BREAK,
                                &break_enable);
             }
         }
@@ -482,7 +482,7 @@ static void serial_ioport_write(void *opaque, uint32_t addr, uint32_t val)
 
             if (s->poll_msl >= 0 && old_mcr != s->mcr) {
 
-                qemu_chr_ioctl(s->chr,CHR_IOCTL_SERIAL_GET_TIOCM, &flags);
+                qemu_chr_fe_ioctl(s->chr,CHR_IOCTL_SERIAL_GET_TIOCM, &flags);
 
                 flags &= ~(CHR_TIOCM_RTS | CHR_TIOCM_DTR);
 
@@ -491,7 +491,7 @@ static void serial_ioport_write(void *opaque, uint32_t addr, uint32_t val)
                 if (val & UART_MCR_DTR)
                     flags |= CHR_TIOCM_DTR;
 
-                qemu_chr_ioctl(s->chr,CHR_IOCTL_SERIAL_SET_TIOCM, &flags);
+                qemu_chr_fe_ioctl(s->chr,CHR_IOCTL_SERIAL_SET_TIOCM, &flags);
                 /* Update the modem status after a one-character-send wait-time, since there may be a response
                    from the device/computer at the other end of the serial line */
                 qemu_mod_timer(s->modem_status_poll, qemu_get_clock_ns(vm_clock) + s->char_transmit_time);
diff --git a/hw/strongarm.c b/hw/strongarm.c
index 50fe0c0..fca51aa 100644
--- a/hw/strongarm.c
+++ b/hw/strongarm.c
@@ -980,7 +980,7 @@ static void strongarm_uart_update_parameters(StrongARMUARTState *s)
     ssp.stop_bits = stop_bits;
     s->char_transmit_time =  (get_ticks_per_sec() / speed) * frame_size;
     if (s->chr) {
-        qemu_chr_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
+        qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
     }
 
     DPRINTF(stderr, "%s speed=%d parity=%c data=%d stop=%d\n", s->chr->label,
diff --git a/hw/usb-serial.c b/hw/usb-serial.c
index 8ed0fa6..a0fbfca 100644
--- a/hw/usb-serial.c
+++ b/hw/usb-serial.c
@@ -203,7 +203,7 @@ static uint8_t usb_get_modem_lines(USBSerialState *s)
     int flags;
     uint8_t ret;
 
-    if (qemu_chr_ioctl(s->cs, CHR_IOCTL_SERIAL_GET_TIOCM, &flags) == -ENOTSUP)
+    if (qemu_chr_fe_ioctl(s->cs, CHR_IOCTL_SERIAL_GET_TIOCM, &flags) == -ENOTSUP)
         return FTDI_CTS|FTDI_DSR|FTDI_RLSD;
 
     ret = 0;
@@ -263,7 +263,7 @@ static int usb_serial_handle_control(USBDevice *dev, USBPacket *p,
     case DeviceOutVendor | FTDI_SET_MDM_CTRL:
     {
         static int flags;
-        qemu_chr_ioctl(s->cs,CHR_IOCTL_SERIAL_GET_TIOCM, &flags);
+        qemu_chr_fe_ioctl(s->cs,CHR_IOCTL_SERIAL_GET_TIOCM, &flags);
         if (value & FTDI_SET_RTS) {
             if (value & FTDI_RTS)
                 flags |= CHR_TIOCM_RTS;
@@ -276,7 +276,7 @@ static int usb_serial_handle_control(USBDevice *dev, USBPacket *p,
             else
                 flags &= ~CHR_TIOCM_DTR;
         }
-        qemu_chr_ioctl(s->cs,CHR_IOCTL_SERIAL_SET_TIOCM, &flags);
+        qemu_chr_fe_ioctl(s->cs,CHR_IOCTL_SERIAL_SET_TIOCM, &flags);
         break;
     }
     case DeviceOutVendor | FTDI_SET_FLOW_CTRL:
@@ -295,7 +295,7 @@ static int usb_serial_handle_control(USBDevice *dev, USBPacket *p,
             divisor = 1;
 
         s->params.speed = (48000000 / 2) / (8 * divisor + subdivisor8);
-        qemu_chr_ioctl(s->cs, CHR_IOCTL_SERIAL_SET_PARAMS, &s->params);
+        qemu_chr_fe_ioctl(s->cs, CHR_IOCTL_SERIAL_SET_PARAMS, &s->params);
         break;
     }
     case DeviceOutVendor | FTDI_SET_DATA:
@@ -324,7 +324,7 @@ static int usb_serial_handle_control(USBDevice *dev, USBPacket *p,
                 DPRINTF("unsupported stop bits %d\n", value & FTDI_STOP);
                 goto fail;
         }
-        qemu_chr_ioctl(s->cs, CHR_IOCTL_SERIAL_SET_PARAMS, &s->params);
+        qemu_chr_fe_ioctl(s->cs, CHR_IOCTL_SERIAL_SET_PARAMS, &s->params);
         /* TODO: TX ON/OFF */
         break;
     case DeviceInVendor | FTDI_GET_MDM_ST:
diff --git a/qemu-char.c b/qemu-char.c
index 88a0a93..cfb398e 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -144,7 +144,7 @@ int qemu_chr_fe_write(CharDriverState *s, const uint8_t *buf, int len)
     return s->chr_write(s, buf, len);
 }
 
-int qemu_chr_ioctl(CharDriverState *s, int cmd, void *arg)
+int qemu_chr_fe_ioctl(CharDriverState *s, int cmd, void *arg)
 {
     if (!s->chr_ioctl)
         return -ENOTSUP;
diff --git a/qemu-char.h b/qemu-char.h
index c95b554..513daa9 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -94,7 +94,7 @@ void qemu_chr_add_handlers(CharDriverState *s,
                            IOReadHandler *fd_read,
                            IOEventHandler *fd_event,
                            void *opaque);
-int qemu_chr_ioctl(CharDriverState *s, int cmd, void *arg);
+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);
 void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH 08/14] char: rename qemu_chr_set_echo() -> qemu_chr_fe_set_echo()
  2011-08-15 16:17 [Qemu-devel] [PATCH 00/14] char: flow control part I Anthony Liguori
                   ` (6 preceding siblings ...)
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 07/14] char: qemu_chr_ioctl() -> qemu_chr_fe_ioctl() Anthony Liguori
@ 2011-08-15 16:17 ` Anthony Liguori
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 09/14] char: rename qemu_chr_open() -> qemu_chr_new() Anthony Liguori
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Anthony Liguori @ 2011-08-15 16:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 monitor.c   |    2 +-
 qemu-char.c |    4 ++--
 qemu-char.h |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/monitor.c b/monitor.c
index 38d4544..e7f41eb 100644
--- a/monitor.c
+++ b/monitor.c
@@ -5275,7 +5275,7 @@ void monitor_init(CharDriverState *chr, int flags)
         /* Control mode requires special handlers */
         qemu_chr_add_handlers(chr, monitor_can_read, monitor_control_read,
                               monitor_control_event, mon);
-        qemu_chr_set_echo(chr, true);
+        qemu_chr_fe_set_echo(chr, true);
     } else {
         qemu_chr_add_handlers(chr, monitor_can_read, monitor_read,
                               monitor_event, mon);
diff --git a/qemu-char.c b/qemu-char.c
index cfb398e..e191c11 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -795,7 +795,7 @@ static int qemu_chr_open_stdio(QemuOpts *opts, CharDriverState **_chr)
     stdio_nb_clients++;
     stdio_allow_signal = qemu_opt_get_bool(opts, "signal",
                                            display_type != DT_NOGRAPHIC);
-    qemu_chr_set_echo(chr, false);
+    qemu_chr_fe_set_echo(chr, false);
 
     *_chr = chr;
     return 0;
@@ -2625,7 +2625,7 @@ CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*i
     return chr;
 }
 
-void qemu_chr_set_echo(struct CharDriverState *chr, bool echo)
+void qemu_chr_fe_set_echo(struct CharDriverState *chr, bool echo)
 {
     if (chr->chr_set_echo) {
         chr->chr_set_echo(chr, echo);
diff --git a/qemu-char.h b/qemu-char.h
index 513daa9..a487454 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -81,7 +81,7 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename);
 CharDriverState *qemu_chr_open_opts(QemuOpts *opts,
                                     void (*init)(struct CharDriverState *s));
 CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*init)(struct CharDriverState *s));
-void qemu_chr_set_echo(struct CharDriverState *chr, bool echo);
+void qemu_chr_fe_set_echo(struct CharDriverState *chr, bool echo);
 void qemu_chr_fe_open(struct CharDriverState *chr);
 void qemu_chr_fe_close(struct CharDriverState *chr);
 void qemu_chr_close(CharDriverState *chr);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH 09/14] char: rename qemu_chr_open() -> qemu_chr_new()
  2011-08-15 16:17 [Qemu-devel] [PATCH 00/14] char: flow control part I Anthony Liguori
                   ` (7 preceding siblings ...)
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 08/14] char: rename qemu_chr_set_echo() -> qemu_chr_fe_set_echo() Anthony Liguori
@ 2011-08-15 16:17 ` Anthony Liguori
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 10/14] char: qemu_chr_open_opts() -> qemu_chr_new_from_opts() Anthony Liguori
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Anthony Liguori @ 2011-08-15 16:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 gdbstub.c        |    2 +-
 hw/mips_malta.c  |    4 ++--
 hw/omap2.c       |    2 +-
 hw/omap_uart.c   |    8 ++++----
 hw/usb-serial.c  |    4 ++--
 hw/xen_console.c |    2 +-
 net/slirp.c      |    2 +-
 qemu-char.c      |    2 +-
 qemu-char.h      |    2 +-
 vl.c             |    8 ++++----
 10 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/gdbstub.c b/gdbstub.c
index 058c626..f99f87f 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -2764,7 +2764,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;
 
diff --git a/hw/mips_malta.c b/hw/mips_malta.c
index 9021752..e52a7f8 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 919318f..cb860dc 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 9cee81d..bdf6212 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 a0fbfca..0637ee9 100644
--- a/hw/usb-serial.c
+++ b/hw/usb-serial.c
@@ -538,7 +538,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;
 
@@ -561,7 +561,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 e218bb8..7fe6164 100644
--- a/hw/xen_console.c
+++ b/hw/xen_console.c
@@ -202,7 +202,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/net/slirp.c b/net/slirp.c
index 157b80a..1e3a529 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -616,7 +616,7 @@ static int slirp_guestfwd(SlirpState *s, const char *config_str,
 
     fwd = qemu_malloc(sizeof(struct GuestFwd));
     snprintf(buf, sizeof(buf), "guestfwd.tcp.%d", port);
-    fwd->hd = qemu_chr_open(buf, p, NULL);
+    fwd->hd = qemu_chr_new(buf, p, NULL);
     if (!fwd->hd) {
         error_report("could not open guest forwarding device '%s'", buf);
         qemu_free(fwd);
diff --git a/qemu-char.c b/qemu-char.c
index e191c11..569e989 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2603,7 +2603,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;
diff --git a/qemu-char.h b/qemu-char.h
index a487454..097f0e6 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -80,7 +80,7 @@ struct CharDriverState {
 QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename);
 CharDriverState *qemu_chr_open_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_set_echo(struct CharDriverState *chr, bool echo);
 void qemu_chr_fe_open(struct CharDriverState *chr);
 void qemu_chr_fe_close(struct CharDriverState *chr);
diff --git a/vl.c b/vl.c
index c714127..7143d15 100644
--- a/vl.c
+++ b/vl.c
@@ -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);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH 10/14] char: qemu_chr_open_opts() -> qemu_chr_new_from_opts()
  2011-08-15 16:17 [Qemu-devel] [PATCH 00/14] char: flow control part I Anthony Liguori
                   ` (8 preceding siblings ...)
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 09/14] char: rename qemu_chr_open() -> qemu_chr_new() Anthony Liguori
@ 2011-08-15 16:17 ` Anthony Liguori
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 11/14] char: rename qemu_chr_close() -> qemu_chr_delete() Anthony Liguori
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Anthony Liguori @ 2011-08-15 16:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 qemu-char.c |    4 ++--
 qemu-char.h |    2 +-
 vl.c        |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/qemu-char.c b/qemu-char.c
index 569e989..75fe7b3 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2548,7 +2548,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;
@@ -2617,7 +2617,7 @@ CharDriverState *qemu_chr_new(const char *label, const char *filename, void (*in
     if (!opts)
         return NULL;
 
-    chr = qemu_chr_open_opts(opts, init);
+    chr = qemu_chr_new_from_opts(opts, init);
     if (chr && qemu_opt_get_bool(opts, "mux", 0)) {
         monitor_init(chr, MONITOR_USE_READLINE);
     }
diff --git a/qemu-char.h b/qemu-char.h
index 097f0e6..f90b85c 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -78,7 +78,7 @@ 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_new(const char *label, const char *filename, void (*init)(struct CharDriverState *s));
 void qemu_chr_fe_set_echo(struct CharDriverState *chr, bool echo);
diff --git a/vl.c b/vl.c
index 7143d15..c389c27 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;
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH 11/14] char: rename qemu_chr_close() -> qemu_chr_delete()
  2011-08-15 16:17 [Qemu-devel] [PATCH 00/14] char: flow control part I Anthony Liguori
                   ` (9 preceding siblings ...)
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 10/14] char: qemu_chr_open_opts() -> qemu_chr_new_from_opts() Anthony Liguori
@ 2011-08-15 16:17 ` Anthony Liguori
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 12/14] char: rename qemu_chr_get_msgfd() -> qemu_chr_fe_get_msgfd() Anthony Liguori
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Anthony Liguori @ 2011-08-15 16:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 gdbstub.c               |    4 ++--
 hw/ccid-card-passthru.c |    2 +-
 hw/usb-serial.c         |    2 +-
 qemu-char.c             |    4 ++--
 qemu-char.h             |    2 +-
 usb-redir.c             |    2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/gdbstub.c b/gdbstub.c
index f99f87f..ba793b9 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_delete(s->chr);
   }
 #endif
 }
@@ -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_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 082fd82..2cbc81b 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_delete(card->cs);
     card->vscard_in_pos = card->vscard_in_hdr = 0;
 }
 
diff --git a/hw/usb-serial.c b/hw/usb-serial.c
index 0637ee9..7dbf6df 100644
--- a/hw/usb-serial.c
+++ b/hw/usb-serial.c
@@ -428,7 +428,7 @@ static void usb_serial_handle_destroy(USBDevice *dev)
 {
     USBSerialState *s = (USBSerialState *)dev;
 
-    qemu_chr_close(s->cs);
+    qemu_chr_delete(s->cs);
 }
 
 static int usb_serial_can_read(void *opaque)
diff --git a/qemu-char.c b/qemu-char.c
index 75fe7b3..70349fd 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2370,7 +2370,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_delete()! */
 void qemu_chr_close_mem(CharDriverState *chr)
 {
     MemoryDriver *d = chr->opaque;
@@ -2646,7 +2646,7 @@ void qemu_chr_fe_close(struct CharDriverState *chr)
     }
 }
 
-void qemu_chr_close(CharDriverState *chr)
+void qemu_chr_delete(CharDriverState *chr)
 {
     QTAILQ_REMOVE(&chardevs, chr, next);
     if (chr->chr_close)
diff --git a/qemu-char.h b/qemu-char.h
index f90b85c..555b5f1 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -84,7 +84,7 @@ CharDriverState *qemu_chr_new(const char *label, const char *filename, void (*in
 void qemu_chr_fe_set_echo(struct CharDriverState *chr, bool echo);
 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_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);
diff --git a/usb-redir.c b/usb-redir.c
index 9916dea..f47e568 100644
--- a/usb-redir.c
+++ b/usb-redir.c
@@ -837,7 +837,7 @@ static void usbredir_handle_destroy(USBDevice *udev)
 {
     USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev);
 
-    qemu_chr_close(dev->cs);
+    qemu_chr_delete(dev->cs);
     /* Note must be done after qemu_chr_close, as that causes a close event */
     qemu_bh_delete(dev->open_close_bh);
 
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH 12/14] char: rename qemu_chr_get_msgfd() -> qemu_chr_fe_get_msgfd()
  2011-08-15 16:17 [Qemu-devel] [PATCH 00/14] char: flow control part I Anthony Liguori
                   ` (10 preceding siblings ...)
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 11/14] char: rename qemu_chr_close() -> qemu_chr_delete() Anthony Liguori
@ 2011-08-15 16:17 ` Anthony Liguori
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 13/14] char: remove qemu_chr_send_event() Anthony Liguori
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Anthony Liguori @ 2011-08-15 16:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 hw/ivshmem.c |    2 +-
 monitor.c    |    2 +-
 qemu-char.c  |    2 +-
 qemu-char.h  |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/ivshmem.c b/hw/ivshmem.c
index 42a5877..1176387 100644
--- a/hw/ivshmem.c
+++ b/hw/ivshmem.c
@@ -401,7 +401,7 @@ static void ivshmem_read(void *opaque, const uint8_t * buf, int flags)
 
     memcpy(&incoming_posn, buf, sizeof(long));
     /* pick off s->server_chr->msgfd and store it, posn should accompany msg */
-    tmp_fd = qemu_chr_get_msgfd(s->server_chr);
+    tmp_fd = qemu_chr_fe_get_msgfd(s->server_chr);
     IVSHMEM_DPRINTF("posn is %ld, fd is %d\n", incoming_posn, tmp_fd);
 
     /* make sure we have enough space for this guest */
diff --git a/monitor.c b/monitor.c
index e7f41eb..7d5dd6f 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2758,7 +2758,7 @@ static int do_getfd(Monitor *mon, const QDict *qdict, QObject **ret_data)
     mon_fd_t *monfd;
     int fd;
 
-    fd = qemu_chr_get_msgfd(mon->chr);
+    fd = qemu_chr_fe_get_msgfd(mon->chr);
     if (fd == -1) {
         qerror_report(QERR_FD_NOT_SUPPLIED);
         return -1;
diff --git a/qemu-char.c b/qemu-char.c
index 70349fd..9af6c58 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -163,7 +163,7 @@ void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len)
     s->chr_read(s->handler_opaque, buf, len);
 }
 
-int qemu_chr_get_msgfd(CharDriverState *s)
+int qemu_chr_fe_get_msgfd(CharDriverState *s)
 {
     return s->get_msgfd ? s->get_msgfd(s) : -1;
 }
diff --git a/qemu-char.h b/qemu-char.h
index 555b5f1..abd9cbd 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -98,7 +98,7 @@ 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);
 void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len);
-int qemu_chr_get_msgfd(CharDriverState *s);
+int qemu_chr_fe_get_msgfd(CharDriverState *s);
 void qemu_chr_accept_input(CharDriverState *s);
 int qemu_chr_add_client(CharDriverState *s, int fd);
 void qemu_chr_info_print(Monitor *mon, const QObject *ret_data);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH 13/14] char: remove qemu_chr_send_event()
  2011-08-15 16:17 [Qemu-devel] [PATCH 00/14] char: flow control part I Anthony Liguori
                   ` (11 preceding siblings ...)
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 12/14] char: rename qemu_chr_get_msgfd() -> qemu_chr_fe_get_msgfd() Anthony Liguori
@ 2011-08-15 16:17 ` Anthony Liguori
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 14/14] char: document the functions that will be the public interface Anthony Liguori
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Anthony Liguori @ 2011-08-15 16:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori

It's dead code.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 console.c   |   16 ----------------
 hw/baum.c   |   15 ---------------
 qemu-char.c |    6 ------
 qemu-char.h |    2 --
 4 files changed, 0 insertions(+), 39 deletions(-)

diff --git a/console.c b/console.c
index 489c74c..77285bf 100644
--- a/console.c
+++ b/console.c
@@ -1102,21 +1102,6 @@ static int console_puts(CharDriverState *chr, const uint8_t *buf, int len)
     return len;
 }
 
-static void console_send_event(CharDriverState *chr, int event)
-{
-    TextConsole *s = chr->opaque;
-    int i;
-
-    if (event == CHR_EVENT_FOCUS) {
-        for(i = 0; i < nb_consoles; i++) {
-            if (consoles[i] == s) {
-                console_select(i);
-                break;
-            }
-        }
-    }
-}
-
 static void kbd_send_chars(void *opaque)
 {
     TextConsole *s = opaque;
@@ -1462,7 +1447,6 @@ static void text_console_do_init(CharDriverState *chr, DisplayState *ds)
     s = chr->opaque;
 
     chr->chr_write = console_puts;
-    chr->chr_send_event = console_send_event;
 
     s->out_fifo.buf = s->out_fifo_buf;
     s->out_fifo.buf_size = sizeof(s->out_fifo_buf);
diff --git a/hw/baum.c b/hw/baum.c
index 244eee5..80bc61a 100644
--- a/hw/baum.c
+++ b/hw/baum.c
@@ -468,20 +468,6 @@ static int baum_write(CharDriverState *chr, const uint8_t *buf, int len)
     return orig_len;
 }
 
-/* The other end sent us some event */
-static void baum_send_event(CharDriverState *chr, int event)
-{
-    BaumDriverState *baum = chr->opaque;
-    switch (event) {
-    case CHR_EVENT_BREAK:
-        break;
-    case CHR_EVENT_OPENED:
-        /* Reset state */
-        baum->in_buf_used = 0;
-        break;
-    }
-}
-
 /* Send the key code to the other end */
 static void baum_send_key(BaumDriverState *baum, uint8_t type, uint8_t value) {
     uint8_t packet[] = { type, value };
@@ -591,7 +577,6 @@ int chr_baum_init(QemuOpts *opts, CharDriverState **_chr)
 
     chr->opaque = baum;
     chr->chr_write = baum_write;
-    chr->chr_send_event = baum_send_event;
     chr->chr_accept_input = baum_accept_input;
     chr->chr_close = baum_close;
 
diff --git a/qemu-char.c b/qemu-char.c
index 9af6c58..3f41e3a 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -189,12 +189,6 @@ void qemu_chr_fe_printf(CharDriverState *s, const char *fmt, ...)
     va_end(ap);
 }
 
-void qemu_chr_send_event(CharDriverState *s, int event)
-{
-    if (s->chr_send_event)
-        s->chr_send_event(s, event);
-}
-
 void qemu_chr_add_handlers(CharDriverState *s,
                            IOCanReadHandler *fd_can_read,
                            IOReadHandler *fd_read,
diff --git a/qemu-char.h b/qemu-char.h
index abd9cbd..fba0290 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -62,7 +62,6 @@ struct CharDriverState {
     IOCanReadHandler *chr_can_read;
     IOReadHandler *chr_read;
     void *handler_opaque;
-    void (*chr_send_event)(struct CharDriverState *chr, int event);
     void (*chr_close)(struct CharDriverState *chr);
     void (*chr_accept_input)(struct CharDriverState *chr);
     void (*chr_set_echo)(struct CharDriverState *chr, bool echo);
@@ -88,7 +87,6 @@ void qemu_chr_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);
-void qemu_chr_send_event(CharDriverState *s, int event);
 void qemu_chr_add_handlers(CharDriverState *s,
                            IOCanReadHandler *fd_can_read,
                            IOReadHandler *fd_read,
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH 14/14] char: document the functions that will be the public interface
  2011-08-15 16:17 [Qemu-devel] [PATCH 00/14] char: flow control part I Anthony Liguori
                   ` (12 preceding siblings ...)
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 13/14] char: remove qemu_chr_send_event() Anthony Liguori
@ 2011-08-15 16:17 ` Anthony Liguori
  2011-08-16 13:09 ` [Qemu-devel] [PATCH 00/14] char: flow control part I Amit Shah
  2011-08-22 16:31 ` Anthony Liguori
  15 siblings, 0 replies; 17+ messages in thread
From: Anthony Liguori @ 2011-08-15 16:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 qemu-char.h |  137 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 130 insertions(+), 7 deletions(-)

diff --git a/qemu-char.h b/qemu-char.h
index fba0290..eebbdd8 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -76,33 +76,156 @@ struct CharDriverState {
     QTAILQ_ENTRY(CharDriverState) next;
 };
 
-QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename);
+/**
+ * @qemu_chr_new_from_opts:
+ *
+ * Create a new character backend from a QemuOpts list.
+ *
+ * @opts see qemu-config.c for a list of valid options
+ * @init not sure..
+ *
+ * Returns: a new character backend
+ */
 CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts,
                                     void (*init)(struct CharDriverState *s));
-CharDriverState *qemu_chr_new(const char *label, const char *filename, void (*init)(struct CharDriverState *s));
+
+/**
+ * @qemu_chr_new:
+ *
+ * Create a new character backend from a URI.
+ *
+ * @label the name of the backend
+ * @filename the URI
+ * @init not sure..
+ *
+ * Returns: a new character backend
+ */
+CharDriverState *qemu_chr_new(const char *label, const char *filename,
+                              void (*init)(struct CharDriverState *s));
+
+/**
+ * @qemu_chr_delete:
+ *
+ * Destroy a character backend.
+ */
+void qemu_chr_delete(CharDriverState *chr);
+
+/**
+ * @qemu_chr_fe_set_echo:
+ *
+ * Ask the backend to override its normal echo setting.  This only really
+ * applies to the stdio backend and is used by the QMP server such that you
+ * can see what you type if you try to type QMP commands.
+ *
+ * @echo true to enable echo, false to disable echo
+ */
 void qemu_chr_fe_set_echo(struct CharDriverState *chr, bool echo);
+
+/**
+ * @qemu_chr_fe_open:
+ *
+ * Open a character backend.  This function call is an indication that the
+ * front end is ready to begin doing I/O.
+ */
 void qemu_chr_fe_open(struct CharDriverState *chr);
+
+/**
+ * @qemu_chr_fe_close:
+ *
+ * Close a character backend.  This function call indicates that the front end
+ * no longer is able to process I/O.  To process I/O again, the front end will
+ * call @qemu_chr_fe_open.
+ */
 void qemu_chr_fe_close(struct CharDriverState *chr);
-void qemu_chr_delete(CharDriverState *chr);
+
+/**
+ * @qemu_chr_fe_printf:
+ *
+ * Write to a character backend using a printf style interface.
+ *
+ * @fmt see #printf
+ */
 void qemu_chr_fe_printf(CharDriverState *s, const char *fmt, ...)
     GCC_FMT_ATTR(2, 3);
+
+/**
+ * @qemu_chr_fe_write:
+ *
+ * Write data to a character backend from the front end.  This function will
+ * send data from the front end to the back end.
+ *
+ * @buf the data
+ * @len the number of bytes to send
+ *
+ * Returns: the number of bytes consumed
+ */
 int qemu_chr_fe_write(CharDriverState *s, const uint8_t *buf, int len);
+
+/**
+ * @qemu_chr_fe_ioctl:
+ *
+ * Issue a device specific ioctl to a backend.
+ *
+ * @cmd see CHR_IOCTL_*
+ * @arg the data associated with @cmd
+ *
+ * Returns: if @cmd is not supported by the backend, -ENOTSUP, otherwise the
+ *          return value depends on the semantics of @cmd
+ */
+int qemu_chr_fe_ioctl(CharDriverState *s, int cmd, void *arg);
+
+/**
+ * @qemu_chr_fe_get_msgfd:
+ *
+ * For backends capable of fd passing, return the latest file descriptor passed
+ * by a client.
+ *
+ * Returns: -1 if fd passing isn't supported or there is no pending file
+ *          descriptor.  If a file descriptor is returned, subsequent calls to
+ *          this function will return -1 until a client sends a new file
+ *          descriptor.
+ */
+int qemu_chr_fe_get_msgfd(CharDriverState *s);
+
+/**
+ * @qemu_chr_be_can_write:
+ *
+ * Determine how much data the front end can currently accept.  This function
+ * returns the number of bytes the front end can accept.  If it returns 0, the
+ * front end cannot receive data at the moment.  The function must be polled
+ * to determine when data can be received.
+ *
+ * Returns: the number of bytes the front end can receive via @qemu_chr_be_write
+ */
+int qemu_chr_be_can_write(CharDriverState *s);
+
+/**
+ * @qemu_chr_be_write:
+ *
+ * Write data from the back end to the front end.  Before issuing this call,
+ * the caller should call @qemu_chr_be_can_write to determine how much data
+ * the front end can currently accept.
+ *
+ * @buf a buffer to receive data from the front end
+ * @len the number of bytes to receive from the front end
+ */
+void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len);
+
 void qemu_chr_add_handlers(CharDriverState *s,
                            IOCanReadHandler *fd_can_read,
                            IOReadHandler *fd_read,
                            IOEventHandler *fd_event,
                            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);
-void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len);
-int qemu_chr_fe_get_msgfd(CharDriverState *s);
 void qemu_chr_accept_input(CharDriverState *s);
 int qemu_chr_add_client(CharDriverState *s, int fd);
 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);
 
+QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename);
+
 /* add an eventfd to the qemu devices that are polled */
 CharDriverState *qemu_chr_open_eventfd(int eventfd);
 
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH 00/14] char: flow control part I
  2011-08-15 16:17 [Qemu-devel] [PATCH 00/14] char: flow control part I Anthony Liguori
                   ` (13 preceding siblings ...)
  2011-08-15 16:17 ` [Qemu-devel] [PATCH 14/14] char: document the functions that will be the public interface Anthony Liguori
@ 2011-08-16 13:09 ` Amit Shah
  2011-08-22 16:31 ` Anthony Liguori
  15 siblings, 0 replies; 17+ messages in thread
From: Amit Shah @ 2011-08-16 13:09 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel

On (Mon) 15 Aug 2011 [11:17:27], Anthony Liguori wrote:
> This is a dump of some of the easier stuff to merge from my character backend
> flow control branch.  It's mostly just renaming functions and adding
> documentation.

Acked-by: Amit Shah <amit.shah@redhat.com>

		Amit

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH 00/14] char: flow control part I
  2011-08-15 16:17 [Qemu-devel] [PATCH 00/14] char: flow control part I Anthony Liguori
                   ` (14 preceding siblings ...)
  2011-08-16 13:09 ` [Qemu-devel] [PATCH 00/14] char: flow control part I Amit Shah
@ 2011-08-22 16:31 ` Anthony Liguori
  15 siblings, 0 replies; 17+ messages in thread
From: Anthony Liguori @ 2011-08-22 16:31 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel

On 08/15/2011 11:17 AM, Anthony Liguori wrote:
> This is a dump of some of the easier stuff to merge from my character backend
> flow control branch.  It's mostly just renaming functions and adding
> documentation.

Applied.

Regards,

Anthony Liguori

>

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2011-08-22 16:31 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-15 16:17 [Qemu-devel] [PATCH 00/14] char: flow control part I Anthony Liguori
2011-08-15 16:17 ` [Qemu-devel] [PATCH 01/14] char: rename qemu_chr_write() -> qemu_chr_fe_write() Anthony Liguori
2011-08-15 16:17 ` [Qemu-devel] [PATCH 02/14] char: rename qemu_chr_printf() -> qemu_chr_fe_printf() Anthony Liguori
2011-08-15 16:17 ` [Qemu-devel] [PATCH 03/14] char: rename qemu_chr_read() -> qemu_chr_be_write() Anthony Liguori
2011-08-15 16:17 ` [Qemu-devel] [PATCH 04/14] char: rename qemu_chr_can_read() -> qemu_chr_be_can_read() Anthony Liguori
2011-08-15 16:17 ` [Qemu-devel] [PATCH 05/14] char: rename qemu_chr_guest_open() -> qemu_chr_fe_open() Anthony Liguori
2011-08-15 16:17 ` [Qemu-devel] [PATCH 06/14] char: rename qemu_chr_guest_close() -> qemu_chr_fe_close() Anthony Liguori
2011-08-15 16:17 ` [Qemu-devel] [PATCH 07/14] char: qemu_chr_ioctl() -> qemu_chr_fe_ioctl() Anthony Liguori
2011-08-15 16:17 ` [Qemu-devel] [PATCH 08/14] char: rename qemu_chr_set_echo() -> qemu_chr_fe_set_echo() Anthony Liguori
2011-08-15 16:17 ` [Qemu-devel] [PATCH 09/14] char: rename qemu_chr_open() -> qemu_chr_new() Anthony Liguori
2011-08-15 16:17 ` [Qemu-devel] [PATCH 10/14] char: qemu_chr_open_opts() -> qemu_chr_new_from_opts() Anthony Liguori
2011-08-15 16:17 ` [Qemu-devel] [PATCH 11/14] char: rename qemu_chr_close() -> qemu_chr_delete() Anthony Liguori
2011-08-15 16:17 ` [Qemu-devel] [PATCH 12/14] char: rename qemu_chr_get_msgfd() -> qemu_chr_fe_get_msgfd() Anthony Liguori
2011-08-15 16:17 ` [Qemu-devel] [PATCH 13/14] char: remove qemu_chr_send_event() Anthony Liguori
2011-08-15 16:17 ` [Qemu-devel] [PATCH 14/14] char: document the functions that will be the public interface Anthony Liguori
2011-08-16 13:09 ` [Qemu-devel] [PATCH 00/14] char: flow control part I Amit Shah
2011-08-22 16:31 ` Anthony Liguori

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.