From a8d78cd0ab6204b6ee8897e30d0fbb9c8979ddca Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 20 Apr 2018 15:52:42 +0100 Subject: vl.c: Provide accessor function serial_hd() for serial_hds[] array Provide an accessor function serial_hd() to return the Chardev (if any) associated with the numbered serial port. This will be used to replace direct accesses to the serial_hds[] array, so that calling code doesn't need to care about the size of that array. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Tested-by: Philippe Mathieu-Daudé Message-id: 20180420145249.32435-7-peter.maydell@linaro.org --- include/sysemu/sysemu.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 2b42151c63..bd5b55c514 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -163,6 +163,9 @@ void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict); extern Chardev *serial_hds[MAX_SERIAL_PORTS]; +/* Return the Chardev for serial port i, or NULL if none */ +Chardev *serial_hd(int i); + /* parallel ports */ #define MAX_PARALLEL_PORTS 3 -- cgit v1.2.3-55-g7522