diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2022-12-19 10:17:09 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2023-01-11 10:44:33 +0100 |
commit | 1baf34a1369ed323717c215d69bb6261b89cb5d7 (patch) | |
tree | 3c2805f0aa33568c951eec8f22261a186200e9cb /chardev | |
parent | c0a6665c3c4d63b113ab31c624c53d4a32de2926 (diff) |
chardev: clean up chardev-parallel.c
Replace HAVE_CHARDEV_PARPORT with a Meson conditional, remove unnecessary
defines, and close the file descriptor on FreeBSD/DragonFly.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'chardev')
-rw-r--r-- | chardev/char-parallel.c | 15 | ||||
-rw-r--r-- | chardev/meson.build | 5 |
2 files changed, 6 insertions, 14 deletions
diff --git a/chardev/char-parallel.c b/chardev/char-parallel.c index 05e7efbd6c..a5164f975a 100644 --- a/chardev/char-parallel.c +++ b/chardev/char-parallel.c @@ -238,7 +238,6 @@ static void qemu_chr_open_pp_fd(Chardev *chr, } #endif -#ifdef HAVE_CHARDEV_PARPORT static void qmp_chardev_open_parallel(Chardev *chr, ChardevBackend *backend, bool *be_opened, @@ -276,29 +275,21 @@ static void char_parallel_class_init(ObjectClass *oc, void *data) cc->parse = qemu_chr_parse_parallel; cc->open = qmp_chardev_open_parallel; -#if defined(__linux__) - cc->chr_ioctl = pp_ioctl; -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ - defined(__DragonFly__) cc->chr_ioctl = pp_ioctl; -#endif } static void char_parallel_finalize(Object *obj) { -#if defined(__linux__) Chardev *chr = CHARDEV(obj); ParallelChardev *drv = PARALLEL_CHARDEV(chr); int fd = drv->fd; +#if defined(__linux__) pp_hw_mode(drv, IEEE1284_MODE_COMPAT); ioctl(fd, PPRELEASE); +#endif close(fd); qemu_chr_be_event(chr, CHR_EVENT_CLOSED); -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ - defined(__DragonFly__) - /* FIXME: close fd? */ -#endif } static const TypeInfo char_parallel_type_info = { @@ -315,5 +306,3 @@ static void register_types(void) } type_init(register_types); - -#endif diff --git a/chardev/meson.build b/chardev/meson.build index 664f77b887..789b50056a 100644 --- a/chardev/meson.build +++ b/chardev/meson.build @@ -14,9 +14,12 @@ chardev_ss.add(files( )) chardev_ss.add(when: 'CONFIG_POSIX', if_true: [files( 'char-fd.c', - 'char-parallel.c', 'char-pty.c', ), util]) +if targetos in ['linux', 'gnu/kfreebsd', 'freebsd', 'dragonfly'] + chardev_ss.add(files('char-parallel.c')) +endif + chardev_ss.add(when: 'CONFIG_WIN32', if_true: files( 'char-console.c', 'char-win-stdio.c', |