91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 23.91MB
    文件類型: .bz2
    金幣: 1
    下載: 0 次
    發布日期: 2023-07-08
  • 語言: 其他
  • 標簽: qemu??

資源簡介

qemu是一個虛擬機,可用來運行xv6系統

資源截圖

代碼片段和文件信息

/*
?*?QEMU?aio?implementation
?*
?*?Copyright?IBM?Corp.?2008
?*?Copyright?Red?Hat?Inc.?2012
?*
?*?Authors:
?*??Anthony?Liguori???
?*??Paolo?Bonzini?????
?*
?*?This?work?is?licensed?under?the?terms?of?the?GNU?GPL?version?2.??See
?*?the?COPYING?file?in?the?top-level?directory.
?*
?*?Contributions?after?2012-01-13?are?licensed?under?the?terms?of?the
?*?GNU?GPL?version?2?or?(at?your?option)?any?later?version.
?*/

#include?“qemu-common.h“
#include?“block/block.h“
#include?“qemu/queue.h“
#include?“qemu/sockets.h“

struct?AioHandler?{
????EventNotifier?*e;
????IOHandler?*io_read;
????IOHandler?*io_write;
????EventNotifierHandler?*io_notify;
????GPollFD?pfd;
????int?deleted;
????void?*opaque;
????QLIST_ENTRY(AioHandler)?node;
};

void?aio_set_fd_handler(AioContext?*ctx
????????????????????????int?fd
????????????????????????IOHandler?*io_read
????????????????????????IOHandler?*io_write
????????????????????????void?*opaque)
{
????/*?fd?is?a?SOCKET?in?our?case?*/
????AioHandler?*node;

????QLIST_FOREACH(node?&ctx->aio_handlers?node)?{
????????if?(node->pfd.fd?==?fd?&&?!node->deleted)?{
????????????break;
????????}
????}

????/*?Are?we?deleting?the?fd?handler??*/
????if?(!io_read?&&?!io_write)?{
????????if?(node)?{
????????????/*?If?the?lock?is?held?just?mark?the?node?as?deleted?*/
????????????if?(ctx->walking_handlers)?{
????????????????node->deleted?=?1;
????????????????node->pfd.revents?=?0;
????????????}?else?{
????????????????/*?Otherwise?delete?it?for?real.??We?can‘t?just?mark?it?as
?????????????????*?deleted?because?deleted?nodes?are?only?cleaned?up?after
?????????????????*?releasing?the?walking_handlers?lock.
?????????????????*/
????????????????QLIST_REMOVE(node?node);
????????????????g_free(node);
????????????}
????????}
????}?else?{
????????HANDLE?event;

????????if?(node?==?NULL)?{
????????????/*?Alloc?and?insert?if?it‘s?not?already?there?*/
????????????node?=?g_new0(AioHandler?1);
????????????node->pfd.fd?=?fd;
????????????QLIST_INSERT_HEAD(&ctx->aio_handlers?node?node);
????????}

????????node->pfd.events?=?0;
????????if?(node->io_read)?{
????????????node->pfd.events?|=?G_IO_IN;
????????}
????????if?(node->io_write)?{
????????????node->pfd.events?|=?G_IO_OUT;
????????}

????????node->e?=?&ctx->notifier;

????????/*?Update?handler?with?latest?information?*/
????????node->opaque?=?opaque;
????????node->io_read?=?io_read;
????????node->io_write?=?io_write;

????????event?=?event_notifier_get_handle(&ctx->notifier);
????????WSAEventSelect(node->pfd.fd?event
???????????????????????FD_READ?|?FD_ACCEPT?|?FD_CLOSE?|
???????????????????????FD_CONNECT?|?FD_WRITE?|?FD_OOB);
????}

????aio_notify(ctx);
}

void?aio_set_event_notifier(AioContext?*ctx
????????????????????????????EventNotifier?*e
????????????????????????????EventNotifierHandler?*io_notify)
{
????AioHandler?*node;

????QLIST_FOREACH(node?&ctx->aio_handlers?node)?{
????????if?(node->e?==?e?&&?!node->deleted)?{
????????????break;
???

評論

共有 條評論