283 lines
8.6 KiB
C
283 lines
8.6 KiB
C
/****************************************************************************
|
|
|
|
|
| (C) Copyright 1985, 1991, 1993, 1996 Novell, Inc.
|
|
| All Rights Reserved.
|
|
|
|
|
| This program is free software; you can redistribute it and/or
|
|
| modify it under the terms of version 2 of the GNU General Public
|
|
| License as published by the Free Software Foundation.
|
|
|
|
|
| This program is distributed in the hope that it will be useful,
|
|
| but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| GNU General Public License for more details.
|
|
|
|
|
| You should have received a copy of the GNU General Public License
|
|
| along with this program; if not, contact Novell, Inc.
|
|
|
|
|
| To contact Novell about this file by physical or electronic mail,
|
|
| you may find current contact information at www.novell.com
|
|
|
|
|
|***************************************************************************
|
|
|
|
|
| NetWare Advance File Services (NSS) Initialization module
|
|
|
|
|
|---------------------------------------------------------------------------
|
|
|
|
|
| $Author: vandana $
|
|
| $Date: 2006-12-22 04:32:59 +0530 (Fri, 22 Dec 2006) $
|
|
|
|
|
| $RCSfile$
|
|
| $Revision: 1796 $
|
|
|
|
|
|---------------------------------------------------------------------------
|
|
| This module is used to:
|
|
| Definitions used by caching.
|
|
|
|
|
| WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
|
|
|
|
|
| This header file should ONLY be used for NSS internal development.
|
|
| This includes Semantic Agents (SA) and Loadable Storage Services (LSS).
|
|
| Any other use may cause conflicts which NSS will NOT fix.
|
|
+-------------------------------------------------------------------------*/
|
|
#ifndef _ASYNCIO_H_
|
|
#define _ASYNCIO_H_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct BioReq_s;
|
|
|
|
typedef void (*BioReqCallback_t)(struct BioReq_s *bioReq);
|
|
|
|
typedef struct BioReq_s {
|
|
DQlink_t br_link;
|
|
BioReqCallback_t br_callback;
|
|
STATUS br_status;
|
|
} BioReq_s;
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* Pattern used to FILL the MSG structures with while DEBUG is enabled
|
|
*---------------------------------------------------------------------------*/
|
|
#define AIO_FILL_PATTERN 0xdeadbeef
|
|
|
|
#if NSS_DEBUG IS_ENABLED
|
|
# define AIO_FILL(_aio) \
|
|
(zASSERT((sizeof(DefaultAsyncio_s) & (sizeof(LONG)-1)) == 0), \
|
|
zASSERT((_aio)->fsm.sp == &(_aio)->stack[1]), \
|
|
LB_memlset((&(_aio)->status), \
|
|
AIO_FILL_PATTERN, \
|
|
((sizeof(DefaultAsyncio_s)-offsetof(Asyncio_s,status))/sizeof(LONG))))
|
|
#else
|
|
# define AIO_FILL(_aio) ((void) 0)
|
|
#endif
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* Generic Asyncio structure
|
|
*---------------------------------------------------------------------------*/
|
|
#define MAX_IO_FSM_DEPTH (8 + FSM_BOUNDARIES)
|
|
#define FILEMAP_SPACE 3
|
|
#define OPSTATE_SPACE 7
|
|
|
|
typedef struct Asyncio_s
|
|
{
|
|
Fsm_s fsm; /* Finite state machine */
|
|
void (*stack[MAX_IO_FSM_DEPTH])(); /* FSM stack space */
|
|
|
|
/* we are pattern filling from here down, do not move STATUS without
|
|
* fixing the AIO_FILL macro */
|
|
STATUS status; /* Error Status */
|
|
struct MyCache_s *mycache; /* Cache structure being used(blockey) */
|
|
struct Buffer_s *buffer; /* Cache buffer being used */
|
|
struct Xaction_s *xaction; /* Transaction being used */
|
|
Blknum_t fileBlk; /* Logical block in file */
|
|
Blknum_t volBlk; /* Volume offset for block (physcial) */
|
|
BYTE mode; /* Read/write/update mode */
|
|
BYTE align[3];
|
|
AgentSignalFunc_t flush; /* routine to call when writting buffer */
|
|
voidfunc_t action; /* callback when getting a buffer */
|
|
BioReq_s bioReq;
|
|
} Asyncio_s;
|
|
|
|
#define INIT_AIO_BASIC(_asyncio) \
|
|
{ \
|
|
AIO_FILL((Asyncio_s *)(_asyncio)); \
|
|
(_asyncio)->status = zOK; \
|
|
(_asyncio)->buffer = NULL; \
|
|
}
|
|
|
|
/* this is used to set a block we want to get after it has already been
|
|
* properly setup */
|
|
#define IO_SETUP_AIO(_asyncio, _mycache, _fileBlk, _mode) \
|
|
{ \
|
|
(_asyncio)->mycache = (_mycache); \
|
|
(_asyncio)->fileBlk = (_fileBlk); \
|
|
(_asyncio)->volBlk = 0; \
|
|
(_asyncio)->mode = (_mode); \
|
|
}
|
|
|
|
|
|
/* this is used when initializing a NEW asyncio for getting a block */
|
|
#define INIT_AIO(_asyncio, _mycache, _fileBlk, _mode) \
|
|
{ \
|
|
INIT_AIO_BASIC(_asyncio) \
|
|
IO_SETUP_AIO((_asyncio), (_mycache), (_fileBlk), (_mode)) \
|
|
}
|
|
|
|
#define INIT_AIO_CHAIN(_asyncio, _chain) \
|
|
{ \
|
|
(_asyncio)->fsm.rtnfsm = (Fsm_s *)(_chain); \
|
|
}
|
|
|
|
#define FSM_CHAIN(_fsm) ((Synchronize_s *)((_fsm)->rtnfsm))
|
|
#define AIO_CHAIN(_asyncio) FSM_CHAIN(&((_asyncio)->fsm))
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* This is the default definition for getting the sizes correct
|
|
*---------------------------------------------------------------------------*/
|
|
typedef Blknum_t FileMapSpace_t[FILEMAP_SPACE]; /* space for LSS specific filemap */
|
|
typedef NINT OpStateSpace_t[OPSTATE_SPACE]; /* space for Operation specific state */
|
|
|
|
typedef struct DefaultAsyncio_s
|
|
{
|
|
Asyncio_s io; /* Generic asnycio info */
|
|
FileMapSpace_t fmap;
|
|
OpStateSpace_t opSpace;
|
|
} DefaultAsyncio_s;
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* AsyncIO for doing COMN read and write
|
|
*---------------------------------------------------------------------------*/
|
|
typedef struct OpsComnRW_s
|
|
{
|
|
BYTE *data; /* Source/Destination of data */
|
|
NINT offset; /* Offset in block to start */
|
|
NINT length; /* Length to transfer */
|
|
} OpsComnRW_s;
|
|
|
|
typedef struct AioComnRW_s
|
|
{
|
|
Asyncio_s io;
|
|
FileMapSpace_t fmap;
|
|
OpsComnRW_s comn;
|
|
} AioComnRW_s;
|
|
|
|
typedef struct AioChunk_s
|
|
{
|
|
Asyncio_s io;
|
|
FileMapSpace_t fmap;
|
|
struct NSSChunk_s *chunk;
|
|
} AioChunk_s;
|
|
|
|
#define INIT_AIO_COMNRW(_asyncio, _data, _offset, _length) \
|
|
{ \
|
|
(_asyncio)->comn.data = (_data); \
|
|
(_asyncio)->comn.offset = (_offset); \
|
|
(_asyncio)->comn.length = (_length); \
|
|
}
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* AsyncIO for doing COMN AsyncRead
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
//typedef void (*AsyncCallBackFunc_t)(
|
|
// ADDR callBackContext,
|
|
// STATUS completionCode,
|
|
// NINT bytesRead,
|
|
// PubBuffer_s *releaseBuffer);
|
|
|
|
typedef struct OpsAsyncRead_s
|
|
{
|
|
ADDR callBackContext;
|
|
voidfunc_t asyncReadCallBack;
|
|
NINT offsetInBuffer;
|
|
NINT bytesRead;
|
|
} OpsAsyncRead_s;
|
|
|
|
typedef struct AioAsyncRead_s
|
|
{
|
|
Asyncio_s io;
|
|
FileMapSpace_t fmap;
|
|
OpsAsyncRead_s aioData;
|
|
} AioAsyncRead_s;
|
|
|
|
#define INIT_AIO_ASYNCREAD(_asyncio, _cbPtr, _cbCtxt, _offset, _numBytes) \
|
|
{ \
|
|
(_asyncio)->aioData.callBackContext = (_cbCtxt); \
|
|
(_asyncio)->aioData.asyncReadCallBack = (_cbPtr); \
|
|
(_asyncio)->aioData.offsetInBuffer = (_offset); \
|
|
(_asyncio)->aioData.bytesRead = (_numBytes); \
|
|
}
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* AsyncIO for doing NCP read and write
|
|
*---------------------------------------------------------------------------*/
|
|
typedef struct OpsNcpRW_s
|
|
{
|
|
#ifdef _NWGREENRIVER_
|
|
struct StationControlStructure *stationInfo;
|
|
NINT frag; /* Index into station info fragment */
|
|
#endif
|
|
|
|
#ifdef _NWMOAB_
|
|
struct LRCaSyncControlStruc *lrcNode;
|
|
#endif
|
|
} OpsNcpRW_s;
|
|
|
|
typedef struct AioNcpRW_s
|
|
{
|
|
Asyncio_s io;
|
|
FileMapSpace_t fmap;
|
|
OpsNcpRW_s ncp;
|
|
} AioNcpRW_s;
|
|
|
|
#ifdef _NWMOAB_
|
|
#define INIT_AIO_NCPRW(_asyncio, _lrcNode) \
|
|
{ \
|
|
(_asyncio)->ncp.lrcNode = (_lrcNode); \
|
|
}
|
|
#endif
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* AsyncIO for doing PACKET BURST read and write
|
|
*---------------------------------------------------------------------------*/
|
|
typedef struct OpsPBurstR_s
|
|
{
|
|
struct PBMultiOpControl_s *multiop;
|
|
struct AioPBurstR_s *aLink;
|
|
NINT dataOffset;
|
|
NINT dataLength;
|
|
NINT relativeOffset;
|
|
NINT workDataLength;
|
|
NINT workRelativeOffset;
|
|
} OpsPBurstR_s;
|
|
|
|
typedef struct AioPBurstR_s
|
|
{
|
|
Asyncio_s io;
|
|
FileMapSpace_t fmap;
|
|
OpsPBurstR_s pb;
|
|
} AioPBurstR_s;
|
|
|
|
#define INIT_AIO_PBURSTR(_asyncio, _multiop, _dataOffset, \
|
|
_dataLength, _relativeOffset) \
|
|
{ \
|
|
(_asyncio)->pb.multiop = (_multiop); \
|
|
(_asyncio)->pb.aLink = NULL; \
|
|
(_asyncio)->pb.dataOffset = (_dataOffset); \
|
|
(_asyncio)->pb.dataLength = (_dataLength); \
|
|
(_asyncio)->pb.relativeOffset = (_relativeOffset); \
|
|
(_asyncio)->pb.workRelativeOffset = (_relativeOffset); \
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* _ASYNCIO_H_ */
|