ssize_t qio_channel_write(QIOChannel *ioc, const char *buf, size_t buflen, Error **errp) { struct iovec iov = { .iov_base = (char *)buf, .iov_len = buflen }; return qio_channel_writev_full(ioc, &iov, 1, NULL, 0, errp); } int qio_channel_read_all_eof(QIOChannel *ioc, char *buf, size_t buflen, Error **errp) { struct iovec iov = { .iov_base = buf, .iov_len = buflen }; return qio_channel_readv_all_eof(ioc, &iov, 1, errp); } int qio_channel_read_all(QIOChannel *ioc, char *buf, size_t buflen, Error **errp) { struct iovec iov = { .iov_base = buf, .iov_len = buflen }; return qio_channel_readv_all(ioc, &iov, 1, errp); } int qio_channel_write_all(QIOChannel *ioc, const char *buf, size_t buflen, Error **errp) { struct iovec iov = { .iov_base = (char *)buf, .iov_len = buflen }; return qio_channel_writev_all(ioc, &iov, 1, errp); } int qio_channel_set_blocking(QIOChannel *ioc, bool enabled, Error **errp) { QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); return klass->io_set_blocking(ioc, enabled, errp); } int qio_channel_close(QIOChannel *ioc, Error **errp) { QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); return klass->io_close(ioc, errp); }
void qio_channel_set_cork(QIOChannel *ioc, bool enabled) { QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); if (klass->io_set_cork) { klass->io_set_cork(ioc, enabled); } }
void qio_channel_set_aio_fd_handler(QIOChannel *ioc, AioContext *ctx, IOHandler *io_read, IOHandler *io_write, void *opaque) { QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); klass->io_set_aio_fd_handler(ioc, ctx, io_read, io_write, opaque); }
GSource *qio_channel_create_watch(QIOChannel *ioc, GIOCondition condition) { QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); GSource *ret = klass->io_create_watch(ioc, condition); if (ioc->name) { g_source_set_name(ret, ioc->name); } return ret; }
int qio_channel_shutdown(QIOChannel *ioc, QIOChannelShutdown how, Error **errp) { QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); if (!klass->io_shutdown) { error_setg(errp, "Data path shutdown not supported"); return -1; } return klass->io_shutdown(ioc, how, errp); }
off_t qio_channel_io_seek(QIOChannel *ioc, off_t offset, int whence, Error **errp) { QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); if (!klass->io_seek) { error_setg(errp, "Channel does not support random access"); return -1; } return klass->io_seek(ioc, offset, whence, errp); }
ssize_t qio_channel_writev_full(QIOChannel *ioc, const struct iovec *iov, size_t niov, int *fds, size_t nfds, Error **errp) { QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); if ((fds || nfds) && !qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_FD_PASS)) { error_setg_errno(errp, EINVAL, "Channel does not support file descriptor passing"); return -1; } return klass->io_writev(ioc, iov, niov, fds, nfds, errp); }
int qio_channel_close(QIOChannel *ioc, Error **errp) { QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); return klass->io_close(ioc, errp); }