PDMAsyncCompletionFileFailsafe.cpp revision fa78f7365d7888f0aa971132275c94611249bd7f
/* $Id$ */
/** @file
* PDM Async I/O - Transport data asynchronous in R3 using EMT.
* Simple File I/O manager.
*/
/*
* Copyright (C) 2006-2008 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include "PDMAsyncCompletionFileInternal.h"
/**
* Put a list of tasks in the pending request list of an endpoint.
*/
DECLINLINE(void) pdmacFileAioMgrEpAddTaskList(PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint, PPDMACTASKFILE pTaskHead)
{
/* Add the rest of the tasks to the pending list */
{
}
else
{
}
/* Update the tail. */
}
/**
* Processes a given task list for assigned to the given endpoint.
*/
{
int rc = VINF_SUCCESS;
while (pTasks)
{
{
break;
}
switch (pCurr->enmTransferType)
{
{
break;
}
{
{
NULL);
}
else
{
{
}
NULL);
}
break;
}
default:
}
}
if (pTasks)
{
/* Add the rest of the tasks to the pending list */
}
return VINF_SUCCESS;
}
{
int rc = VINF_SUCCESS;
/* Process the request pending list first in case the endpoint was migrated due to an error. */
if (pTasks)
if (RT_SUCCESS(rc))
{
if (pTasks)
}
return rc;
}
/**
* A fallback method in case something goes wrong with the normal
* I/O manager.
*/
{
int rc = VINF_SUCCESS;
{
LogFlow(("Got woken up\n"));
/* Process endpoint events first. */
while (pEndpoint)
{
}
/* Now check for an external blocking event. */
if (pAioMgr->fBlockingEventPending)
{
switch (pAioMgr->enmBlockingEvent)
{
{
if (pAioMgr->pEndpointsHead)
pAioMgr->cEndpoints++;
/*
* Process the task list the first time. There might be pending requests
* if the endpoint was migrated from another endpoint.
*/
break;
}
{
PPDMASYNCCOMPLETIONENDPOINTFILE pEndpointRemove = pAioMgr->BlockingEventData.RemoveEndpoint.pEndpoint;
if (pPrev)
else
if (pNext)
pAioMgr->cEndpoints--;
break;
}
{
PPDMASYNCCOMPLETIONENDPOINTFILE pEndpointClose = pAioMgr->BlockingEventData.CloseEndpoint.pEndpoint;
/* Make sure all tasks finished. */
break;
}
break;
break;
break;
default:
}
/* Release the waiting thread. */
}
}
return rc;
}