sigaction(SIGINT, &act, NULL);
}
#endif
- chr = qemu_chr_new_noreplay("gdb", device, NULL);
+ chr = qemu_chr_new_noreplay("gdb", device);
if (!chr)
return -1;
if (opts == NULL) {
error_setg(&err, "Parsing chardev args failed");
} else {
- qemu_chr_new_from_opts(opts, NULL, &err);
+ qemu_chr_new_from_opts(opts, &err);
qemu_opts_del(opts);
}
hmp_handle_error(mon, &err);
if (!chr) {
char label[20];
snprintf(label, sizeof(label), "imx31.uart%d", i);
- chr = qemu_chr_new(label, "null", NULL);
+ chr = qemu_chr_new(label, "null");
}
qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", chr);
if (!chr) {
char label[20];
snprintf(label, sizeof(label), "imx31.uart%d", i);
- chr = qemu_chr_new(label, "null", NULL);
+ chr = qemu_chr_new(label, "null");
}
qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", chr);
if (!chr) {
char *label = g_strdup_printf("imx6.uart%d", i + 1);
- chr = qemu_chr_new(label, "null", NULL);
+ chr = qemu_chr_new(label, "null");
g_free(label);
serial_hds[i] = chr;
}
s->irq = irq;
omap_sti_reset(s);
- s->chr = chr ?: qemu_chr_new("null", "null", NULL);
+ s->chr = chr ?: qemu_chr_new("null", "null");
memory_region_init_io(&s->iomem, NULL, &omap_sti_ops, s, "omap.sti",
omap_l4_region_size(ta, 0));
chr = serial_hds[channel];
if (!chr) {
snprintf(label, ARRAY_SIZE(label), "%s%d", chr_name, channel);
- chr = qemu_chr_new(label, "null", NULL);
+ chr = qemu_chr_new(label, "null");
if (!(chr)) {
error_report("Can't assign serial port to UART%d", channel);
exit(1);
s->irq = irq;
s->serial = serial_mm_init(get_system_memory(), base, 2, irq,
omap_clk_getrate(fclk)/16,
- chr ?: qemu_chr_new(label, "null", NULL),
+ chr ?: qemu_chr_new(label, "null"),
DEVICE_NATIVE_ENDIAN);
return s;
}
/* TODO: Should reuse or destroy current s->serial */
s->serial = serial_mm_init(get_system_memory(), s->base, 2, s->irq,
omap_clk_getrate(s->fclk) / 16,
- chr ?: qemu_chr_new("null", "null", NULL),
+ chr ?: qemu_chr_new("null", "null"),
DEVICE_NATIVE_ENDIAN);
}
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);
+ con->chr = qemu_chr_new(label, output);
}
xenstore_store_pv_console_info(con->xendev.dev, con->chr);
/* FIXME use a qdev chardev prop instead of parallel_hds[] */
chr = parallel_hds[0];
if (chr == NULL) {
- chr = qemu_chr_new("par0", "null", NULL);
+ chr = qemu_chr_new("par0", "null");
}
isa = isa_create(bus, "isa-parallel");
d = DEVICE(isa);
chr = serial_hds[i];
if (chr == NULL) {
snprintf(name, sizeof(name), "ser%d", i);
- chr = qemu_chr_new(name, "null", NULL);
+ chr = qemu_chr_new(name, "null");
}
isa = isa_create(bus, "isa-serial");
d = DEVICE(isa);
memory_region_add_subregion(address_space, base, &s->iomem_lo);
memory_region_add_subregion(address_space, base + 0xa00, &s->iomem_hi);
- s->display = qemu_chr_new("fpga", "vc:320x200", NULL);
+ s->display = qemu_chr_new("fpga", "vc:320x200");
qemu_chr_add_handlers(s->display, NULL, NULL,
malta_fgpa_display_event, s);
if (!serial_hds[i]) {
char label[32];
snprintf(label, sizeof(label), "serial%d", i);
- serial_hds[i] = qemu_chr_new(label, "null", NULL);
+ serial_hds[i] = qemu_chr_new(label, "null");
}
}
filename++;
snprintf(label, sizeof(label), "usbserial%d", index++);
- cdrv = qemu_chr_new(label, filename, NULL);
+ cdrv = qemu_chr_new(label, filename);
if (!cdrv)
return NULL;
USBDevice *dev;
CharDriverState *cdrv;
- cdrv = qemu_chr_new("braille", "braille", NULL);
+ cdrv = qemu_chr_new("braille", "braille");
if (!cdrv)
return NULL;
}
if (!serial_hds[0]) {
- serial_hds[0] = qemu_chr_new("serial0", "null", NULL);
+ serial_hds[0] = qemu_chr_new("serial0", "null");
}
serial_mm_init(system_io, 0x0d050020, 2, xtensa_get_extint(env, 0),
struct CharDriverState {
QemuMutex chr_write_lock;
- void (*init)(struct CharDriverState *s);
int (*chr_write)(struct CharDriverState *s, const uint8_t *buf, int len);
int (*chr_sync_read)(struct CharDriverState *s,
const uint8_t *buf, int len);
* 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),
- Error **errp);
+ Error **errp);
/**
* @qemu_chr_parse_common:
*
* @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));
+CharDriverState *qemu_chr_new(const char *label, const char *filename);
/**
* @qemu_chr_disconnect:
*
*
* @label the name of the backend
* @filename the URI
- * @init not sure..
*
* Returns: a new character backend
*/
-CharDriverState *qemu_chr_new_noreplay(const char *label, const char *filename,
- void (*init)(struct CharDriverState *s));
+CharDriverState *qemu_chr_new_noreplay(const char *label, const char *filename);
/**
* @qemu_chr_delete:
}
} else {
fwd = g_new(struct GuestFwd, 1);
- fwd->hd = qemu_chr_new(buf, p, NULL);
+ fwd->hd = qemu_chr_new(buf, p);
if (!fwd->hd) {
error_report("could not open guest forwarding device '%s'", buf);
g_free(fwd);
}
CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts,
- void (*init)(struct CharDriverState *s),
- Error **errp)
+ Error **errp)
{
Error *local_err = NULL;
CharDriver *cd;
return NULL;
}
-CharDriverState *qemu_chr_new_noreplay(const char *label, const char *filename,
- void (*init)(struct CharDriverState *s))
+CharDriverState *qemu_chr_new_noreplay(const char *label, const char *filename)
{
const char *p;
CharDriverState *chr;
if (!opts)
return NULL;
- chr = qemu_chr_new_from_opts(opts, init, &err);
+ chr = qemu_chr_new_from_opts(opts, &err);
if (err) {
error_report_err(err);
}
return chr;
}
-CharDriverState *qemu_chr_new(const char *label, const char *filename, void (*init)(struct CharDriverState *s))
+CharDriverState *qemu_chr_new(const char *label, const char *filename)
{
CharDriverState *chr;
- chr = qemu_chr_new_noreplay(label, filename, init);
+ chr = qemu_chr_new_noreplay(label, filename);
if (chr) {
chr->replay = replay_mode != REPLAY_MODE_NONE;
if (chr->replay && chr->chr_ioctl) {
{
CharDriverState *chr;
- chr = qemu_chr_new("qtest", qtest_chrdev, NULL);
+ chr = qemu_chr_new("qtest", qtest_chrdev);
if (chr == NULL) {
error_setg(errp, "Failed to initialize device for qtest: \"%s\"",
gchar *chr_path;
chr_path = g_strdup_printf("unix:%s%s", server->socket_path, opt);
- server->chr = qemu_chr_new(server->chr_name, chr_path, NULL);
+ server->chr = qemu_chr_new(server->chr_name, chr_path);
g_free(chr_path);
qemu_chr_add_handlers(server->chr, chr_can_read, chr_read,
}
qemu_chr_be_generic_open(chr);
- if (chr->init)
- chr->init(chr);
}
static CharDriverState *text_console_init(ChardevVC *vc, Error **errp)
gtk_label_new(vc->label));
qemu_chr_be_generic_open(vc->vte.chr);
- if (vc->vte.chr->init) {
- vc->vte.chr->init(vc->vte.chr);
- }
return group;
}
{
Error *local_err = NULL;
- qemu_chr_new_from_opts(opts, NULL, &local_err);
+ qemu_chr_new_from_opts(opts, &local_err);
if (local_err) {
error_report_err(local_err);
return -1;
exit(1);
}
snprintf(label, sizeof(label), "serial%d", index);
- serial_hds[index] = qemu_chr_new(label, devname, NULL);
+ serial_hds[index] = qemu_chr_new(label, devname);
if (!serial_hds[index]) {
error_report("could not connect serial device"
" to character backend '%s'", devname);
exit(1);
}
snprintf(label, sizeof(label), "parallel%d", index);
- parallel_hds[index] = qemu_chr_new(label, devname, NULL);
+ parallel_hds[index] = qemu_chr_new(label, devname);
if (!parallel_hds[index]) {
error_report("could not connect parallel device"
" to character backend '%s'", devname);
qemu_opt_set(dev_opts, "driver", "virtconsole", &error_abort);
snprintf(label, sizeof(label), "virtcon%d", index);
- virtcon_hds[index] = qemu_chr_new(label, devname, NULL);
+ virtcon_hds[index] = qemu_chr_new(label, devname);
if (!virtcon_hds[index]) {
error_report("could not connect virtio console"
" to character backend '%s'", devname);
qemu_opt_set(dev_opts, "driver", "sclpconsole", &error_abort);
snprintf(label, sizeof(label), "sclpcon%d", index);
- sclp_hds[index] = qemu_chr_new(label, devname, NULL);
+ sclp_hds[index] = qemu_chr_new(label, devname);
if (!sclp_hds[index]) {
error_report("could not connect sclp console"
" to character backend '%s'", devname);
{
QemuOpts *opts;
- if (!qemu_chr_new("debugcon", devname, NULL)) {
+ if (!qemu_chr_new("debugcon", devname)) {
exit(1);
}
opts = qemu_opts_create(qemu_find_opts("device"), "debugcon", 1, NULL);