Character device backend patches for 2024-02-12
-----BEGIN PGP SIGNATURE----- iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmXMYY0SHGFybWJydUBy ZWRoYXQuY29tAAoJEDhwtADrkYZTTGYQALEO48lySVjvKEYjUpjFNkwL4sA2wLyp JMUuUresuH2w/a/pornhgW6ICQWLbxXSinfBy7G68/BqFiqxdLEFe7VE0zzg3wXV MNY1SHZDQ6nvREqvpj2uAj5nq1dxqbcAnTbGbJeDWKi2+JtvZ3IO9CA6zLfMDd6D bJpTOoNeGEogFel9enISJteiLJYTRU50Rdn73epSJ8NGoMQja9YoM2sA1VqNuscH sjzNRMfpAboMkkTCPhi3RivQUUzt45zEwRHFy30Gz9YK9BDKmqJbqfhTAiBgsDBk TUqwnoyMQwHZ3xkT46s62Z2qy1uSautJOtnbNpnQlEZgc42T0Kli61+p+iPmKr+H ZxZAKUUtsz7PSBMcnl91VTJZA3+FaWTkm5IPd2bVPuxFtZl0C1EdflsxFY1/3tEy tr3GbIs6DkXpzmf+o8OXm72XTF7DPgDfsdn0K+9dJLO+G/C5r9euWCTeQeW2QR8d PfpuNo9iZcRbp3BS/7zsr6dwdW9jVWPE3U3spORRqjX4eS6B6UMmug54EDdnZaM8 abLDRf2KQuXBD5IazGSQZfC6Kvx2FOqyJD67gWsv0A83sAfhfC+JyIVp67sJPpdf KoXTjPn2jiBfzibrMWxDJiFS8TiYI5jO28BPPERlrWZ+AojHAnY+ytQ1avggZaCU Ypv+CgoMG1gC =bOef -----END PGP SIGNATURE----- Merge tag 'pull-char-2024-02-12-v2' of https://repo.or.cz/qemu/armbru into staging Character device backend patches for 2024-02-12 # -----BEGIN PGP SIGNATURE----- # # iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmXMYY0SHGFybWJydUBy # ZWRoYXQuY29tAAoJEDhwtADrkYZTTGYQALEO48lySVjvKEYjUpjFNkwL4sA2wLyp # JMUuUresuH2w/a/pornhgW6ICQWLbxXSinfBy7G68/BqFiqxdLEFe7VE0zzg3wXV # MNY1SHZDQ6nvREqvpj2uAj5nq1dxqbcAnTbGbJeDWKi2+JtvZ3IO9CA6zLfMDd6D # bJpTOoNeGEogFel9enISJteiLJYTRU50Rdn73epSJ8NGoMQja9YoM2sA1VqNuscH # sjzNRMfpAboMkkTCPhi3RivQUUzt45zEwRHFy30Gz9YK9BDKmqJbqfhTAiBgsDBk # TUqwnoyMQwHZ3xkT46s62Z2qy1uSautJOtnbNpnQlEZgc42T0Kli61+p+iPmKr+H # ZxZAKUUtsz7PSBMcnl91VTJZA3+FaWTkm5IPd2bVPuxFtZl0C1EdflsxFY1/3tEy # tr3GbIs6DkXpzmf+o8OXm72XTF7DPgDfsdn0K+9dJLO+G/C5r9euWCTeQeW2QR8d # PfpuNo9iZcRbp3BS/7zsr6dwdW9jVWPE3U3spORRqjX4eS6B6UMmug54EDdnZaM8 # abLDRf2KQuXBD5IazGSQZfC6Kvx2FOqyJD67gWsv0A83sAfhfC+JyIVp67sJPpdf # KoXTjPn2jiBfzibrMWxDJiFS8TiYI5jO28BPPERlrWZ+AojHAnY+ytQ1avggZaCU # Ypv+CgoMG1gC # =bOef # -----END PGP SIGNATURE----- # gpg: Signature made Wed 14 Feb 2024 06:45:33 GMT # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "armbru@redhat.com" # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full] # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * tag 'pull-char-2024-02-12-v2' of https://repo.or.cz/qemu/armbru: qapi/char: Deprecate backend type "memory" qapi/char: Make backend types properly conditional tests/unit/test-char: Fix qemu_socket(), make_udp_socket() check chardev/parallel: Don't close stdin on inappropriate device Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
708322660e
@ -164,13 +164,13 @@ static void qemu_chr_open_pp_fd(Chardev *chr,
|
|||||||
{
|
{
|
||||||
ParallelChardev *drv = PARALLEL_CHARDEV(chr);
|
ParallelChardev *drv = PARALLEL_CHARDEV(chr);
|
||||||
|
|
||||||
|
drv->fd = fd;
|
||||||
|
|
||||||
if (ioctl(fd, PPCLAIM) < 0) {
|
if (ioctl(fd, PPCLAIM) < 0) {
|
||||||
error_setg_errno(errp, errno, "not a parallel port");
|
error_setg_errno(errp, errno, "not a parallel port");
|
||||||
close(fd);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
drv->fd = fd;
|
|
||||||
drv->mode = IEEE1284_MODE_COMPAT;
|
drv->mode = IEEE1284_MODE_COMPAT;
|
||||||
}
|
}
|
||||||
#endif /* __linux__ */
|
#endif /* __linux__ */
|
||||||
@ -238,6 +238,7 @@ static void qemu_chr_open_pp_fd(Chardev *chr,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_CHARDEV_PARALLEL
|
||||||
static void qmp_chardev_open_parallel(Chardev *chr,
|
static void qmp_chardev_open_parallel(Chardev *chr,
|
||||||
ChardevBackend *backend,
|
ChardevBackend *backend,
|
||||||
bool *be_opened,
|
bool *be_opened,
|
||||||
@ -306,3 +307,5 @@ static void register_types(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
type_init(register_types);
|
type_init(register_types);
|
||||||
|
|
||||||
|
#endif /* HAVE_CHARDEV_PARALLEL */
|
||||||
|
@ -21,11 +21,9 @@ if host_os == 'windows'
|
|||||||
else
|
else
|
||||||
chardev_ss.add(files(
|
chardev_ss.add(files(
|
||||||
'char-fd.c',
|
'char-fd.c',
|
||||||
|
'char-parallel.c',
|
||||||
'char-pty.c',
|
'char-pty.c',
|
||||||
), util)
|
), util)
|
||||||
if host_os in ['linux', 'gnu/kfreebsd', 'freebsd', 'dragonfly']
|
|
||||||
chardev_ss.add(files('char-parallel.c'))
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
chardev_ss = chardev_ss.apply({})
|
chardev_ss = chardev_ss.apply({})
|
||||||
|
@ -387,6 +387,14 @@ Specifying the iSCSI password in plain text on the command line using the
|
|||||||
used instead, to refer to a ``--object secret...`` instance that provides
|
used instead, to refer to a ``--object secret...`` instance that provides
|
||||||
a password via a file, or encrypted.
|
a password via a file, or encrypted.
|
||||||
|
|
||||||
|
Character device options
|
||||||
|
''''''''''''''''''''''''
|
||||||
|
|
||||||
|
Backend ``memory`` (since 9.0)
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
``memory`` is a deprecated synonym for ``ringbuf``.
|
||||||
|
|
||||||
CPU device properties
|
CPU device properties
|
||||||
'''''''''''''''''''''
|
'''''''''''''''''''''
|
||||||
|
|
||||||
|
@ -508,11 +508,18 @@ void qemu_anon_ram_free(void *ptr, size_t size);
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define HAVE_CHARDEV_SERIAL 1
|
#define HAVE_CHARDEV_SERIAL 1
|
||||||
#elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \
|
#define HAVE_CHARDEV_PARALLEL 1
|
||||||
|
#else
|
||||||
|
#if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \
|
||||||
|| defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) \
|
|| defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) \
|
||||||
|| defined(__GLIBC__) || defined(__APPLE__)
|
|| defined(__GLIBC__) || defined(__APPLE__)
|
||||||
#define HAVE_CHARDEV_SERIAL 1
|
#define HAVE_CHARDEV_SERIAL 1
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__linux__) || defined(__FreeBSD__) \
|
||||||
|
|| defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||||
|
#define HAVE_CHARDEV_PARALLEL 1
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__HAIKU__)
|
#if defined(__HAIKU__)
|
||||||
#define SIGIO SIGPOLL
|
#define SIGIO SIGPOLL
|
||||||
|
@ -468,12 +468,16 @@
|
|||||||
#
|
#
|
||||||
# @memory: Since 1.5
|
# @memory: Since 1.5
|
||||||
#
|
#
|
||||||
|
# Features:
|
||||||
|
#
|
||||||
|
# @deprecated: Member @memory is deprecated. Use @ringbuf instead.
|
||||||
|
#
|
||||||
# Since: 1.4
|
# Since: 1.4
|
||||||
##
|
##
|
||||||
{ 'enum': 'ChardevBackendKind',
|
{ 'enum': 'ChardevBackendKind',
|
||||||
'data': [ 'file',
|
'data': [ 'file',
|
||||||
'serial',
|
{ 'name': 'serial', 'if': 'HAVE_CHARDEV_SERIAL' },
|
||||||
'parallel',
|
{ 'name': 'parallel', 'if': 'HAVE_CHARDEV_PARALLEL' },
|
||||||
'pipe',
|
'pipe',
|
||||||
'socket',
|
'socket',
|
||||||
'udp',
|
'udp',
|
||||||
@ -482,18 +486,17 @@
|
|||||||
'mux',
|
'mux',
|
||||||
'msmouse',
|
'msmouse',
|
||||||
'wctablet',
|
'wctablet',
|
||||||
'braille',
|
{ 'name': 'braille', 'if': 'CONFIG_BRLAPI' },
|
||||||
'testdev',
|
'testdev',
|
||||||
'stdio',
|
'stdio',
|
||||||
'console',
|
{ 'name': 'console', 'if': 'CONFIG_WIN32' },
|
||||||
{ 'name': 'spicevmc', 'if': 'CONFIG_SPICE' },
|
{ 'name': 'spicevmc', 'if': 'CONFIG_SPICE' },
|
||||||
{ 'name': 'spiceport', 'if': 'CONFIG_SPICE' },
|
{ 'name': 'spiceport', 'if': 'CONFIG_SPICE' },
|
||||||
{ 'name': 'qemu-vdagent', 'if': 'CONFIG_SPICE_PROTOCOL' },
|
{ 'name': 'qemu-vdagent', 'if': 'CONFIG_SPICE_PROTOCOL' },
|
||||||
{ 'name': 'dbus', 'if': 'CONFIG_DBUS_DISPLAY' },
|
{ 'name': 'dbus', 'if': 'CONFIG_DBUS_DISPLAY' },
|
||||||
'vc',
|
'vc',
|
||||||
'ringbuf',
|
'ringbuf',
|
||||||
# next one is just for compatibility
|
{ 'name': 'memory', 'features': [ 'deprecated' ] } ] }
|
||||||
'memory' ] }
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# @ChardevFileWrapper:
|
# @ChardevFileWrapper:
|
||||||
@ -642,8 +645,10 @@
|
|||||||
'base': { 'type': 'ChardevBackendKind' },
|
'base': { 'type': 'ChardevBackendKind' },
|
||||||
'discriminator': 'type',
|
'discriminator': 'type',
|
||||||
'data': { 'file': 'ChardevFileWrapper',
|
'data': { 'file': 'ChardevFileWrapper',
|
||||||
'serial': 'ChardevHostdevWrapper',
|
'serial': { 'type': 'ChardevHostdevWrapper',
|
||||||
'parallel': 'ChardevHostdevWrapper',
|
'if': 'HAVE_CHARDEV_SERIAL' },
|
||||||
|
'parallel': { 'type': 'ChardevHostdevWrapper',
|
||||||
|
'if': 'HAVE_CHARDEV_PARALLEL' },
|
||||||
'pipe': 'ChardevHostdevWrapper',
|
'pipe': 'ChardevHostdevWrapper',
|
||||||
'socket': 'ChardevSocketWrapper',
|
'socket': 'ChardevSocketWrapper',
|
||||||
'udp': 'ChardevUdpWrapper',
|
'udp': 'ChardevUdpWrapper',
|
||||||
@ -652,10 +657,12 @@
|
|||||||
'mux': 'ChardevMuxWrapper',
|
'mux': 'ChardevMuxWrapper',
|
||||||
'msmouse': 'ChardevCommonWrapper',
|
'msmouse': 'ChardevCommonWrapper',
|
||||||
'wctablet': 'ChardevCommonWrapper',
|
'wctablet': 'ChardevCommonWrapper',
|
||||||
'braille': 'ChardevCommonWrapper',
|
'braille': { 'type': 'ChardevCommonWrapper',
|
||||||
|
'if': 'CONFIG_BRLAPI' },
|
||||||
'testdev': 'ChardevCommonWrapper',
|
'testdev': 'ChardevCommonWrapper',
|
||||||
'stdio': 'ChardevStdioWrapper',
|
'stdio': 'ChardevStdioWrapper',
|
||||||
'console': 'ChardevCommonWrapper',
|
'console': { 'type': 'ChardevCommonWrapper',
|
||||||
|
'if': 'CONFIG_WIN32' },
|
||||||
'spicevmc': { 'type': 'ChardevSpiceChannelWrapper',
|
'spicevmc': { 'type': 'ChardevSpiceChannelWrapper',
|
||||||
'if': 'CONFIG_SPICE' },
|
'if': 'CONFIG_SPICE' },
|
||||||
'spiceport': { 'type': 'ChardevSpicePortWrapper',
|
'spiceport': { 'type': 'ChardevSpicePortWrapper',
|
||||||
@ -666,7 +673,6 @@
|
|||||||
'if': 'CONFIG_DBUS_DISPLAY' },
|
'if': 'CONFIG_DBUS_DISPLAY' },
|
||||||
'vc': 'ChardevVCWrapper',
|
'vc': 'ChardevVCWrapper',
|
||||||
'ringbuf': 'ChardevRingbufWrapper',
|
'ringbuf': 'ChardevRingbufWrapper',
|
||||||
# next one is just for compatibility
|
|
||||||
'memory': 'ChardevRingbufWrapper' } }
|
'memory': 'ChardevRingbufWrapper' } }
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -556,7 +556,7 @@ static int make_udp_socket(int *port)
|
|||||||
socklen_t alen = sizeof(addr);
|
socklen_t alen = sizeof(addr);
|
||||||
int ret, sock = qemu_socket(PF_INET, SOCK_DGRAM, 0);
|
int ret, sock = qemu_socket(PF_INET, SOCK_DGRAM, 0);
|
||||||
|
|
||||||
g_assert_cmpint(sock, >, 0);
|
g_assert_cmpint(sock, >=, 0);
|
||||||
addr.sin_family = AF_INET ;
|
addr.sin_family = AF_INET ;
|
||||||
addr.sin_addr.s_addr = htonl(INADDR_ANY);
|
addr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||||
addr.sin_port = 0;
|
addr.sin_port = 0;
|
||||||
@ -1203,6 +1203,30 @@ static void char_serial_test(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_CHARDEV_PARALLEL) && !defined(WIN32)
|
||||||
|
static void char_parallel_test(void)
|
||||||
|
{
|
||||||
|
QemuOpts *opts;
|
||||||
|
Chardev *chr;
|
||||||
|
|
||||||
|
opts = qemu_opts_create(qemu_find_opts("chardev"), "parallel-id",
|
||||||
|
1, &error_abort);
|
||||||
|
qemu_opt_set(opts, "backend", "parallel", &error_abort);
|
||||||
|
qemu_opt_set(opts, "path", "/dev/null", &error_abort);
|
||||||
|
|
||||||
|
chr = qemu_chr_new_from_opts(opts, NULL, NULL);
|
||||||
|
#ifdef __linux__
|
||||||
|
/* fails to PPCLAIM, see qemu_chr_open_pp_fd() */
|
||||||
|
g_assert_null(chr);
|
||||||
|
#else
|
||||||
|
g_assert_nonnull(chr);
|
||||||
|
object_unparent(OBJECT(chr));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
qemu_opts_del(opts);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
static void char_file_fifo_test(void)
|
static void char_file_fifo_test(void)
|
||||||
{
|
{
|
||||||
@ -1383,7 +1407,7 @@ static void char_hotswap_test(void)
|
|||||||
|
|
||||||
int port;
|
int port;
|
||||||
int sock = make_udp_socket(&port);
|
int sock = make_udp_socket(&port);
|
||||||
g_assert_cmpint(sock, >, 0);
|
g_assert_cmpint(sock, >=, 0);
|
||||||
|
|
||||||
chr_args = g_strdup_printf("udp:127.0.0.1:%d", port);
|
chr_args = g_strdup_printf("udp:127.0.0.1:%d", port);
|
||||||
|
|
||||||
@ -1544,6 +1568,9 @@ int main(int argc, char **argv)
|
|||||||
g_test_add_func("/char/udp", char_udp_test);
|
g_test_add_func("/char/udp", char_udp_test);
|
||||||
#if defined(HAVE_CHARDEV_SERIAL) && !defined(WIN32)
|
#if defined(HAVE_CHARDEV_SERIAL) && !defined(WIN32)
|
||||||
g_test_add_func("/char/serial", char_serial_test);
|
g_test_add_func("/char/serial", char_serial_test);
|
||||||
|
#endif
|
||||||
|
#if defined(HAVE_CHARDEV_PARALLEL) && !defined(WIN32)
|
||||||
|
g_test_add_func("/char/parallel", char_parallel_test);
|
||||||
#endif
|
#endif
|
||||||
g_test_add_func("/char/hotswap", char_hotswap_test);
|
g_test_add_func("/char/hotswap", char_hotswap_test);
|
||||||
g_test_add_func("/char/websocket", char_websock_test);
|
g_test_add_func("/char/websocket", char_websock_test);
|
||||||
|
Loading…
Reference in New Issue
Block a user