Lines Matching refs:ioc

29 bool qio_channel_has_feature(QIOChannel *ioc,  in qio_channel_has_feature()  argument
32 return ioc->features & (1 << feature); in qio_channel_has_feature()
36 void qio_channel_set_feature(QIOChannel *ioc, in qio_channel_set_feature() argument
39 ioc->features |= (1 << feature); in qio_channel_set_feature()
43 void qio_channel_set_name(QIOChannel *ioc, in qio_channel_set_name() argument
46 g_free(ioc->name); in qio_channel_set_name()
47 ioc->name = g_strdup(name); in qio_channel_set_name()
51 ssize_t qio_channel_readv_full(QIOChannel *ioc, in qio_channel_readv_full() argument
59 QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); in qio_channel_readv_full()
62 !qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_FD_PASS)) { in qio_channel_readv_full()
69 !qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_READ_MSG_PEEK)) { in qio_channel_readv_full()
75 return klass->io_readv(ioc, iov, niov, fds, nfds, flags, errp); in qio_channel_readv_full()
79 ssize_t qio_channel_writev_full(QIOChannel *ioc, in qio_channel_writev_full() argument
87 QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); in qio_channel_writev_full()
90 if (!qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_FD_PASS)) { in qio_channel_writev_full()
103 !qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_WRITE_ZERO_COPY)) { in qio_channel_writev_full()
109 return klass->io_writev(ioc, iov, niov, fds, nfds, flags, errp); in qio_channel_writev_full()
113 int coroutine_mixed_fn qio_channel_readv_all_eof(QIOChannel *ioc, in qio_channel_readv_all_eof() argument
118 return qio_channel_readv_full_all_eof(ioc, iov, niov, NULL, NULL, errp); in qio_channel_readv_all_eof()
121 int coroutine_mixed_fn qio_channel_readv_all(QIOChannel *ioc, in qio_channel_readv_all() argument
126 return qio_channel_readv_full_all(ioc, iov, niov, NULL, NULL, errp); in qio_channel_readv_all()
129 int coroutine_mixed_fn qio_channel_readv_full_all_eof(QIOChannel *ioc, in qio_channel_readv_full_all_eof() argument
157 len = qio_channel_readv_full(ioc, local_iov, nlocal_iov, local_fds, in qio_channel_readv_full_all_eof()
161 qio_channel_yield(ioc, G_IO_IN); in qio_channel_readv_full_all_eof()
163 qio_channel_wait(ioc, G_IO_IN); in qio_channel_readv_full_all_eof()
219 int coroutine_mixed_fn qio_channel_readv_full_all(QIOChannel *ioc, in qio_channel_readv_full_all() argument
225 int ret = qio_channel_readv_full_all_eof(ioc, iov, niov, fds, nfds, errp); in qio_channel_readv_full_all()
238 int coroutine_mixed_fn qio_channel_writev_all(QIOChannel *ioc, in qio_channel_writev_all() argument
243 return qio_channel_writev_full_all(ioc, iov, niov, NULL, 0, 0, errp); in qio_channel_writev_all()
246 int coroutine_mixed_fn qio_channel_writev_full_all(QIOChannel *ioc, in qio_channel_writev_full_all() argument
264 len = qio_channel_writev_full(ioc, local_iov, nlocal_iov, fds, in qio_channel_writev_full_all()
269 qio_channel_yield(ioc, G_IO_OUT); in qio_channel_writev_full_all()
271 qio_channel_wait(ioc, G_IO_OUT); in qio_channel_writev_full_all()
291 ssize_t qio_channel_readv(QIOChannel *ioc, in qio_channel_readv() argument
296 return qio_channel_readv_full(ioc, iov, niov, NULL, NULL, 0, errp); in qio_channel_readv()
300 ssize_t qio_channel_writev(QIOChannel *ioc, in qio_channel_writev() argument
305 return qio_channel_writev_full(ioc, iov, niov, NULL, 0, 0, errp); in qio_channel_writev()
309 ssize_t qio_channel_read(QIOChannel *ioc, in qio_channel_read() argument
315 return qio_channel_readv_full(ioc, &iov, 1, NULL, NULL, 0, errp); in qio_channel_read()
319 ssize_t qio_channel_write(QIOChannel *ioc, in qio_channel_write() argument
325 return qio_channel_writev_full(ioc, &iov, 1, NULL, 0, 0, errp); in qio_channel_write()
329 int coroutine_mixed_fn qio_channel_read_all_eof(QIOChannel *ioc, in qio_channel_read_all_eof() argument
335 return qio_channel_readv_all_eof(ioc, &iov, 1, errp); in qio_channel_read_all_eof()
339 int coroutine_mixed_fn qio_channel_read_all(QIOChannel *ioc, in qio_channel_read_all() argument
345 return qio_channel_readv_all(ioc, &iov, 1, errp); in qio_channel_read_all()
349 int coroutine_mixed_fn qio_channel_write_all(QIOChannel *ioc, in qio_channel_write_all() argument
355 return qio_channel_writev_all(ioc, &iov, 1, errp); in qio_channel_write_all()
359 int qio_channel_set_blocking(QIOChannel *ioc, in qio_channel_set_blocking() argument
363 QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); in qio_channel_set_blocking()
364 return klass->io_set_blocking(ioc, enabled, errp); in qio_channel_set_blocking()
368 void qio_channel_set_follow_coroutine_ctx(QIOChannel *ioc, bool enabled) in qio_channel_set_follow_coroutine_ctx() argument
370 ioc->follow_coroutine_ctx = enabled; in qio_channel_set_follow_coroutine_ctx()
374 int qio_channel_close(QIOChannel *ioc, in qio_channel_close() argument
377 QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); in qio_channel_close()
378 return klass->io_close(ioc, errp); in qio_channel_close()
382 GSource *qio_channel_create_watch(QIOChannel *ioc, in qio_channel_create_watch() argument
385 QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); in qio_channel_create_watch()
386 GSource *ret = klass->io_create_watch(ioc, condition); in qio_channel_create_watch()
388 if (ioc->name) { in qio_channel_create_watch()
389 g_source_set_name(ret, ioc->name); in qio_channel_create_watch()
396 void qio_channel_set_aio_fd_handler(QIOChannel *ioc, in qio_channel_set_aio_fd_handler() argument
403 QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); in qio_channel_set_aio_fd_handler()
405 klass->io_set_aio_fd_handler(ioc, read_ctx, io_read, write_ctx, io_write, in qio_channel_set_aio_fd_handler()
409 guint qio_channel_add_watch_full(QIOChannel *ioc, in qio_channel_add_watch_full() argument
419 source = qio_channel_create_watch(ioc, condition); in qio_channel_add_watch_full()
429 guint qio_channel_add_watch(QIOChannel *ioc, in qio_channel_add_watch() argument
435 return qio_channel_add_watch_full(ioc, condition, func, in qio_channel_add_watch()
439 GSource *qio_channel_add_watch_source(QIOChannel *ioc, in qio_channel_add_watch_source() argument
449 id = qio_channel_add_watch_full(ioc, condition, func, in qio_channel_add_watch_source()
457 ssize_t qio_channel_pwritev(QIOChannel *ioc, const struct iovec *iov, in qio_channel_pwritev() argument
460 QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); in qio_channel_pwritev()
467 if (!qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_SEEKABLE)) { in qio_channel_pwritev()
472 return klass->io_pwritev(ioc, iov, niov, offset, errp); in qio_channel_pwritev()
475 ssize_t qio_channel_pwrite(QIOChannel *ioc, char *buf, size_t buflen, in qio_channel_pwrite() argument
483 return qio_channel_pwritev(ioc, &iov, 1, offset, errp); in qio_channel_pwrite()
486 ssize_t qio_channel_preadv(QIOChannel *ioc, const struct iovec *iov, in qio_channel_preadv() argument
489 QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); in qio_channel_preadv()
496 if (!qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_SEEKABLE)) { in qio_channel_preadv()
501 return klass->io_preadv(ioc, iov, niov, offset, errp); in qio_channel_preadv()
504 ssize_t qio_channel_pread(QIOChannel *ioc, char *buf, size_t buflen, in qio_channel_pread() argument
512 return qio_channel_preadv(ioc, &iov, 1, offset, errp); in qio_channel_pread()
515 int qio_channel_shutdown(QIOChannel *ioc, in qio_channel_shutdown() argument
519 QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); in qio_channel_shutdown()
526 return klass->io_shutdown(ioc, how, errp); in qio_channel_shutdown()
530 void qio_channel_set_delay(QIOChannel *ioc, in qio_channel_set_delay() argument
533 QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); in qio_channel_set_delay()
536 klass->io_set_delay(ioc, enabled); in qio_channel_set_delay()
541 void qio_channel_set_cork(QIOChannel *ioc, in qio_channel_set_cork() argument
544 QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); in qio_channel_set_cork()
547 klass->io_set_cork(ioc, enabled); in qio_channel_set_cork()
551 int qio_channel_get_peerpid(QIOChannel *ioc, in qio_channel_get_peerpid() argument
555 QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); in qio_channel_get_peerpid()
561 klass->io_peerpid(ioc, pid, errp); in qio_channel_get_peerpid()
565 off_t qio_channel_io_seek(QIOChannel *ioc, in qio_channel_io_seek() argument
570 QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); in qio_channel_io_seek()
577 return klass->io_seek(ioc, offset, whence, errp); in qio_channel_io_seek()
580 int qio_channel_flush(QIOChannel *ioc, in qio_channel_flush() argument
583 QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc); in qio_channel_flush()
586 !qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_WRITE_ZERO_COPY)) { in qio_channel_flush()
590 return klass->io_flush(ioc, errp); in qio_channel_flush()
596 QIOChannel *ioc = opaque; in qio_channel_restart_read() local
597 Coroutine *co = qatomic_xchg(&ioc->read_coroutine, NULL); in qio_channel_restart_read()
611 QIOChannel *ioc = opaque; in qio_channel_restart_write() local
612 Coroutine *co = qatomic_xchg(&ioc->write_coroutine, NULL); in qio_channel_restart_write()
625 qio_channel_set_fd_handlers(QIOChannel *ioc, GIOCondition condition) in qio_channel_set_fd_handlers() argument
627 AioContext *ctx = ioc->follow_coroutine_ctx ? in qio_channel_set_fd_handlers()
636 ioc->read_coroutine = qemu_coroutine_self(); in qio_channel_set_fd_handlers()
637 ioc->read_ctx = ctx; in qio_channel_set_fd_handlers()
649 if (ioc->write_coroutine && ioc->write_ctx == ctx) { in qio_channel_set_fd_handlers()
654 ioc->write_coroutine = qemu_coroutine_self(); in qio_channel_set_fd_handlers()
655 ioc->write_ctx = ctx; in qio_channel_set_fd_handlers()
658 if (ioc->read_coroutine && ioc->read_ctx == ctx) { in qio_channel_set_fd_handlers()
666 qio_channel_set_aio_fd_handler(ioc, read_ctx, io_read, in qio_channel_set_fd_handlers()
667 write_ctx, io_write, ioc); in qio_channel_set_fd_handlers()
671 qio_channel_clear_fd_handlers(QIOChannel *ioc, GIOCondition condition) in qio_channel_clear_fd_handlers() argument
680 ctx = ioc->read_ctx; in qio_channel_clear_fd_handlers()
683 if (ioc->write_coroutine && ioc->write_ctx == ctx) { in qio_channel_clear_fd_handlers()
688 ctx = ioc->write_ctx; in qio_channel_clear_fd_handlers()
691 if (ioc->read_coroutine && ioc->read_ctx == ctx) { in qio_channel_clear_fd_handlers()
699 qio_channel_set_aio_fd_handler(ioc, read_ctx, io_read, in qio_channel_clear_fd_handlers()
700 write_ctx, io_write, ioc); in qio_channel_clear_fd_handlers()
703 void coroutine_fn qio_channel_yield(QIOChannel *ioc, in qio_channel_yield() argument
712 assert(!ioc->read_coroutine); in qio_channel_yield()
714 assert(!ioc->write_coroutine); in qio_channel_yield()
718 qio_channel_set_fd_handlers(ioc, condition); in qio_channel_yield()
725 assert(ioc->read_coroutine == NULL); in qio_channel_yield()
727 assert(ioc->write_coroutine == NULL); in qio_channel_yield()
729 qio_channel_clear_fd_handlers(ioc, condition); in qio_channel_yield()
732 void qio_channel_wake_read(QIOChannel *ioc) in qio_channel_wake_read() argument
734 Coroutine *co = qatomic_xchg(&ioc->read_coroutine, NULL); in qio_channel_wake_read()
740 static gboolean qio_channel_wait_complete(QIOChannel *ioc, in qio_channel_wait_complete() argument
751 void qio_channel_wait(QIOChannel *ioc, in qio_channel_wait() argument
758 source = qio_channel_create_watch(ioc, condition); in qio_channel_wait()
777 QIOChannel *ioc = QIO_CHANNEL(obj); in qio_channel_finalize() local
780 assert(!ioc->read_coroutine); in qio_channel_finalize()
781 assert(!ioc->write_coroutine); in qio_channel_finalize()
783 g_free(ioc->name); in qio_channel_finalize()
786 if (ioc->event) { in qio_channel_finalize()
787 CloseHandle(ioc->event); in qio_channel_finalize()