예제 #1
0
// session init
VOID StartSession(SOCKET s) {
	/* associate the socket to completion port */
	PAIO_DEV aiod = NewAioSocket(s);
	if (aiod == NULL) return;

	PSERVICE_CONTEXT ctx = NewCtx();
	if (ctx == NULL) {
		CloseAsync(aiod);
		return;
	}

	// start the first command receive
	if (!ReadAsync(aiod, ctx, sizeof(FSCloudRequestHeader), readCmdCallback, ctx)) {
		_tprintf(_T("Error start receiving request\n"));
		Abort(aiod, ctx);
	}
}
예제 #2
0
DualErr 
FatParser::Read(
	PGPUInt8			*buf, 
	PGPUInt64			pos, 
	PGPUInt32			nBytes, 
	GenericCallbackInfo	*upInfo)
{
	DualErr derr;

	pgpAssertAddrValid(buf, PGPUInt8);

	if (upInfo)
		ReadAsync(buf, pos, nBytes, upInfo);
	else
		derr = ReadSync(buf, pos, nBytes);

	return derr;
}
예제 #3
0
// callback for process received command
static VOID readCmdCallback(PAIO_DEV aiodev, INT transferedBytes, LPVOID ctx) {
	PSERVICE_CONTEXT sc = (PSERVICE_CONTEXT)ctx;
 
	if (transferedBytes != sizeof(FSCloudRequestHeader)) {
		Abort(aiodev, ctx);
		return;
	}
	if (!dispatchOper(aiodev, sc)) {
		printf("error processing command!\n");
		Abort(aiodev, ctx);
		return;
	}
	//start new read! 
	if (!ReadAsync(aiodev, ctx, sizeof(FSCloudRequestHeader), readCmdCallback, ctx)) {
		_tprintf(_T("Error start receiving request\n"));
		Abort(aiodev, ctx);
	}
}
예제 #4
0
	DualErr 
PGPdisk::Read(
	PGPUInt8			*buf, 
	PGPUInt64			pos, 
	PGPUInt32			nBytes, 
	GenericCallbackInfo	*upInfo)
{
	DualErr derr;

	pgpAssertAddrValid(buf, PGPUInt8);
	pgpAssert(Mounted());

	DebugOut("PGPdisk: Reading PGPdisk %u at pos %u nBlocks %u", GetDrive(), 
		(PGPUInt32) (pos/kDefaultBlockSize), 
		(PGPUInt32) (nBytes/kDefaultBlockSize));

	if (upInfo)
		ReadAsync(buf, pos, nBytes, upInfo);
	else
		derr = ReadSync(buf, pos, nBytes);

	return derr;
}