/**************************************************************************** | | (C) Copyright 1985, 1991, 1993, 1996-1999 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 | |*************************************************************************** | | Novell Storage Services (NSS) module | |--------------------------------------------------------------------------- | | $Author: blarsen $ | $Date: 2006-01-25 02:50:42 +0530 (Wed, 25 Jan 2006) $ | | $RCSfile$ | $Revision: 1316 $ | |--------------------------------------------------------------------------- | 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 _MSGNAME_H_ #define _MSGNAME_H_ #include #ifndef _MSGGEN_H_ #include #endif #ifndef _NAMESPACE_H_ #include #endif #ifndef _HARDLINK_H_ #include #endif #ifdef __cplusplus extern "C" { #endif /*=========================================================================== *=========================================================================== *=========================================================================== * * This is a definition of the of internal MESSAGE structure used for * naming. * *=========================================================================== *=========================================================================== *===========================================================================*/ /*--------------------------------------------------------------------------- * This contains parameters specific to resolving NAMES *---------------------------------------------------------------------------*/ struct NamingMsg_s { /* INPUT fields */ BYTE handlePathType; /* Type of input information specified */ BYTE pathFormat; /* The format of the path (i.e. ASCII, unicode_t, ...) */ BYTE parseMode; /* mode for path string parsing */ BYTE pathCount; /* path component count for zPFMT_ASCII_COUNTED strings only */ WORD parseFlags; /* flags for nameMsg parsing */ BYTE retParseFlags; /* OUTPUT: flags returned from nameMsg parsing */ BYTE latchType; /* Type of latch to get on curFile and curDataStream -- defined in latch.h */ NINT pathLength; /* path length for zPFMT_ASCII_LEN strings only */ ContextHandleIDP_s contextHandle; /* valid if pathType == zHPT_CONTEXT */ VolumeID_t volumeID; /* valid if pathType = zHPT_VOLUME or zHPT_VOLUME_ZID */ struct Volume_s *curvol; /* after lookup, points to volumeID (locked) * NOTE -- This pointer has two associated use * counts that must be incremented if this * pointer is non-NULL. The basic useCount which * locks the beast in memory, and the keepActiveUseCount * which locks the beast in the ACTIVATED state */ FileHandleIDP_s fileHandle; /* valid if pathType = zHPT_FILEHANDLEID */ Zid_t fileParentZid; /* Contains parentZid of the file */ NINT fileNameType; /* The name type associated with fileNameUniquifier */ NINT zidNameType; /* Only set if path is rooted on a starting ZID. * This must match the nameType of the beast * identified by that starting ZID. */ Zid_t fileZid; /* if curFile==NULL, may contain zid of the file */ struct File_s *curFile; /* after lookup, points to file beast (locked) * this object is now returned latched by * "COMN_Lookup". Use this beast for authorization * and for metadata changes etc... This may be * the same beast as curDStream, but maybe not */ Zid_t dataStreamZid; /* if curDataStream==NULL, may contain zid of the dataStream */ struct NamedBeast_s *curDataStream; /* after lookup, points to dataStream beast (locked) * this object is now returned latched by * "COMN_Lookup". This may be the same beast * as curFile, but it may be different. */ struct HardLinkBeast_s *hlFile; /* if retParseFlags indicate a hardlink found, after lookup, points to hardlink beast (locked) */ Zid_t hlParentZid; /* if retParseFlags indicate a hardlink found, zid of the parent of the hardlink file */ WORD nameSpaceID; /* starting namespace to resolve name in */ WORD nameType; /* starting nameType for the name message */ union { void *voidPtr; char *ascii; unicode_t *unicode; } path; /* Path string, one of several formats */ struct zMatchAttr_s *match; /* When locating a file, this match criteria * (if present) is used to select if the file * should be matched. */ NINT retPathLen; /* Length of retPath buffer */ struct Master_s *master;/* Owner for the file handle */ /* OUTPUT fields */ VolumeID_t *retVolumeID; /* if parsing stops at a volume boundary, is * filled in with the volumeID of the boundary */ unicode_t *retPath; /* if parsing stops at a volume boundary, is * filled in with the remaining unparsed path*/ /* INTERNAL ONLY fields to Naming System*/ unicode_t *workBuffer; /* points to buffer optionally used to store * pieces of the path as it is being parsed. */ struct NameSpace_s *workNameSpace;/* current namespace ptr. If !NULL it has * a use count on the pointer. */ BYTE workNameSpaceID; /* current namespace ID */ BYTE workNameType; /* current name type */ BYTE workPathCount; /* remaining count for ASCII counted Path Strings.*/ BYTE reserved; char *lastAsciiSrcPath; /* Saved each time before calling scan of next * ASCII component. */ NINT lastAsciiSrcPathLen; /* Length of lastAsciiSrcPath or -1 */ ScanComponentMsg_s scanMsg;/* Is a message structure passed to a name * space module to scan/parse the next * path component. This maintains state for * the parsing as it is done one component * at a time. */ STATUS (*scanNextComponent)( /* This is a shortcut function Ptr */ struct GeneralMsg_s *genMsg, /* used to point to a function that */ struct NamingMsg_s *nameMsg);/* is tailored to know how to scan */ /* the next component based on the */ /* type of input string being scanned*/ }; /*--------------------------------------------------------------------------- * These macros are used to unlatch/latch the beasts in the Name Message * If the data stream and the file are the same beast, this only does one * latch, else both are latched/unlatched. If a hardlink beast is present, * it is also latched. *---------------------------------------------------------------------------*/ #define COMN_LATCH_NAMEMSG_BEASTS(_nameMsg,_latchType) \ { \ (_nameMsg)->latchType = _latchType; \ if ((NamedBeast_s *)(_nameMsg)->curFile == (_nameMsg)->curDataStream) \ { \ COND_LATCH(&(_nameMsg)->curFile->FILEbeastLatch, (_nameMsg)->latchType); \ } \ else \ { \ COND_LATCH(&(_nameMsg)->curFile->FILEbeastLatch, (_nameMsg)->latchType); \ COND_LATCH(&(_nameMsg)->curDataStream->NAMEDbeastLatch, (_nameMsg)->latchType); \ } \ if ((_nameMsg)->hlFile != NULL) \ COND_LATCH(&(_nameMsg)->hlFile->HARDLbeastLatch, (_nameMsg)->latchType); \ } #define COMN_UPLATCH_NAMEMSG_BEASTS(_nameMsg) \ { \ zASSERT((_nameMsg)->latchType == SLATCHED); \ (_nameMsg)->latchType = XLATCHED; \ if ((_nameMsg)->hlFile != NULL) \ UNS_LATCH(&(_nameMsg)->hlFile->HARDLbeastLatch); \ if ((NamedBeast_s *)(_nameMsg)->curFile == (_nameMsg)->curDataStream) \ { \ UP_LATCH(&(_nameMsg)->curFile->FILEbeastLatch); \ } \ else \ { \ UNS_LATCH(&(_nameMsg)->curFile->FILEbeastLatch); \ UNS_LATCH(&(_nameMsg)->curDataStream->NAMEDbeastLatch); \ X_LATCH(&(_nameMsg)->curFile->FILEbeastLatch); \ X_LATCH(&(_nameMsg)->curDataStream->NAMEDbeastLatch); \ } \ if ((_nameMsg)->hlFile != NULL) \ X_LATCH(&(_nameMsg)->hlFile->HARDLbeastLatch); \ } #define COMN_DOWNLATCH_NAMEMSG_BEASTS(_nameMsg) \ { \ zASSERT((_nameMsg)->latchType == XLATCHED); \ (_nameMsg)->latchType = SLATCHED; \ if ((_nameMsg)->hlFile != NULL) \ DOWN_LATCH(&(_nameMsg)->hlFile->HARDLbeastLatch); \ if ((NamedBeast_s *)(_nameMsg)->curFile == (_nameMsg)->curDataStream) \ { \ DOWN_LATCH(&(_nameMsg)->curFile->FILEbeastLatch); \ } \ else \ { \ DOWN_LATCH(&(_nameMsg)->curDataStream->NAMEDbeastLatch); \ DOWN_LATCH(&(_nameMsg)->curFile->FILEbeastLatch); \ } \ } #define COMN_UNLATCH_NAMEMSG_BEASTS_KEEP_LATCHTYPE(_nameMsg) \ { \ if ((NamedBeast_s *) (_nameMsg)->hlFile != NULL) \ COND_UNLATCH(&(_nameMsg)->hlFile->HARDLbeastLatch, (_nameMsg)->latchType); \ if ((NamedBeast_s *)(_nameMsg)->curFile == (_nameMsg)->curDataStream) \ { \ if ((NamedBeast_s *)(_nameMsg)->curFile != NULL) \ COND_UNLATCH(&(_nameMsg)->curFile->FILEbeastLatch, (_nameMsg)->latchType); \ } \ else \ { \ if ((NamedBeast_s *)(_nameMsg)->curFile != NULL) \ COND_UNLATCH(&(_nameMsg)->curFile->FILEbeastLatch, (_nameMsg)->latchType); \ if ((NamedBeast_s *)(_nameMsg)->curDataStream != NULL) \ COND_UNLATCH(&(_nameMsg)->curDataStream->NAMEDbeastLatch, (_nameMsg)->latchType); \ } \ } #define COMN_UNLATCH_NAMEMSG_BEASTS(_nameMsg,_latchType) \ { \ COMN_UNLATCH_NAMEMSG_BEASTS_KEEP_LATCHTYPE(_nameMsg); \ *(_latchType) = (_nameMsg)->latchType; \ (_nameMsg)->latchType = NOTLATCHED; \ } #define COMN_LATCH_AND_USE_NAMEMSG_BEASTS(_nameMsg,_latchType) \ { \ COMN_USE_BEAST(&(_nameMsg)->curFile->FILEroot); \ COMN_USE_BEAST(&(_nameMsg)->curDataStream->NAMEDroot); \ if ((_nameMsg)->hlFile != NULL) \ COMN_USE_BEAST(&(_nameMsg)->hlFile->HARDLroot); \ (_nameMsg)->latchType = (_latchType); \ if ((NamedBeast_s *)(_nameMsg)->curFile == (_nameMsg)->curDataStream) \ { \ COND_LATCH(&(_nameMsg)->curFile->FILEbeastLatch, (_nameMsg)->latchType);\ } \ else \ { \ COND_LATCH(&(_nameMsg)->curFile->FILEbeastLatch, (_nameMsg)->latchType); \ COND_LATCH(&(_nameMsg)->curDataStream->NAMEDbeastLatch, (_nameMsg)->latchType); \ } \ if ((_nameMsg)->hlFile != NULL) \ COND_LATCH(&(_nameMsg)->hlFile->HARDLbeastLatch, (_nameMsg)->latchType); \ } #define COMN_UNLATCH_AND_RELEASE_NAMEMSG_BEASTS_KEEP_LATCHTYPE(_nameMsg) \ { \ if ((NamedBeast_s *)(_nameMsg)->curFile == (_nameMsg)->curDataStream) \ { \ if ((NamedBeast_s *)(_nameMsg)->curFile != NULL) \ COMN_UnlatchAndRelease(&(_nameMsg)->curFile, (_nameMsg)->latchType); \ COMN_Release(&(_nameMsg)->curDataStream); \ } \ else \ { \ if ((NamedBeast_s *)(_nameMsg)->curFile != NULL) \ COMN_UnlatchAndRelease(&(_nameMsg)->curFile, (_nameMsg)->latchType); \ if ((NamedBeast_s *)(_nameMsg)->curDataStream != NULL) \ COMN_UnlatchAndRelease(&(_nameMsg)->curDataStream, (_nameMsg)->latchType); \ } \ if ((NamedBeast_s *)(_nameMsg)->hlFile != NULL) \ COMN_UnlatchAndRelease(&(_nameMsg)->hlFile, (_nameMsg)->latchType); \ } #define COMN_UNLATCH_AND_RELEASE_NAMEMSG_BEASTS(_nameMsg,_latchType) \ { \ COMN_UNLATCH_AND_RELEASE_NAMEMSG_BEASTS_KEEP_LATCHTYPE(_nameMsg); \ *(_latchType) = (_nameMsg)->latchType; \ (_nameMsg)->latchType = NOTLATCHED; \ } /*--------------------------------------------------------------------------- * These macros are used to initialize a NAMING structure. *---------------------------------------------------------------------------*/ /* This must be called before all Name Message Macros */ #define COMN_INIT_NAMING_MSG(_nameMsg) \ (LB_bzero((_nameMsg),sizeof(NamingMsg_s))) /* For zHPT_SIMPLE - this is the most basic path option. */ #define COMN_SETUP_NAMING_MSG_SIMPLE(_nameMsg,_pathStr,_pathFmt, \ _pMode,_latchType,_nsid,_nType,_pMatch) \ ((_nameMsg)->handlePathType = zHPT_SIMPLE, \ (_nameMsg)->parseMode = (_pMode), \ (_nameMsg)->latchType = (_latchType), \ (_nameMsg)->path.voidPtr = (_pathStr), \ (_nameMsg)->pathFormat = (_pathFmt), \ (_nameMsg)->nameSpaceID = (_nsid), \ (_nameMsg)->nameType = (_nType), \ (_nameMsg)->match = (_pMatch)) /* For zHPT_FULL - this is a fully qualified path supporting all path options */ #define COMN_SETUP_NAMING_MSG_FULL(_nameMsg,_pathStr,_pathFmt,\ _pMode,_latchType,_nsid,_nType,_pMatch,_retPLen,_retVolume,_retpath) \ ((_nameMsg)->handlePathType = zHPT_FULL, \ (_nameMsg)->parseMode = (_pMode), \ (_nameMsg)->latchType = (_latchType), \ (_nameMsg)->pathFormat = (_pathFmt), \ (_nameMsg)->path.voidPtr = (_pathStr), \ (_nameMsg)->nameSpaceID = (_nsid), \ (_nameMsg)->nameType = (_nType), \ (_nameMsg)->match = (_pMatch), \ (_nameMsg)->retPathLen = (_retPLen), \ (_nameMsg)->retVolumeID = (_retVolume), \ (_nameMsg)->retPath = (_retpath)) /* For zHPT_CONTEXT - This is a path based on a context handle. The * path portion supports all path options. If the path is fully qualified, * it overrides the context handle */ #define COMN_SETUP_NAMING_MSG_CONTEXT(_nameMsg,_cxHndl,_pathStr,_pathFmt, \ _pMode,_latchType,_nsid,_nType,_pMatch,__retPLen, \ _retVolume,_retpath) \ ((_nameMsg)->handlePathType = zHPT_CONTEXT, \ (_nameMsg)->parseMode = (_pMode), \ (_nameMsg)->latchType = (_latchType), \ COMN_SET_CONTEXTHANDLE_ID(&(_nameMsg)->contextHandle,(_cxHndl)), \ (_nameMsg)->path.voidPtr = (_pathStr), \ (_nameMsg)->pathFormat = (_pathFmt), \ (_nameMsg)->nameSpaceID = (_nsid), \ (_nameMsg)->nameType = (_nType), \ (_nameMsg)->match = (_pMatch), \ (_nameMsg)->retPathLen = (__retPLen), \ (_nameMsg)->retVolumeID = (_retVolume), \ (_nameMsg)->retPath = (_retpath)) /* For zHPT_VOLUME - This is a path based on a volume ID. The * path portion supports all path options. If the path is fully qualified, * it overrides the volume ID */ #define COMN_SETUP_NAMING_MSG_VOLUME(_nameMsg,_volumeID,_pathStr,_pathFmt, \ _pMode,_latchType,_nsid,_nType,_pMatch,_retPLen, \ _retVolume,_retpath) \ ((_nameMsg)->handlePathType = zHPT_VOLUME, \ (_nameMsg)->parseMode = (_pMode), \ (_nameMsg)->latchType = (_latchType), \ (_nameMsg)->volumeID = (_volumeID), \ (_nameMsg)->path.voidPtr = (_pathStr), \ (_nameMsg)->pathFormat = (_pathFmt), \ (_nameMsg)->nameSpaceID = (_nsid), \ (_nameMsg)->nameType = (_nType), \ (_nameMsg)->match = (_pMatch), \ (_nameMsg)->retPathLen = (_retPLen), \ (_nameMsg)->retVolumeID = (_retVolume), \ (_nameMsg)->retPath = (_retpath)) /* For zHPT_VOLUME_ZID - This identifies a file object via a volumeID, * and zid. No path is allowed. */ #define COMN_SETUP_NAMING_MSG_VOLUME_ZID(_nameMsg,_volumeID, _pzid, \ _fzid,_dsZid,_latchType,_nsid,_nType,_pMatch) \ ((_nameMsg)->handlePathType = zHPT_VOLUME_ZID, \ (_nameMsg)->parseMode = NAMPMODE_Undefined, \ (_nameMsg)->latchType = (_latchType), \ (_nameMsg)->volumeID = (_volumeID), \ (_nameMsg)->fileParentZid = (_pzid), \ (_nameMsg)->fileZid = (_fzid), \ (_nameMsg)->dataStreamZid = (_dsZid), \ (_nameMsg)->nameSpaceID = (_nsid), \ (_nameMsg)->nameType = (_nType), \ (_nameMsg)->match = (_pMatch)) /* For zHPT_ADMIN_VOLUME - This is a path based on the Admin volume. The * path portion supports all path options. If the path is fully qualified, * it overrides the volume ID */ #define COMN_SETUP_NAMING_MSG_ADMIN_VOLUME(_nameMsg,_pathStr,_pathFmt, \ _pMode,_latchType,_nsid,_nType,_pMatch,_retPLen, \ _retVolume,_retpath) \ ((_nameMsg)->handlePathType = zHPT_ADMIN_VOLUME, \ (_nameMsg)->parseMode = (_pMode), \ (_nameMsg)->latchType = (_latchType), \ (_nameMsg)->path.voidPtr = (_pathStr), \ (_nameMsg)->pathFormat = (_pathFmt), \ (_nameMsg)->nameSpaceID = (_nsid), \ (_nameMsg)->nameType = (_nType), \ (_nameMsg)->match = (_pMatch), \ (_nameMsg)->retPathLen = (_retPLen), \ (_nameMsg)->retVolumeID = (_retVolume), \ (_nameMsg)->retPath = (_retpath)) /* For zHPT_ADMIN_VOLUME_ZID - This identifies a file object within the Admin * volume via a zid. No path is allowed. */ #define COMN_SETUP_NAMING_MSG_ADMIN_VOLUME_ZID(_nameMsg, _fzid,_dsZid, \ _latchType,_nsid,_nType,_pMatch) \ ((_nameMsg)->handlePathType = zHPT_ADMIN_VOLUME_ZID, \ (_nameMsg)->parseMode = NAMPMODE_Undefined, \ (_nameMsg)->latchType = (_latchType), \ (_nameMsg)->fileParentZid = zINVALID_ZID, \ (_nameMsg)->fileZid = (_fzid), \ (_nameMsg)->dataStreamZid = (_dsZid), \ (_nameMsg)->nameSpaceID = (_nsid), \ (_nameMsg)->nameType = (_nType), \ (_nameMsg)->match = (_pMatch)) /* For zHPT_FILEHANDLEID - This identifies a file object based on a * fileHandleID. */ #define COMN_SETUP_NAMING_MSG_FILEHANDLEID(_nameMsg,_fhID,_latchType,_nsid, \ _nType) \ ((_nameMsg)->handlePathType = zHPT_FILEHANDLEID, \ (_nameMsg)->parseMode = NAMPMODE_Undefined, \ COMN_SET_FILEHANDLE_ID(&(_nameMsg)->fileHandle,(_fhID)), \ (_nameMsg)->latchType = (_latchType), \ (_nameMsg)->nameSpaceID = (_nsid), \ (_nameMsg)->nameType = (_nType)) /* For zHPT_VOLUME_ZID_PATH - This identifies a file object based on a starting * volumeID, Zid, and a path string relative the the Zid. */ #define COMN_SETUP_NAMING_MSG_VOLUME_ZID_PATH(_nameMsg,_volumeID, \ _fzid,_znType,_pathStr,_pathFmt,_pMode,_latchType, \ _nsid,_nType,_pMatch,_retPLen,_retVolume,_retpath) \ ((_nameMsg)->handlePathType = zHPT_VOLUME_ZID_PATH, \ (_nameMsg)->parseMode = (_pMode), \ (_nameMsg)->latchType = (_latchType), \ (_nameMsg)->volumeID = (_volumeID), \ (_nameMsg)->fileParentZid = zINVALID_ZID, \ (_nameMsg)->fileZid = (_fzid), \ (_nameMsg)->zidNameType = (_znType), \ (_nameMsg)->dataStreamZid = (_fzid), \ (_nameMsg)->path.voidPtr = (_pathStr), \ (_nameMsg)->pathFormat = (_pathFmt), \ (_nameMsg)->nameSpaceID = (_nsid), \ (_nameMsg)->nameType = (_nType), \ (_nameMsg)->match = (_pMatch), \ (_nameMsg)->retPathLen = (_retPLen), \ (_nameMsg)->retVolumeID = (_retVolume), \ (_nameMsg)->retPath = (_retpath)) /* For zHPT_ADMIN_VOLUME_ZID_PATH - This identifies a file object based on the * admin volume, Zid, and a path string relative the the Zid. */ #define COMN_SETUP_NAMING_MSG_ADMIN_VOLUME_ZID_PATH(_nameMsg,_fzid, \ _znType,_pathStr,_pathFmt,_pMode,_latchType,_nsid, \ _nType,_pMatch,_retPLen,_retVolume,_retpath) \ ((_nameMsg)->handlePathType = zHPT_ADMIN_VOLUME_ZID_PATH, \ (_nameMsg)->parseMode = (_pMode), \ (_nameMsg)->latchType = (_latchType), \ (_nameMsg)->fileParentZid = zINVALID_ZID, \ (_nameMsg)->fileZid = (_fzid), \ (_nameMsg)->zidNameType = (_znType), \ (_nameMsg)->dataStreamZid = (_fzid), \ (_nameMsg)->path.voidPtr = (_pathStr), \ (_nameMsg)->pathFormat = (_pathFmt), \ (_nameMsg)->nameSpaceID = (_nsid), \ (_nameMsg)->nameType = (_nType), \ (_nameMsg)->match = (_pMatch), \ (_nameMsg)->retPathLen = (_retPLen), \ (_nameMsg)->retVolumeID = (_retVolume), \ (_nameMsg)->retPath = (_retpath)) /* For zHPT_SEARCH_PATTERN - this option is used for containing a search pattern * as in COMN_ReadDir or some calls to COMN_Rename. */ #define COMN_SETUP_NAMING_MSG_PATTERN(_nameMsg,_pattern, \ _nSpace,_nType,_patfmt,_pMatch) \ ((_nameMsg)->handlePathType = zHPT_SEARCH_PATTERN, \ (_nameMsg)->parseMode = NAMPMODE_Undefined, \ (_nameMsg)->latchType = XLATCHED, \ (_nameMsg)->path.voidPtr = (_pattern), \ (_nameMsg)->pathFormat = (_patfmt), \ (_nameMsg)->nameSpaceID = (_nSpace), \ (_nameMsg)->nameType = (_nType), \ (_nameMsg)->match = (_pMatch)) /* For internal use where we already have a file beast pointer. * WARNING!!! WARNING!!! WARNING!!! * The caller of this MACRO must call COMN_USE_BEAST * on the following beast pointers BEFORE calling this macro: * _volume ( both standard useCount and the keepActiveUseCount must be incremented) * _beast (twice, once for curFile and once for curDataStream) * _nSpace * The caller must also latch the beast before calling this function and * must pass in how it was latched (_latchType). */ #define COMN_SETUP_NAMING_MSG_FILE_BEAST_PTR(_nameMsg,_volume,_pZid, \ _beast,_pMode,_latchType,_nSpace,_nType,_pMatch) \ ((_nameMsg)->handlePathType = zHPT_VOLUME_ZID, \ (_nameMsg)->parseFlags = NAMPFL_nameMsgFullyResolved, \ (_nameMsg)->parseMode = (_pMode), \ (_nameMsg)->latchType = (_latchType), \ (_nameMsg)->curvol = (_volume), \ (_nameMsg)->volumeID = (_volume)->VOLvolumeID, \ (_nameMsg)->fileParentZid = (_pZid), \ zASSERT(COMN_IsDerivedFrom((_beast),zFTYPE_FILE)), \ (_nameMsg)->curFile = (_beast), \ (_nameMsg)->curDataStream = ((NamedBeast_s *)(_beast)), \ (_nameMsg)->zidNameType = (_nType), \ (_nameMsg)->fileNameType = (_nType), \ (_nameMsg)->nameType = (_nType), \ (_nameMsg)->workNameType = (_nType), \ (_nameMsg)->workNameSpace = (_nSpace), \ (_nameMsg)->nameSpaceID = (_nSpace)->nSpaceID, \ (_nameMsg)->workNameSpaceID = (_nSpace)->nSpaceID, \ (_nameMsg)->match = (_pMatch)) /* For internal use where we already have a beast pointer. * WARNING!!! WARNING!!! WARNING!!! * You must follow the same rules as "COMN_SETUP_NAMING_MSG_BEAST_PTR" plus * the work buffer MUST be allocated by calling "COMN_GetPathNameWorkBuffer" * The work Buffer must point to a single component in unicode format. */ #define COMN_SETUP_NAMING_MSG_FILE_BEAST_PTR_WITH_WORKBUF(_nameMsg,_volume, \ _pZid,_beast,_pMode,_latchType,_nSpace, \ _nType,_pMatch,_workBuf) \ (COMN_SETUP_NAMING_MSG_FILE_BEAST_PTR(_nameMsg,_volume,_pZid, \ _beast,_pMode,_latchType,_nSpace, \ _nType,_pMatch),\ (_nameMsg)->handlePathType = zHPT_VOLUME_ZID_PATH, \ (_nameMsg)->workBuffer = (_workBuf), \ NSPACE_SETUP_UNICODE_SCAN_MSG(&(_nameMsg)->scanMsg,0,NULL, \ (_workBuf)), \ (_nameMsg)->scanMsg.retUnicodeComp = (_workBuf), \ (_nameMsg)->scanMsg.retScanFlags = NSRETSFL_componentIsUnicode, \ (_nameMsg)->retParseFlags = (NAMRETPFL_haveAParsedComponent | \ NAMRETPFL_lastComponent)) /*--------------------------------------------------------------------------- * These macro are used to modify a naming structure AFTER it is setup. *---------------------------------------------------------------------------*/ /* use this to set naming mode values*/ #define COMN_SET_NAMING_MSG_NAMETYPES(_nameMsg,_nType) \ ((_nameMsg)->nameType = (_nType), \ (_nameMsg)->zidNameType = (_nType)) /* use this to set naming mode values*/ #define COMN_SET_NAMING_MSG_PARSEMODE(_nameMsg,_pMode) \ ((_nameMsg)->parseMode = (_pMode)) /* add the volume pointer to the name message. NOTE -- The volume pointer * must have both the basic useCount and the keepActiveUseCount incremented * whenever a nameMsg points to it. */ #define COMN_SET_NAMING_MSG_VOLUME(_nameMsg,_vol) \ ((_nameMsg)->curvol=(_vol)) /* add a path count to the name message */ #define COMN_SET_NAMING_MSG_PATHCOUNT(_nameMsg,_pathcnt) \ ((_nameMsg)->pathCount=(_pathcnt)) /* add a path length to the name message */ #define COMN_SET_NAMING_MSG_PATHLENGTH(_nameMsg,_pathlen) \ ((_nameMsg)->pathLength=(_pathlen)) /* use this to set naming flags to allow wildcarding */ #define COMN_ALLOW_WILDCARDING(_nameMsg) \ ((_nameMsg)->parseFlags |= NAMPFL_allowWildcardChars) /* use this to set naming flags to disallow wildcarding */ #define COMN_DISALLOW_WILDCARDING(_nameMsg) \ ((_nameMsg)->parseFlags &= ~NAMPFL_allowWildcardChars) /* use this to set an override unicode_t conversion rule table and * and override validCharBitMap. These fields are ignored unless the * input path in in ASCII format. */ #define COMN_SET_NAMING_MSG_ASCII_CONVERT_OVERRIDES(_nameMsg,_convType,_bMap) \ ((_nameMsg)->scanMsg.uniConversionType = (_convType), \ (_nameMsg)->scanMsg.asciiValidCharBitMap = (_bMap)) /* Use this to disable uppercasing of ascii strings during the validation * Only use this when the string is already guaranteed to be upper case */ #define COMN_SET_NAMING_MSG_DONT_UPPERCASE_ASCII(_nameMsg) \ ((_nameMsg)->scanMsg.scanFlags |= NSSFL_dontUpperCaseAscii) /* Use this to disable treatment of break characters as special characters. * With this bit set, the second character will not be treated as part of * a two byte sequence. */ #define COMN_SET_NAMING_MSG_BREAK_NOT_SPECIAL(_nameMsg) \ ((_nameMsg)->scanMsg.scanFlags |= NSSFL_asciiBreakNotSpecial) /* Use this to tell the parsing code to insert ascii break characters */ #define COMN_SET_NAMING_MSG_INSERT_BREAKS(_nameMsg) \ ((_nameMsg)->scanMsg.scanFlags |= NSSFL_insertAsciiBreaks) /* Use this to tell the parsing code to allow short ascii length strings */ #define COMN_SET_NAMING_MSG_ALLOW_SHORT_ASCII_LEN(_nameMsg) \ ((_nameMsg)->scanMsg.scanFlags |= NSSFL_allowShortAsciiLenStrings) /* Use this to disable rights checks on Open and create */ #define COMN_SET_NAMING_MSG_DONT_DO_RIGHTS_CHECKS(_nameMsg) \ ((_nameMsg)->parseFlags |= NAMPFL_dontDoRightsChecks) /* Use this to disable visibility checks on Open */ #define COMN_SET_NAMING_MSG_DONT_DO_VISIBILITY_CHECKS(_nameMsg) \ ((_nameMsg)->parseFlags |= NAMPFL_dontDoVisibilityChecks) /* Use this to tell the parsing code to force convert the component to unicode */ #define COMN_SET_NAMING_MSG_FORCE_CONVERT_TO_UNICODE(_nameMsg) \ ((_nameMsg)->scanMsg.scanFlags |= NSSFL_forceConvertToUnicode) /* Use this to set naming flags to allow operating on links themselves */ #define COMN_SET_NAMING_MSG_OPERATE_ON_LINK(_nameMsg) \ ((_nameMsg)->parseFlags |= NAMPFL_operateOnLinkItself) /* Use this to set naming flags to allow operating on links themselves */ #define COMN_SET_NAMING_MSG_FULLY_RESOLVED(_nameMsg) \ ((_nameMsg)->parseFlags |= NAMPFL_nameMsgFullyResolved) /* Use this to set naming flags to allow operating on links themselves */ #define COMN_SET_NAMING_MSG_DONT_LOCK_VOLUME_ACTIVE(_nameMsg) \ ((_nameMsg)->parseFlags |= NAMPFL_dontLockVolumeActive) /* Use this to tell the parsing code to allow short ascii length strings */ #define COMN_SET_NAMING_MSG_CONTINUE_AFTER_ILLEGAL_CHARS(_nameMsg) \ ((_nameMsg)->scanMsg.scanFlags |= NSSFL_continueAfterIllegalChars) /* Use this to set naming flags to instruct the parsing code to try a lookup * in the DOS name space if a lookup in the LONG name space fails. */ #define COMN_SET_NAMING_MSG_TRY_DOS_IF_LONG_FAILS(_nameMsg) \ ((_nameMsg)->parseFlags |= NAMPFL_tryDosIfLongFails) /* Use this to set the fact that the open is from VFS layer and so * no need to get an extra usecount on the inode */ #define COMN_SET_VFS_MODE_OPEN(_nameMsg) \ ((_nameMsg)->parseFlags |= NAMPFL_noExtraInodeCount) /*------------------------------------------------------------------------- * These are the parseMode and parseFlag defines for naming *------------------------------------------------------------------------- * NamingMsg.parseMode - These modes control how the path string in * "nameMsg->path" is processed. As the path string is parsed the * separate name components are validated and copied into the * "nameMsg->workName" buffer. The purpose of the name parsing routines * is to get the address of the beast structure that is associated with * the given name. This structure is returned in "nameMsg->curBeast". * * Definition of terms: * leaf name - The last name component on a filename string *-------------------------------------------------------------------------*/ #define NAMPMODE_Undefined 0 /* undefined mode */ #define NAMPMODE_DoNotResolveLeafName 1 /* Resolve path string down to the * leaf name. This does NOT convert the leaf * name to a beast pointer. * The "nameMsg->curComponent" field is * left pointing to the leaf name. * You get the beast of the parent directory * in "nameMsg->curBeast". */ #define NAMPMODE_FullyResolveAny 2 /* Fully resolve the path string * to the final component. The final beast * may be either a container or a * non-container */ #define NAMPMODE_FullyResolveNonDirectory 3 /* Fully resolve the path string * to the final component. The final beast * must be a non-directory container. */ #define NAMPMODE_FullyResolveDirectory 4 /* Fully resolve the path string * to the final component. The final beast * must be a directory container. */ /*--------------------------------------------------------------------------- * NamingMsg.parseFlags - These are additional mode bits the control different * aspects of parsing the name. *---------------------------------------------------------------------------*/ #define NAMPFL_dontDoVisibilityChecks 0x0001 /* If SET, the path lookup code should not * do any visibility checking. This flag can * only be set by internal APIs -- never * by an external NCP */ #define NAMPFL_dontDoRightsChecks 0x0002 /* If SET, the path lookup code should not * do any rights checking. This flag can * only be set by internal APIs -- never * by an external NCP */ #define NAMPFL_allowWildcardChars 0x0004 /* If SET, allow wildcard chars in the * leaf name during name validation*/ #define NAMPFL_mustBeFullyQualified 0x0008 /* If SET, the nameMsg must contain a * fully qualified path. */ #define NAMPFL_nameMsgValidated 0x0010 /* If SET, the NMSG_ValidateNameMsg * function has already been called on * this nameMsg and it does not need to * be called again. */ #define NAMPFL_nameMsgFullyResolved 0x0020 /* This flag is set once the name message * has been fully resolved (including * match attribute checking). When this * flag is set, subsequent calls to * COMN_Lookup will return immediately */ #define NAMPFL_operateOnLinkItself 0x0040 /* If SET and the object being named is a link, the associated operation is to be carried out on the link itself instead of the object to which the link refers. */ #define NAMPFL_dontLockVolumeActive 0x0080 /* If SET, the curvol pointer in the * nameMsg will not be required to point * to an ACTIVE volume, and it will not * have its keepActiveUseCount incremented */ #define NAMPFL_tryDosIfLongFails 0x0100 /* If SET, the lookup code should try the * DOS namespace if a lookup in the LONG * namespace fails. */ #define NAMPFL_XLatchAfterLookup 0x0200 /* If SET, the lookup will do SLATCHES * all the way down until we consider * the beast to be fully resolved. Then * we will convert the latching to an * XLatch */ #define NAMPFL_dontProcessHardLink 0x0400 /* If SET, do NOT return the primary beast * when a hardlink beast is detected, rather * just return the hardlink beast */ #define NAMPFL_noExtraInodeCount 0x0800 /* If SET the open request is from the VFS * layer, so do not get an extra use count * on the inode and no need for the fh to * point to this inode. VFS layer knows the * file is open and will keep a use count on * the inode. The reason we need this is * because the file lease code assumes a * direct corelation between the i_count * value and number of times the file is open. */ /*--------------------------------------------------------------------------- * NamingMsg.retParseFlags - These are options that are set by the namespace * parsing routine "GetAndValidateNextName" they inform the upper layers * the current status of name parsing. *---------------------------------------------------------------------------*/ #define NAMRETPFL_haveAParsedComponent 0x01 /* If SET, we have a parsed component in * the scanMsg */ #define NAMRETPFL_lastComponent 0x02 /* If SET, we have processed the last * component in a path string */ #define NAMRETPFL_hasDeletedNameType 0x04 /* if SET, the deleted name type was * encountered in the path parsing, meaning * that the file is in the deleted * salvage system and cannot be modified */ #define NAMRETPFL_changeNameSpace 0x08 /* If SET, the last component parsed included * a change of name space. We save this * flag here and don't do the actual change * until the next scan component, because * when dealing with ASCII name caches we * need to keep the old name space around * until we are done with the cur component */ #define NAMRETPFL_foundDOSNameWithLong 0x40 /* (This bit is not set by the namespace * parsing code.) It is set by * NAME_FindNameInDirSpecialRules if a * lookup finds a name in the DOS namespace * when LONG was specified. */ #define NAMRETPFL_parentIsImmCompress 0x80 /* (This bit is not set by the namespace * parsing code.) It is set by COMN_Lookup * if the parent directory of a file has * the immediate compress attribute bit set */ #ifdef __cplusplus } #endif #endif /* _MSGNAME_H_ */