mirror of https://github.com/xemu-project/xemu.git
hw/char: QOM'ify sclpconsole.c
Drop the DO_UPCAST macro Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com> Message-Id: <1459237645-17227-7-git-send-email-zxq_yx_007@163.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
This commit is contained in:
parent
e563c59b6a
commit
3f6ec642ae
|
@ -40,6 +40,10 @@ typedef struct SCLPConsole {
|
||||||
bool notify; /* qemu_notify_event() req'd if true */
|
bool notify; /* qemu_notify_event() req'd if true */
|
||||||
} SCLPConsole;
|
} SCLPConsole;
|
||||||
|
|
||||||
|
#define TYPE_SCLP_CONSOLE "sclpconsole"
|
||||||
|
#define SCLP_CONSOLE(obj) \
|
||||||
|
OBJECT_CHECK(SCLPConsole, (obj), TYPE_SCLP_CONSOLE)
|
||||||
|
|
||||||
/* character layer call-back functions */
|
/* character layer call-back functions */
|
||||||
|
|
||||||
/* Return number of bytes that fit into iov buffer */
|
/* Return number of bytes that fit into iov buffer */
|
||||||
|
@ -95,7 +99,7 @@ static unsigned int receive_mask(void)
|
||||||
static void get_console_data(SCLPEvent *event, uint8_t *buf, size_t *size,
|
static void get_console_data(SCLPEvent *event, uint8_t *buf, size_t *size,
|
||||||
int avail)
|
int avail)
|
||||||
{
|
{
|
||||||
SCLPConsole *cons = DO_UPCAST(SCLPConsole, event, event);
|
SCLPConsole *cons = SCLP_CONSOLE(event);
|
||||||
|
|
||||||
/* first byte is hex 0 saying an ascii string follows */
|
/* first byte is hex 0 saying an ascii string follows */
|
||||||
*buf++ = '\0';
|
*buf++ = '\0';
|
||||||
|
@ -157,7 +161,7 @@ static int read_event_data(SCLPEvent *event, EventBufferHeader *evt_buf_hdr,
|
||||||
static ssize_t write_console_data(SCLPEvent *event, const uint8_t *buf,
|
static ssize_t write_console_data(SCLPEvent *event, const uint8_t *buf,
|
||||||
size_t len)
|
size_t len)
|
||||||
{
|
{
|
||||||
SCLPConsole *scon = DO_UPCAST(SCLPConsole, event, event);
|
SCLPConsole *scon = SCLP_CONSOLE(event);
|
||||||
|
|
||||||
if (!scon->chr) {
|
if (!scon->chr) {
|
||||||
/* If there's no backend, we can just say we consumed all data. */
|
/* If there's no backend, we can just say we consumed all data. */
|
||||||
|
@ -214,7 +218,7 @@ static int console_init(SCLPEvent *event)
|
||||||
{
|
{
|
||||||
static bool console_available;
|
static bool console_available;
|
||||||
|
|
||||||
SCLPConsole *scon = DO_UPCAST(SCLPConsole, event, event);
|
SCLPConsole *scon = SCLP_CONSOLE(event);
|
||||||
|
|
||||||
if (console_available) {
|
if (console_available) {
|
||||||
error_report("Multiple VT220 operator consoles are not supported");
|
error_report("Multiple VT220 operator consoles are not supported");
|
||||||
|
@ -232,7 +236,7 @@ static int console_init(SCLPEvent *event)
|
||||||
static void console_reset(DeviceState *dev)
|
static void console_reset(DeviceState *dev)
|
||||||
{
|
{
|
||||||
SCLPEvent *event = SCLP_EVENT(dev);
|
SCLPEvent *event = SCLP_EVENT(dev);
|
||||||
SCLPConsole *scon = DO_UPCAST(SCLPConsole, event, event);
|
SCLPConsole *scon = SCLP_CONSOLE(event);
|
||||||
|
|
||||||
event->event_pending = false;
|
event->event_pending = false;
|
||||||
scon->iov_sclp = 0;
|
scon->iov_sclp = 0;
|
||||||
|
|
Loading…
Reference in New Issue