Diff for /qemu/hw/xen_console.c between versions 1.1 and 1.1.1.4

version 1.1, 2018/04/24 17:24:42 version 1.1.1.4, 2018/04/24 19:49:18
Line 33 Line 33
 #include <xenctrl.h>  #include <xenctrl.h>
   
 #include "hw.h"  #include "hw.h"
 #include "sysemu.h"  
 #include "qemu-char.h"  #include "qemu-char.h"
 #include "xen_backend.h"  #include "xen_backend.h"
   
Line 71  static void buffer_append(struct XenCons Line 70  static void buffer_append(struct XenCons
   
     if ((buffer->capacity - buffer->size) < size) {      if ((buffer->capacity - buffer->size) < size) {
         buffer->capacity += (size + 1024);          buffer->capacity += (size + 1024);
         buffer->data = qemu_realloc(buffer->data, buffer->capacity);          buffer->data = g_realloc(buffer->data, buffer->capacity);
     }      }
   
     while (cons != prod)      while (cons != prod)
Line 90  static void buffer_append(struct XenCons Line 89  static void buffer_append(struct XenCons
         uint8_t *maxpos = buffer->data + buffer->max_capacity;          uint8_t *maxpos = buffer->data + buffer->max_capacity;
   
         memmove(maxpos - over, maxpos, over);          memmove(maxpos - over, maxpos, over);
         buffer->data = qemu_realloc(buffer->data, buffer->max_capacity);          buffer->data = g_realloc(buffer->data, buffer->max_capacity);
         buffer->size = buffer->capacity = buffer->max_capacity;          buffer->size = buffer->capacity = buffer->max_capacity;
   
         if (buffer->consumed > buffer->max_capacity - over)          if (buffer->consumed > buffer->max_capacity - over)
Line 157  static void xencons_send(struct XenConso Line 156  static void xencons_send(struct XenConso
   
     size = con->buffer.size - con->buffer.consumed;      size = con->buffer.size - con->buffer.consumed;
     if (con->chr)      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);                               size);
     else      else
         len = size;          len = size;
Line 180  static void xencons_send(struct XenConso Line 179  static void xencons_send(struct XenConso
 static int con_init(struct XenDevice *xendev)  static int con_init(struct XenDevice *xendev)
 {  {
     struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);      struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);
     char *type, *dom;      char *type, *dom, label[32];
       int ret = 0;
       const char *output;
   
     /* setup */      /* setup */
     dom = xs_get_domain_path(xenstore, con->xendev.dom);      dom = xs_get_domain_path(xenstore, con->xendev.dom);
Line 190  static int con_init(struct XenDevice *xe Line 191  static int con_init(struct XenDevice *xe
     type = xenstore_read_str(con->console, "type");      type = xenstore_read_str(con->console, "type");
     if (!type || strcmp(type, "ioemu") != 0) {      if (!type || strcmp(type, "ioemu") != 0) {
         xen_be_printf(xendev, 1, "not for me (type=%s)\n", type);          xen_be_printf(xendev, 1, "not for me (type=%s)\n", type);
         return -1;          ret = -1;
           goto out;
     }      }
   
     if (!serial_hds[con->xendev.dev])      output = xenstore_read_str(con->console, "output");
         xen_be_printf(xendev, 1, "WARNING: serial line %d not configured\n",  
                       con->xendev.dev);      /* no Xen override, use qemu output device */
     else      if (output == NULL) {
         con->chr = serial_hds[con->xendev.dev];          con->chr = serial_hds[con->xendev.dev];
       } else {
           snprintf(label, sizeof(label), "xencons%d", con->xendev.dev);
           con->chr = qemu_chr_new(label, output, NULL);
       }
   
     return 0;      xenstore_store_pv_console_info(con->xendev.dev, con->chr);
   
   out:
       g_free(type);
       return ret;
 }  }
   
 static int con_connect(struct XenDevice *xendev)  static int con_initialise(struct XenDevice *xendev)
 {  {
     struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);      struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);
     int limit;      int limit;
Line 238  static void con_disconnect(struct XenDev Line 248  static void con_disconnect(struct XenDev
 {  {
     struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);      struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);
   
       if (!xendev->dev) {
           return;
       }
     if (con->chr)      if (con->chr)
         qemu_chr_add_handlers(con->chr, NULL, NULL, NULL, NULL);          qemu_chr_add_handlers(con->chr, NULL, NULL, NULL, NULL);
     xen_be_unbind_evtchn(&con->xendev);      xen_be_unbind_evtchn(&con->xendev);
Line 263  struct XenDevOps xen_console_ops = { Line 276  struct XenDevOps xen_console_ops = {
     .size       = sizeof(struct XenConsole),      .size       = sizeof(struct XenConsole),
     .flags      = DEVOPS_FLAG_IGNORE_STATE,      .flags      = DEVOPS_FLAG_IGNORE_STATE,
     .init       = con_init,      .init       = con_init,
     .connect    = con_connect,      .initialise = con_initialise,
     .event      = con_event,      .event      = con_event,
     .disconnect = con_disconnect,      .disconnect = con_disconnect,
 };  };

Removed from v.1.1  
changed lines
  Added in v.1.1.1.4


unix.superglobalmegacorp.com