Revision 160600fd

b/hw/virtio-serial-bus.c
204 204
{
205 205
    struct VirtIOSerialPort *port;
206 206
    struct virtio_console_control cpkt, *gcpkt;
207
    uint8_t *buffer;
208
    size_t buffer_len;
207 209

  
208 210
    gcpkt = buf;
209 211
    port = find_port_by_id(vser, ldl_p(&gcpkt->id));
......
226 228
            send_control_event(port, VIRTIO_CONSOLE_CONSOLE_PORT, 1);
227 229
        }
228 230

  
231
        if (port->name) {
232
            stw_p(&cpkt.event, VIRTIO_CONSOLE_PORT_NAME);
233
            stw_p(&cpkt.value, 1);
234

  
235
            buffer_len = sizeof(cpkt) + strlen(port->name) + 1;
236
            buffer = qemu_malloc(buffer_len);
237

  
238
            memcpy(buffer, &cpkt, sizeof(cpkt));
239
            memcpy(buffer + sizeof(cpkt), port->name, strlen(port->name));
240
            buffer[buffer_len - 1] = 0;
241

  
242
            send_control_msg(port, buffer, buffer_len);
243
            qemu_free(buffer);
244
        }
245

  
229 246
        if (port->host_connected) {
230 247
            send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN, 1);
231 248
        }
b/hw/virtio-serial.c
100 100
    .qdev.props = (Property[]) {
101 101
        DEFINE_PROP_UINT8("is_console", VirtConsole, port.is_console, 1),
102 102
        DEFINE_PROP_CHR("chardev", VirtConsole, chr),
103
        DEFINE_PROP_STRING("name", VirtConsole, port.name),
103 104
        DEFINE_PROP_END_OF_LIST(),
104 105
    },
105 106
};
b/hw/virtio-serial.h
50 50
#define VIRTIO_CONSOLE_CONSOLE_PORT	1
51 51
#define VIRTIO_CONSOLE_RESIZE		2
52 52
#define VIRTIO_CONSOLE_PORT_OPEN	3
53
#define VIRTIO_CONSOLE_PORT_NAME	4
53 54

  
54 55
/* == In-qemu interface == */
55 56

  
......
84 85
    VirtQueue *ivq, *ovq;
85 86

  
86 87
    /*
88
     * This name is sent to the guest and exported via sysfs.
89
     * The guest could create symlinks based on this information.
90
     * The name is in the reverse fqdn format, like org.qemu.console.0
91
     */
92
    char *name;
93

  
94
    /*
87 95
     * This id helps identify ports between the guest and the host.
88 96
     * The guest sends a "header" with this id with each data packet
89 97
     * that it sends and the host can then find out which associated

Also available in: Unified diff