mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 15:15:46 +00:00
io: Introduce a qio_channel_set_feature() helper
Testing QIOChannel feature support can be done with a helper called qio_channel_has_feature(). Setting feature support, however, was done manually with a logical OR. This patch introduces a new helper called qio_channel_set_feature() and makes use of it where applicable. Signed-off-by: Felipe Franciosi <felipe@nutanix.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
committed by
Daniel P. Berrange
parent
e413ae0c04
commit
d8d3c7cc67
@ -55,7 +55,7 @@ qio_channel_socket_new(void)
|
||||
sioc->fd = -1;
|
||||
|
||||
ioc = QIO_CHANNEL(sioc);
|
||||
ioc->features |= (1 << QIO_CHANNEL_FEATURE_SHUTDOWN);
|
||||
qio_channel_set_feature(ioc, QIO_CHANNEL_FEATURE_SHUTDOWN);
|
||||
|
||||
#ifdef WIN32
|
||||
ioc->event = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
@ -107,12 +107,12 @@ qio_channel_socket_set_fd(QIOChannelSocket *sioc,
|
||||
#ifndef WIN32
|
||||
if (sioc->localAddr.ss_family == AF_UNIX) {
|
||||
QIOChannel *ioc = QIO_CHANNEL(sioc);
|
||||
ioc->features |= (1 << QIO_CHANNEL_FEATURE_FD_PASS);
|
||||
qio_channel_set_feature(ioc, QIO_CHANNEL_FEATURE_FD_PASS);
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
if (getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, &val, &len) == 0 && val) {
|
||||
QIOChannel *ioc = QIO_CHANNEL(sioc);
|
||||
ioc->features |= (1 << QIO_CHANNEL_FEATURE_LISTEN);
|
||||
qio_channel_set_feature(ioc, QIO_CHANNEL_FEATURE_LISTEN);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -380,7 +380,8 @@ qio_channel_socket_accept(QIOChannelSocket *ioc,
|
||||
|
||||
#ifndef WIN32
|
||||
if (cioc->localAddr.ss_family == AF_UNIX) {
|
||||
QIO_CHANNEL(cioc)->features |= (1 << QIO_CHANNEL_FEATURE_FD_PASS);
|
||||
QIOChannel *ioc_local = QIO_CHANNEL(cioc);
|
||||
qio_channel_set_feature(ioc_local, QIO_CHANNEL_FEATURE_FD_PASS);
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
Reference in New Issue
Block a user