/**************************************************************************** | | (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) General Message Structure defines | |--------------------------------------------------------------------------- | | $Author: randys $ | $Date: 2005-06-06 19:11:43 +0530 (Mon, 06 Jun 2005) $ | | $RCSfile$ | $Revision: 1029 $ | |--------------------------------------------------------------------------- | 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 _MSGGEN_H_ #define _MSGGEN_H_ #ifndef _ZOMNI_H_ # include #endif #ifndef _XSTRING_H_ # include #endif #ifndef _LATCH_H_ # include #endif #ifndef _XERROR_H_ # include #endif #ifdef __cplusplus extern "C" { #endif /*--------------------------------------------------------------------------- * Pattern used to FILL the MSG structures with while DEBUG is enabled *---------------------------------------------------------------------------*/ #define COMN_MSG_FILL_PATTERN 0xA5A5A5A5 #if NSS_DEBUG IS_ENABLED # define COMN_MSG_FILL(_buf,_size) \ (zASSERT(((_size) & (sizeof(LONG)-1)) == 0), \ LB_memlset((_buf),COMN_MSG_FILL_PATTERN,((_size)/sizeof(LONG)))) #else # define COMN_MSG_FILL(_buf,_size) ((void) 0) #endif /*--------------------------------------------------------------------------- * This MACRO is used to INITIALIZE any structure with a pattern. This * MUST be used before a MSG or PARAM struct is initialized with data. *---------------------------------------------------------------------------*/ #define COMN_STRUCT_INIT(_msg) \ COMN_MSG_FILL(&(_msg),sizeof(_msg)) //#if NSS_DEBUG IS_ENABLED //# define COMN_CHECK_STRUCT_INIT(_genMsg) zASSERT((_genMsg)->fillCheck == COMN_MSG_FILL_PATTERN) //#else //# define COMN_CHECK_STRUCT_INIT(_genMsg) ((void) 0) //#endif /*=========================================================================== *=========================================================================== *=========================================================================== * * This defines basic structures used to keep track of HANDLE ID's and * their associated pointers. With these ID/POINTER pairs we can cache * the pointers in memory so we don't have to keep resolveing the ID's * *=========================================================================== *=========================================================================== *===========================================================================*/ /*--------------------------------------------------------------------------- * IDP for conections *---------------------------------------------------------------------------*/ typedef struct ConnectionIDP_s { NINT id; /* connectionID */ struct NSSConnection_s *ptr; } ConnectionIDP_s; #define COMN_SET_CONNECTION_ID(_conIDP,_conid) \ (((_conIDP)->id = (_conid)),((_conIDP)->ptr = NULL)) /*--------------------------------------------------------------------------- * IDP for context handles *---------------------------------------------------------------------------*/ typedef struct ContextHandleIDP_s { NINT id; /* contextHandleID */ struct ContextHandleInfo_s *ptr; } ContextHandleIDP_s; #define COMN_SET_CONTEXTHANDLE(_cxIDP,_cxid,_cxptr) \ (((_cxIDP)->id = (_cxid)),((_cxIDP)->ptr = (_cxptr))) #define COMN_SET_CONTEXTHANDLE_ID(_cxIDP,_cxid) \ COMN_SET_CONTEXTHANDLE(_cxIDP,_cxid,NULL) /*--------------------------------------------------------------------------- * IDP for file handles *---------------------------------------------------------------------------*/ typedef struct FileHandleIDP_s { Key_t key; struct FileHandle_s *ptr; } FileHandleIDP_s; #define COMN_SET_FILEHANDLE(_fhIDP,_fhkey,_fhptr) \ (((_fhIDP)->key = (_fhkey)),((_fhIDP)->ptr = (_fhptr))) #define COMN_SET_FILEHANDLE_ID(_fhIDP,_fhkey) \ COMN_SET_FILEHANDLE(_fhIDP,_fhkey,NULL) /*--------------------------------------------------------------------------- * IDP for generic semantic agent handles *---------------------------------------------------------------------------*/ typedef struct SAHandleIDP_s { NINT id; /* semantic Agent HandleID*/ struct SAHandle_s *ptr; } SAHandleIDP_s; #define COMN_SET_SAHANDLE(_sahIDP,_sahid,_sahptr) \ (((_sahIDP)->id = (_sahid)),((_sahIDP)->ptr = (_sahptr))) #define COMN_SET_SAHANDLE_ID(_sahIDP,_sahid) \ COMN_SET_SAHANDLE(_sahIDP,_sahid,NULL) /*--------------------------------------------------------------------------- * IDP for search maps *---------------------------------------------------------------------------*/ typedef struct SearchMapIDP_s { NINT id; /* searchMapID */ struct SearchMap_s *ptr; } SearchMapIDP_s; #define COMN_SET_SEARCHMAP(_smIDP,_smid,_smptr) \ (((_smIDP)->id = (_smid)),((_smIDP)->ptr = (_smptr))) #define COMN_SET_SEARCHMAP_ID(_smIDP,_smid) \ COMN_SET_SEARCHMAP(_smIDP,_smid,NULL) /*--------------------------------------------------------------------------- * This contains GENERAL parameters across ALL APIs *---------------------------------------------------------------------------*/ typedef struct GeneralMsg_s { STATUS errStatus; /* holds current status*/ char *errStatusSetter; /* WHERE information. Used * to determine who set errStatus last. * This should be only used for * debug purposes. */ ConnectionIDP_s pssConn; /* connection ID*/ NINT taskID; /* taskID for this operation*/ WORD saID; /* semantic agent making the call */ WORD flags; /* to see if the openFiles have a * latch already on the conn */ } GeneralMsg_s; /* Values for flags */ #define FILEHANDLE_IS_XLATCHED 0x0001 #define DO_NOT_SEND_EVENTS 0x0002 #define DO_NOT_SEND_FSHOOKS 0x0004 #define ALLOW_SECURE_ACCESS 0x0008 #define DO_NOT_UNPACK_FMAP 0x0010 #define COPY_FMAP_TO_SNAP 0x0020 #define GM_FLAGS_INTERNAL_VOLUME 0x0040 /* Set if user is using an internal * volume. The caller must set * this bit for lookup of the volume * to succeed. ZLSS uses internal * volumes to store information * about Logical Volumes in a Pool. */ #define ALLOW_INACTIVE_VOLUME 0x0080 /* Set by purgeLog processing to * cause volume lookups to not * require the volume to be active */ #define UPDATE_EXISTING_BEAST 0x0200 /* When unpacking the beast, it is * not a new beast, but an existing * beast that needs to be updated * used by XLSS. */ #define DO_NOT_CHECK_SPACE_QUOTA 0x0400 /* If set, do not check for user space * restriction and directory space * restriction */ #define ALLOW_BST_STATE_PURGING 0x0800 /* WARNING --- DO NOT USE THIS * UNLESS YOU KNOW EXACTLY WHAT * YOU ARE DOING!!!! * If set, this allows a beast * to be looked up even if it's * state is BST_STATE_PURGING, but * only if it has a non-zero use * count. */ #define COMN_GENMSG_RESOLVE_CONNECTION(genMsg) \ (((genMsg)->pssConn.ptr != NULL) ? (genMsg)->pssConn.ptr : COMN_DoResolveConnection((genMsg))) /* Note - must set saID and flags before calling COMN_GENMSG_RESOLVE_CONNECTION * in this macro. COMN_DoResolveConnection sets some flags based on * the saID field. */ #define COMN_SETUP_GENERAL_MSG(_genMsg,_conid,_ptaskid,_sagentID) \ (ClearErrno((_genMsg)), \ (_genMsg)->saID = (_sagentID), \ (_genMsg)->flags = 0), \ (_genMsg)->taskID = (_ptaskid), \ COMN_SET_CONNECTION_ID(&(_genMsg)->pssConn,_conid), \ COMN_GENMSG_RESOLVE_CONNECTION(_genMsg) #define COMN_SETUP_GENERAL_MSG_NOSA(_genMsg) \ COMN_SETUP_GENERAL_MSG(_genMsg,zSYS_CONNECTION, \ zNO_TASK,zSAGENT_NONE) #define COMN_SETUP_GENERAL_MSG_NO_CONNECTION_RESOLVE(_genMsg) \ (ClearErrno((_genMsg)), \ COMN_SET_CONNECTION_ID(&(_genMsg)->pssConn,zSYS_CONNECTION), \ (_genMsg)->taskID = (zNO_TASK), \ (_genMsg)->saID = (zSAGENT_NONE), \ (_genMsg)->flags = 0) #define X_LATCH_SET_FLAG(genMsg, latch) \ { \ X_LATCH(latch); \ (genMsg)->flags |= FILEHANDLE_IS_XLATCHED; \ } #define UNX_LATCH_SET_FLAG(genMsg, latch) \ { \ UNX_LATCH(latch); \ (genMsg)->flags &= ~FILEHANDLE_IS_XLATCHED; \ } #ifdef __cplusplus } #endif #endif /* _MSGGEN_H_ */