aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-04-20 15:52:42 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-04-26 13:57:00 +0100
commita8d78cd0ab6204b6ee8897e30d0fbb9c8979ddca (patch)
tree719affc6a1da412235d02a233aac64aaf6bda1c6 /vl.c
parentb82fcd30325815254eea7197337b3e15e0a46938 (diff)
downloadqemu-a8d78cd0ab6204b6ee8897e30d0fbb9c8979ddca.zip
qemu-a8d78cd0ab6204b6ee8897e30d0fbb9c8979ddca.tar.gz
qemu-a8d78cd0ab6204b6ee8897e30d0fbb9c8979ddca.tar.bz2
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 <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 20180420145249.32435-7-peter.maydell@linaro.org
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/vl.c b/vl.c
index fce1fd1..6daf026 100644
--- a/vl.c
+++ b/vl.c
@@ -2516,6 +2516,15 @@ static int serial_parse(const char *devname)
return 0;
}
+Chardev *serial_hd(int i)
+{
+ assert(i >= 0);
+ if (i < ARRAY_SIZE(serial_hds)) {
+ return serial_hds[i];
+ }
+ return NULL;
+}
+
static int parallel_parse(const char *devname)
{
static int index = 0;