Revision fd506b4f hw/char/spapr_vty.c
b/hw/char/spapr_vty.c | ||
---|---|---|
12 | 12 |
uint8_t buf[VTERM_BUFSIZE]; |
13 | 13 |
} VIOsPAPRVTYDevice; |
14 | 14 |
|
15 |
#define TYPE_VIO_SPAPR_VTY_DEVICE "spapr-vty" |
|
16 |
#define VIO_SPAPR_VTY_DEVICE(obj) \ |
|
17 |
OBJECT_CHECK(VIOsPAPRVTYDevice, (obj), TYPE_VIO_SPAPR_VTY_DEVICE) |
|
18 |
|
|
15 | 19 |
static int vty_can_receive(void *opaque) |
16 | 20 |
{ |
17 |
VIOsPAPRVTYDevice *dev = (VIOsPAPRVTYDevice *)opaque;
|
|
21 |
VIOsPAPRVTYDevice *dev = VIO_SPAPR_VTY_DEVICE(opaque);
|
|
18 | 22 |
|
19 | 23 |
return (dev->in - dev->out) < VTERM_BUFSIZE; |
20 | 24 |
} |
21 | 25 |
|
22 | 26 |
static void vty_receive(void *opaque, const uint8_t *buf, int size) |
23 | 27 |
{ |
24 |
VIOsPAPRVTYDevice *dev = (VIOsPAPRVTYDevice *)opaque;
|
|
28 |
VIOsPAPRVTYDevice *dev = VIO_SPAPR_VTY_DEVICE(opaque);
|
|
25 | 29 |
int i; |
26 | 30 |
|
27 | 31 |
if ((dev->in == dev->out) && size) { |
... | ... | |
36 | 40 |
|
37 | 41 |
static int vty_getchars(VIOsPAPRDevice *sdev, uint8_t *buf, int max) |
38 | 42 |
{ |
39 |
VIOsPAPRVTYDevice *dev = (VIOsPAPRVTYDevice *)sdev;
|
|
43 |
VIOsPAPRVTYDevice *dev = VIO_SPAPR_VTY_DEVICE(sdev);
|
|
40 | 44 |
int n = 0; |
41 | 45 |
|
42 | 46 |
while ((n < max) && (dev->out != dev->in)) { |
... | ... | |
48 | 52 |
|
49 | 53 |
void vty_putchars(VIOsPAPRDevice *sdev, uint8_t *buf, int len) |
50 | 54 |
{ |
51 |
VIOsPAPRVTYDevice *dev = (VIOsPAPRVTYDevice *)sdev;
|
|
55 |
VIOsPAPRVTYDevice *dev = VIO_SPAPR_VTY_DEVICE(sdev);
|
|
52 | 56 |
|
53 | 57 |
/* FIXME: should check the qemu_chr_fe_write() return value */ |
54 | 58 |
qemu_chr_fe_write(dev->chardev, buf, len); |
... | ... | |
56 | 60 |
|
57 | 61 |
static int spapr_vty_init(VIOsPAPRDevice *sdev) |
58 | 62 |
{ |
59 |
VIOsPAPRVTYDevice *dev = (VIOsPAPRVTYDevice *)sdev;
|
|
63 |
VIOsPAPRVTYDevice *dev = VIO_SPAPR_VTY_DEVICE(sdev);
|
|
60 | 64 |
|
61 | 65 |
if (!dev->chardev) { |
62 | 66 |
fprintf(stderr, "spapr-vty: Can't create vty without a chardev!\n"); |
... | ... | |
151 | 155 |
} |
152 | 156 |
|
153 | 157 |
static const TypeInfo spapr_vty_info = { |
154 |
.name = "spapr-vty",
|
|
158 |
.name = TYPE_VIO_SPAPR_VTY_DEVICE,
|
|
155 | 159 |
.parent = TYPE_VIO_SPAPR_DEVICE, |
156 | 160 |
.instance_size = sizeof(VIOsPAPRVTYDevice), |
157 | 161 |
.class_init = spapr_vty_class_init, |
... | ... | |
177 | 181 |
continue; |
178 | 182 |
} |
179 | 183 |
|
180 |
sdev = DO_UPCAST(VIOsPAPRDevice, qdev, iter);
|
|
184 |
sdev = VIO_SPAPR_DEVICE(iter);
|
|
181 | 185 |
|
182 | 186 |
/* First VTY we've found, so it is selected for now */ |
183 | 187 |
if (!selected) { |
Also available in: Unified diff