222 lines
7.3 KiB
C
222 lines
7.3 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: taysom $
|
|
| $Date: 2004-12-31 01:10:58 +0530 (Fri, 31 Dec 2004) $
|
|
|
|
|
| $RCSfile$
|
|
| $Revision: 465 $
|
|
|
|
|
|---------------------------------------------------------------------------
|
|
| This module is used to:
|
|
| Define the MESSAGE structure that is passed between layers of the
|
|
| system.
|
|
|
|
|
| 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 _MSGIO_H_
|
|
#define _MSGIO_H_
|
|
|
|
#ifndef _MSGGEN_H_
|
|
# include <msgGen.h>
|
|
#endif
|
|
|
|
#ifndef _LATCH_H_
|
|
# include <latch.h>
|
|
#endif
|
|
|
|
#ifndef _FSM_H_
|
|
# include <fsm.h>
|
|
#endif
|
|
|
|
#ifndef _ZPARAMS_H_
|
|
# include <zParams.h>
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#if NSS_DEBUG IS_ENABLED
|
|
extern NINT ReadPoolBlkErrDebug;
|
|
extern BOOL IncReadPoolBlkErrDebug;
|
|
#endif
|
|
/*---------------------------------------------------------------------------
|
|
* This contains parameters specific to doing READS/WRITES
|
|
*---------------------------------------------------------------------------*/
|
|
struct FileIOMsg_s
|
|
{
|
|
QUAD byteOffset; /* bytes offset in file to read/write at*/
|
|
NINT numBytes; /* number bytes to read/write*/
|
|
void *buffer; /* buffer to read/write*/
|
|
NINT flags; /* Misc IO flags */
|
|
NINT bytesXfered; /* number bytes actually read/writen*/
|
|
};
|
|
|
|
#define COMN_SETUP_FILEIO_MSG(_fio,_offset,_numbytes,_buff) \
|
|
((_fio)->byteOffset = (_offset), \
|
|
(_fio)->numBytes = (_numbytes), \
|
|
(_fio)->buffer = (_buff), \
|
|
(_fio)->flags = 0, \
|
|
(_fio)->bytesXfered = 0)
|
|
|
|
#define COMN_SETUP_FILEIO_MSG_FLAGS(_fio,_offset,_numbytes,_buff,_flags) \
|
|
((_fio)->byteOffset = (_offset), \
|
|
(_fio)->numBytes = (_numbytes), \
|
|
(_fio)->buffer = (_buff), \
|
|
(_fio)->flags = (_flags), \
|
|
(_fio)->bytesXfered = 0)
|
|
|
|
#define FIOFL_DontUpdateArchiveBit 0x00000001
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* This contains parameters specific to doing DFS READS/WRITES
|
|
*---------------------------------------------------------------------------*/
|
|
struct AsyncFileIOMsg_s
|
|
{
|
|
Blknum_t fileBlk; /* Block number in file */
|
|
void (*asyncCallBack)( /* callbackroutine for read complete */
|
|
ADDR callBackContext,
|
|
STATUS completionCode,
|
|
NINT bytesRead,
|
|
zBuffer_s *releaseBuffer);
|
|
ADDR callBackContext; /* parameter for the callback routine */
|
|
QUAD *ret_BlocksRemain; /* */
|
|
};
|
|
|
|
#define COMN_SETUP_ASYNC_FILEIO_MSG(fio, blknum, callback, context, retBlks) \
|
|
((fio)->fileBlk = (blknum), \
|
|
(fio)->asyncCallBack = (callback), \
|
|
(fio)->callBackContext = (context), \
|
|
(fio)->ret_BlocksRemain = (retBlks))
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* This contains parameters specific to doing block I/O
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
typedef struct IoMsg_s
|
|
{
|
|
struct RootBeast_s *beast; /* File being accessed */
|
|
void *xaction; /* Current transaction on beast */
|
|
Blknum_t fileBlk; /* Block number in file */
|
|
Blknum_t volBlk; /* Block number in volume (or pool) */
|
|
Blknum_t allocNumBlks;/* Num of block for writes */
|
|
BYTE mode; /* Access mode on block (see xCache.h) */
|
|
BYTE flags; /* Check to see if blocks should not be */
|
|
BYTE pad[2]; /* zero filled (default is zero fill) */
|
|
#if NSS_DEBUG IS_ENABLED
|
|
NINT debugID; /* This is a error testing field used */
|
|
#endif
|
|
} IoMsg_s;
|
|
|
|
/*
|
|
* SETUP_IO_MSG and XSETUP_IO_MSG should only be used to make macros
|
|
* that initialize all of the fields. There can be additional io msg
|
|
* macros in the storage specific portion of the system.
|
|
*/
|
|
#define SETUP_IO_MSG(_io, _beast, _mode) \
|
|
{ \
|
|
(_io).beast = (RootBeast_s *)(_beast); \
|
|
(_io).xaction = NULL; \
|
|
(_io).mode = (_mode); \
|
|
(_io).flags = 0; \
|
|
}
|
|
|
|
#define FILEBLK_IO_MSG(_io, _beast, _fileBlk, _numblks, _mode) \
|
|
{ \
|
|
SETUP_IO_MSG(_io, _beast, _mode); \
|
|
(_io).fileBlk = (_fileBlk); \
|
|
(_io).volBlk = 0; \
|
|
(_io).allocNumBlks = (_numblks); \
|
|
}
|
|
|
|
#define FILEBLK_IO_MSG_FLAG(_io, _beast, _fileBlk, _numblks, _mode, _flags) \
|
|
{ \
|
|
FILEBLK_IO_MSG(_io, _beast, _fileBlk, _numblks, _mode) \
|
|
(_io).flags = _flags; \
|
|
}
|
|
|
|
#define VOLBLK_IO_MSG(_io, _beast, _fileBlk, _volBlk, _numblks, _mode) \
|
|
{ \
|
|
SETUP_IO_MSG(_io, _beast, _mode); \
|
|
(_io).fileBlk = (_fileBlk); \
|
|
(_io).volBlk = (_volBlk); \
|
|
(_io).allocNumBlks = (_numblks); \
|
|
}
|
|
|
|
/*
|
|
* The following are for setting up io msgs that have transactions (X)
|
|
*/
|
|
#define XSETUP_IO_MSG(_io, _beast, _xaction, _mode) \
|
|
{ \
|
|
(_io).beast = (RootBeast_s *)(_beast); \
|
|
(_io).xaction = (_xaction); \
|
|
(_io).mode = (_mode); \
|
|
(_io).flags = 0; \
|
|
}
|
|
|
|
#define XFILEBLK_IO_MSG(_io, _beast, _xaction, _fileBlk, _numblks, _mode) \
|
|
{ \
|
|
XSETUP_IO_MSG(_io, _beast, _xaction, _mode); \
|
|
(_io).fileBlk = (_fileBlk); \
|
|
(_io).volBlk = 0; \
|
|
(_io).allocNumBlks = (_numblks); \
|
|
}
|
|
|
|
#define XVOLBLK_IO_MSG(_io, _beast, _xaction, _fileBlk, _volBlk, _numblks, \
|
|
_mode) \
|
|
{ \
|
|
XSETUP_IO_MSG(_io, _beast, _xaction, _mode); \
|
|
(_io).fileBlk = (_fileBlk); \
|
|
(_io).volBlk = (_volBlk); \
|
|
(_io).allocNumBlks = (_numblks); \
|
|
}
|
|
|
|
/* Definition of IOMsg_s.flags */
|
|
#define ALLOC_NO_ZERO_FILL 0x01 /* If set, don't zero fill */
|
|
#define ALLOC_NUM_BLOCKS_IS_OPTIONAL 0x02 /* If set, LSS is not required
|
|
* to alloc "allocNumBlks".
|
|
* If NOT set, LSS must alloc-
|
|
* ahead all requested blocks
|
|
*/
|
|
#define ALLOC_BLOCKS_CONTIGUOUS 0x04 /* If set, allocate the blocks
|
|
* contiguously
|
|
*/
|
|
|
|
|
|
#define RETRY_WRITE_DELAY_COUNT 10
|
|
#define RETRY_WRITE_DELAY_TIME 500
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* _MSGIO_H_ */
|