815 lines
33 KiB
C
815 lines
33 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: 2008-06-18 01:06:57 +0530 (Wed, 18 Jun 2008) $
|
|
|
|
|
| $RCSfile$
|
|
| $Revision: 2381 $
|
|
|
|
|
|---------------------------------------------------------------------------
|
|
| 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 _COMNPARAMS_H_
|
|
#define _COMNPARAMS_H_
|
|
|
|
#ifndef _MSGGEN_H_
|
|
# include <msgGen.h>
|
|
#endif
|
|
|
|
#ifndef _XUNICODE_H_
|
|
#include <xUnicode.h>
|
|
#endif
|
|
|
|
#ifndef _COMNBEASTS_H_
|
|
# include <comnBeasts.h>
|
|
#endif
|
|
|
|
#ifndef _ZPARAMS_H_
|
|
# include <zParams.h>
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* Typedefs for structures used by comnPublics.h but not defined here
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
typedef struct NamingMsg_s NamingMsg_s;
|
|
typedef struct FileIOMsg_s FileIOMsg_s;
|
|
typedef struct AsyncFileIOMsg_s AsyncFileIOMsg_s;
|
|
typedef struct DirectFileIOMsg_s DirectFileIOMsg_s;
|
|
typedef struct Volume_s Volume_s;
|
|
typedef struct NameSpaceOps_s NameSpaceOps_s;
|
|
typedef struct ContextHandleInfo_s ContextHandleInfo_s;
|
|
typedef struct NameSpace_s NameSpace_s;
|
|
typedef struct FileHandle_s FileHandle_s;
|
|
typedef struct NSSConnection_s NSSConnection_s;
|
|
typedef struct SAHandle_s SAHandle_s;
|
|
typedef struct ByteRangeMsg_s ByteRangeMsg_s;
|
|
typedef struct UserXaction_s UserXaction_s;
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* Semantic Agent IDs -- NOTE- these are used as an array index, so keep them
|
|
* starting at 0 with no holes...
|
|
*---------------------------------------------------------------------------*/
|
|
#define zSAGENT_NONE 0
|
|
#define zSAGENT_Z 1
|
|
#define zSAGENT_NETWARE 2
|
|
#define zSAGENT_NFS 3
|
|
#define zSAGENT_HTTP 4
|
|
#define zSAGENT_CIFS 5
|
|
#define zSAGENT_LSA 6
|
|
|
|
#define zSAGENT_MAX_ID 32 /* the volevent subsystem keeps an array indexed
|
|
* by semantic agent ID. This is the size of
|
|
* that array. If we ever need to support more
|
|
* than this number of semantic agents, this
|
|
* number needes to be expanded. */
|
|
|
|
#if BLKNUM_64 IS_DISABLED
|
|
#define zMAX_FILE_SIZE ((UI64_CONST(1) << 43) - 1) /* 31 bits for Blknum_t and
|
|
* 12 bits for size of a blk.
|
|
*/
|
|
#endif
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* Volume Event Types
|
|
*---------------------------------------------------------------------------*/
|
|
#define zVOLEVENT_DEACTIVATE_WARNING 1
|
|
#define zVOLEVENT_DEACTIVATED 2
|
|
#define zVOLEVENT_IS_VOL_VISIBLE 3
|
|
#define zVOLEVENT_ATTRIBUTES_CHANGED 4
|
|
#define zVOLEVENT_NAME_CHANGED 5 /* Greg added for changing names
|
|
* of active volumes. Added as
|
|
* part of LVs. NWSA uses to
|
|
* change name of volume stored in
|
|
* mount table.
|
|
*/
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* This structure defines the volume event functions
|
|
*---------------------------------------------------------------------------*/
|
|
typedef struct VolEventFunctions_s
|
|
{
|
|
/* volume is about to be deactivated : zVOLEVENT_DEACTIVATE_WARNING */
|
|
STATUS (*volumeDeactivateWarning)(
|
|
struct GeneralMsg_s *genMsg,
|
|
Volume_s *volume);
|
|
|
|
/* volume is deactivated : zVOLEVENT_DEACTIVATED */
|
|
void (*volumeDeactivated)(
|
|
VolumeID_t *volumeID);
|
|
|
|
/* see if volume is visible to semantic agent : zVOLEVENT_IS_VOL_VISIBLE */
|
|
STATUS (*VolumeOverrideInPath)(
|
|
struct GeneralMsg_s *genMsg,
|
|
Volume_s *volume);
|
|
|
|
/* volume's volAttributes field changed. : zVOLEVENT_ATTRIBUTES_CHANGED */
|
|
STATUS (*VolumeAttributesChanged)(
|
|
struct GeneralMsg_s *genMsg,
|
|
Volume_s *volume);
|
|
|
|
/* volume's name changed. : */
|
|
STATUS (*VolumeNameChanged)(
|
|
struct GeneralMsg_s *genMsg,
|
|
Volume_s *volume,
|
|
unicode_t *volumeName);
|
|
} VolEventFunctions_s;
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* This global is an array indexed by semantic agent ID.
|
|
*---------------------------------------------------------------------------*/
|
|
extern struct VolEventFunctions_s *VolumeEventFuncs[];
|
|
|
|
#if zLINUX
|
|
/*---------------------------------------------------------------------------
|
|
* This structure defines the volume event functions
|
|
*---------------------------------------------------------------------------*/
|
|
typedef struct LinuxConnectionCallbackFunctions_s
|
|
{
|
|
/* Given a connectionID (uid), return a pointer to the NSS Connection struct */
|
|
STATUS (*GetLinuxConnectionNSS)(
|
|
LONG connectionID, /* This is the uid */
|
|
struct NSSConnection_s **nssConn);
|
|
|
|
/* Given a connectionID (uid), set a pointer to the NSS Connection struct */
|
|
STATUS (*SetLinuxConnectionNSS)(
|
|
LONG connectionID, /* This is the uid */
|
|
struct NSSConnection_s *nssConn,
|
|
struct NSSConnection_s **nssConnOld);
|
|
|
|
/* Given a connectionID (uid), return the FDN of the logged-in user */
|
|
STATUS (*GetLinuxAuthIDsList)(
|
|
LONG connectionID,
|
|
LONG *numberOfAuthIDs,
|
|
GUID_t **AuthIDList);
|
|
|
|
/* Given a connectionID (uid), return TRUE if the connection is supervisor */
|
|
BOOL (*GetLinuxIsSupervisor)(
|
|
LONG connectionID);
|
|
|
|
/* Given an FDN, create a connection */
|
|
STATUS (*CreateLinuxConnectionNSS)(
|
|
unicode_t *fdn,
|
|
LONG *pconnID);
|
|
|
|
/* Given an connID, delete a connection */
|
|
void (*DeleteLinuxConnectionNSS)(
|
|
LONG connID);
|
|
|
|
} LinuxConnectionCallbackFunctions_s;
|
|
#endif
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* This defines the message structure for getting version information
|
|
*---------------------------------------------------------------------------*/
|
|
typedef struct COMNVersionInformation_s
|
|
{
|
|
NINT majorVersion; /* 1-nn */
|
|
NINT minorVersion; /* 0-nn */
|
|
NINT subVersion; /* 0-nn */
|
|
NINT buildNumber; /* 1-nnnn */
|
|
NINT apiVersion; /* 1-x */
|
|
NINT debugEnabled; /* TRUE or FALSE */
|
|
NINT reserved[10];
|
|
} COMNVersionInformation_s;
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* This defines the message structure for creating a beast
|
|
*---------------------------------------------------------------------------*/
|
|
typedef struct CreateMsg_s
|
|
{
|
|
NINT beastClassID; /* the type of beast */
|
|
|
|
NINT attributes;
|
|
UserID_t ownerID;
|
|
NINT createFlags;
|
|
void *createParms; /* type specific information */
|
|
|
|
NINT requestedRights; /* (create and open) see pssparms.h*/
|
|
NINT grantedRights;
|
|
NINT inheritedRightsMask; /** This is only used by FSHOOKS. No one
|
|
** else in the common layer uses it. **/
|
|
|
|
NINT ret_openCreateAction; /* return bitmask indicating actions taken */
|
|
} CreateMsg_s;
|
|
|
|
#define COMN_SETUP_CREATE_FILE_MSG(_createMsg, _type, _attr, _owner, \
|
|
_rights, _crFlags, _crParms) \
|
|
((_createMsg)->beastClassID = (_type), \
|
|
(_createMsg)->attributes = (_attr), \
|
|
(_createMsg)->ownerID = (_owner), \
|
|
(_createMsg)->requestedRights = (_rights), \
|
|
(_createMsg)->createFlags = (_crFlags), \
|
|
(_createMsg)->createParms = (_crParms), \
|
|
(_createMsg)->inheritedRightsMask = 0xFFFF)
|
|
|
|
#define COMN_SET_RIGHTS_IN_CREATE_MSG(_createmsg, _rights) \
|
|
((_createmsg)->inheritedRightsMask = (_rights))
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* Definintion of ret_openCreateAction flags
|
|
*---------------------------------------------------------------------------*/
|
|
#define zBEAST_EXISTED 0x00000001 /* The beast previously existed */
|
|
#define zBEAST_CREATED 0x00000002 /* The beast was created/re-created */
|
|
#define zBEAST_TRUNCATED 0x00000004 /* The beast existed and was truncated */
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* This defines the message structure for deleting a beast
|
|
*---------------------------------------------------------------------------*/
|
|
typedef struct DeleteMsg_s
|
|
{
|
|
NINT deleteFlags;
|
|
} DeleteMsg_s;
|
|
|
|
#define COMN_SETUP_DELETE_FILE_MSG(_deleteMsg, _delFlags) \
|
|
((_deleteMsg)->deleteFlags = (_delFlags))
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* This defines the message structure for getting a file map
|
|
*---------------------------------------------------------------------------*/
|
|
typedef struct FileMapMsg_s
|
|
{
|
|
QUAD startingOffset; /* start offset for the map */
|
|
NINT extentListCount; /* num elements to fit in ret list */
|
|
NINT extentListFormat; /* format for the return extent list */
|
|
void *ret_extentList; /* return buffer for the extents */
|
|
QUAD ret_endingOffset; /* ending offset for the map */
|
|
NINT ret_extentListCount; /* return count of num elements */
|
|
} FileMapMsg_s;
|
|
|
|
#define COMN_SETUP_FILE_MAP_MSG(_mapMsg,_start,_count,_format,_retList) \
|
|
((_mapMsg)->startingOffset = (_start), \
|
|
(_mapMsg)->extentListCount = (_count), \
|
|
(_mapMsg)->extentListFormat = (_format), \
|
|
(_mapMsg)->ret_extentList = (_retList))
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* This defines the message structure for getting the name/path info on a beast
|
|
*---------------------------------------------------------------------------*/
|
|
typedef struct GetNameMsg_s
|
|
{
|
|
/* Info for FileType-generic information */
|
|
NINT getNameMask; /* which optional path info to get */
|
|
NINT internalFlags; /* Internal only flags for get file name */
|
|
NINT pathFormat; /* path format to get name in */
|
|
NINT nameSpaceID; /* namespace to get name in */
|
|
NINT sizeRetGetName; /* sz of buf to receive info */
|
|
struct zGetName_s *ret_getName; /* buffer to put path info into */
|
|
} GetNameMsg_s;
|
|
|
|
/* Definition of internalFlags for GetNameMsg_s */
|
|
#define GFN_NO_SEPARATOR_AFTER_VOLUME_COLON 0x00000001
|
|
#define GFN_USE_OLD_DOS_PATH_SEPARATORS 0x00000002
|
|
|
|
#define COMN_SETUP_GET_NAME_MSG(_gnMsg,_gnMask,_iflg,_pfmt,_nsid, \
|
|
_retBuf,_retBufSize) \
|
|
((_gnMsg)->getNameMask = (_gnMask), \
|
|
(_gnMsg)->internalFlags = (_iflg), \
|
|
(_gnMsg)->pathFormat = (_pfmt), \
|
|
(_gnMsg)->nameSpaceID = (_nsid), \
|
|
(_gnMsg)->ret_getName = (_retBuf), \
|
|
(_gnMsg)->sizeRetGetName = (_retBufSize))
|
|
|
|
#define COMN_ZINFO_INIT( _info, _size, _version ) \
|
|
((_info)->infoVersion = (_version), \
|
|
(_info)->totalBytes = (_size), \
|
|
((_info)->nextByte = \
|
|
((_version) == zINFO_VERSION_A) ? \
|
|
offsetof(zInfo_s, variableData) : \
|
|
(((_version) == zINFO_VERSION_B) ? \
|
|
offsetof(zInfoB_s, variableData) : \
|
|
(((_version) == zINFO_VERSION_C) ? \
|
|
offsetof(zInfoC_s, variableData) : \
|
|
offsetof(zInfoD_s, variableData)))), \
|
|
(_info)->padding = 0, \
|
|
(_info)->retMask = 0 )
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* This defines the message structure for getting Info on a beast
|
|
*---------------------------------------------------------------------------*/
|
|
typedef struct GetInfoMsg_s
|
|
{
|
|
/* Info for FileType-generic information */
|
|
NINT getInfoMask; /* which optional info to get */
|
|
struct zInfo_s *ret_getInfo; /* buffer to put info into */
|
|
NINT nameSpaceID; /* namespace to get name in */
|
|
struct HardLinkBeast_s *hlFile; /* point to a hardlink file that contains the desired name */
|
|
/* cnt nameUniquifier; name uniquifier - for name options */
|
|
|
|
/* Info for FileType-specific information */
|
|
NINT getTypeInfoMask; /* which type-specific optional info */
|
|
NINT sizeRetGetTypeInfo; /* sz of buf for type-specific info */
|
|
void *ret_getTypeInfo; /* buffer for type-specific info */
|
|
BOOL snapShotFileInfo; /* set to get info on snapshot file */
|
|
} GetInfoMsg_s;
|
|
|
|
#define COMN_SETUP_GET_INFO_MSG(_infoMsg, _infoMask, _nsid, _retInfoBuf,\
|
|
_retInfoSize, _infoVer) \
|
|
((_infoMsg)->getInfoMask = (_infoMask), \
|
|
(_infoMsg)->nameSpaceID = (_nsid), \
|
|
(_infoMsg)->hlFile = 0, \
|
|
(_infoMsg)->ret_getInfo = (_retInfoBuf), \
|
|
(_infoMsg)->getTypeInfoMask = 0, \
|
|
(_infoMsg)->sizeRetGetTypeInfo = 0, \
|
|
(_infoMsg)->ret_getTypeInfo = 0, \
|
|
(_infoMsg)->snapShotFileInfo = FALSE, \
|
|
(_retInfoBuf)->infoVersion = (_infoVer), \
|
|
(_retInfoBuf)->totalBytes = (_retInfoSize), \
|
|
(_retInfoBuf)->nextByte = \
|
|
((_infoVer) == zINFO_VERSION_A) ? \
|
|
offsetof(zInfo_s, variableData) : \
|
|
(((_infoVer) == zINFO_VERSION_B) ? \
|
|
offsetof(zInfoB_s, variableData) : \
|
|
(((_infoVer) == zINFO_VERSION_C) ? \
|
|
offsetof(zInfoC_s, variableData) : \
|
|
offsetof(zInfoD_s, variableData))))
|
|
|
|
#define COMN_SETUP_GET_TYPE_INFO_MSG(_infoMsg, _infoMask, _nsid, \
|
|
_retInfoBuf, _retInfoSize, _infoVer, _typeInfoMask, \
|
|
_retTypeInfoBuf, _retTypeInfoSize) \
|
|
((_infoMsg)->getInfoMask = (_infoMask), \
|
|
(_infoMsg)->nameSpaceID = (_nsid), \
|
|
(_infoMsg)->hlFile = 0, \
|
|
(_infoMsg)->getTypeInfoMask = (_typeInfoMask), \
|
|
(_infoMsg)->sizeRetGetTypeInfo = (_retTypeInfoSize), \
|
|
(_infoMsg)->ret_getTypeInfo = (_retTypeInfoBuf), \
|
|
(_infoMsg)->ret_getInfo = (_retInfoBuf), \
|
|
(_infoMsg)->snapShotFileInfo = FALSE, \
|
|
(_retInfoBuf)->infoVersion = (_infoVer), \
|
|
(_retInfoBuf)->totalBytes = (_retInfoSize), \
|
|
(_retInfoBuf)->nextByte = \
|
|
((_infoVer) == zINFO_VERSION_A) ? \
|
|
offsetof(zInfo_s, variableData) : \
|
|
(((_infoVer) == zINFO_VERSION_B) ? \
|
|
offsetof(zInfoB_s, variableData) : \
|
|
(((_infoVer) == zINFO_VERSION_C) ? \
|
|
offsetof(zInfoC_s, variableData) : \
|
|
offsetof(zInfoD_s, variableData))))
|
|
|
|
#define COMN_SETUP_GET_VOL_INFO_MSG(_infoMsg, _nsid, _typeInfoMask, \
|
|
_retTypeInfoBuf, _retTypeInfoSize) \
|
|
((_infoMsg)->getInfoMask = 0, \
|
|
(_infoMsg)->nameSpaceID = (_nsid), \
|
|
(_infoMsg)->getTypeInfoMask = (_typeInfoMask), \
|
|
(_infoMsg)->sizeRetGetTypeInfo = (_retTypeInfoSize), \
|
|
(_infoMsg)->ret_getTypeInfo = (_retTypeInfoBuf), \
|
|
(_infoMsg)->ret_getInfo = 0, \
|
|
(_infoMsg)->snapShotFileInfo = FALSE)
|
|
|
|
extern STATUS COMN_InfoInitFileName(
|
|
zInfo_s *info,
|
|
NINT numNameSpaces);
|
|
|
|
extern STATUS COMN_InfoPutFileName(
|
|
zInfo_s *info,
|
|
NINT nameSpace,
|
|
unicode_t *name);
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* This defines the message structure for linking a beast.
|
|
*---------------------------------------------------------------------------*/
|
|
typedef struct LinkMsg_s
|
|
{
|
|
NINT linkFlags;
|
|
// cnt NINT retNameUniquifier; /* New name uniquifier for the beast's new name */
|
|
} LinkMsg_s;
|
|
|
|
#define COMN_SETUP_LINK_MSG(_linkMsg, _linkFlags) \
|
|
((_linkMsg)->linkFlags = (_linkFlags))
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* This defines the message structure for opening a beast
|
|
*---------------------------------------------------------------------------*/
|
|
/* Whoever wishes OPEN call to be suspended and tried later due to a
|
|
* conflicting file lock should use OpenWaiting_s as the first field
|
|
* in their userData passed by OpenMsg
|
|
*/
|
|
typedef struct OpenWaiting_s
|
|
{
|
|
DQlink_t link;
|
|
NINT state;
|
|
UserXaction_s *xaction; /* Xaction that is waiting */
|
|
|
|
void (*openResumeCallback)( /* If the open request allows open */
|
|
struct OpenWaiting_s **openWaiting); /* to be suspended because of */
|
|
/* conflicting file locks, this is */
|
|
/* the function to call back when */
|
|
/* open is resumed and finished */
|
|
|
|
}OpenWaiting_s;
|
|
|
|
#define OPEN_WAITING 0x01 /* flag on when file open is suspended*/
|
|
/* because of conflicting file locks */
|
|
#define OPEN_RESUMING 0x02 /* Suspended open is during resuming */
|
|
#define OPEN_CANCELLED 0x04 /* Suspended open is cancelled */
|
|
|
|
|
|
typedef struct OpenMsg_s
|
|
{
|
|
NINT requestedRights; /* (create and open) see pssparms.h*/
|
|
void *openParms; /* type specific information */
|
|
|
|
OpenWaiting_s *openWaiting; /* userData to call back after open*/
|
|
/* is resumed */
|
|
} OpenMsg_s;
|
|
|
|
#define COMN_SETUP_OPEN_FILE_MSG(_openMsg, _rights, _opParms) \
|
|
((_openMsg)->requestedRights = (_rights), \
|
|
(_openMsg)->openParms = (_opParms), \
|
|
(_openMsg)->openWaiting = NULL)
|
|
|
|
|
|
#define COMN_SETUP_RETRY_OPEN_FILE_MSG(_openMsg, _rights, _opParms, _openWaiting) \
|
|
((_openMsg)->requestedRights = (_rights), \
|
|
(_openMsg)->openParms = (_opParms), \
|
|
(_openMsg)->openWaiting = (_openWaiting))
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* This defines the message structure for modifying info on a beast
|
|
*---------------------------------------------------------------------------*/
|
|
typedef struct ModifyInfoMsg_s
|
|
{
|
|
NINT modifyInfoMask; /* which fields to get info on*/
|
|
struct zInfo_s *modifyInfo; /* buffer to put into file*/
|
|
|
|
NINT modifyTypeInfoMask;
|
|
void *modifyTypeInfo;
|
|
|
|
Zid_t parentZid; /* parentZid used in modifying the file */
|
|
// cnt NINT nameUniquifier;
|
|
NINT modifyFlags; /* Misc flags controlling modify behavior */
|
|
} ModifyInfoMsg_s;
|
|
|
|
#define COMN_SETUP_MODIFY_INFO_MSG(_infoMsg,_infoMask,_infoBuf,_infoVer) \
|
|
((_infoMsg)->modifyInfoMask = (_infoMask), \
|
|
(_infoMsg)->modifyInfo = (_infoBuf),\
|
|
(_infoMsg)->modifyTypeInfoMask = 0, \
|
|
(_infoMsg)->modifyTypeInfo = NULL, \
|
|
(_infoMsg)->parentZid = zINVALID_ZID, \
|
|
(_infoMsg)->modifyFlags = 0, \
|
|
(_infoBuf)->infoVersion = (_infoVer))
|
|
|
|
#define COMN_SETUP_MODIFY_INFO_MSG_WITH_FLAGS(_infoMsg,_infoMask,_infoBuf, \
|
|
_infoVer,_mFlags) \
|
|
((_infoMsg)->modifyInfoMask = (_infoMask), \
|
|
(_infoMsg)->modifyInfo = (_infoBuf),\
|
|
(_infoMsg)->modifyTypeInfoMask = 0, \
|
|
(_infoMsg)->modifyTypeInfo = NULL, \
|
|
(_infoMsg)->parentZid = zINVALID_ZID, \
|
|
(_infoMsg)->modifyFlags = (_mFlags), \
|
|
(_infoBuf)->infoVersion = (_infoVer))
|
|
|
|
#define COMN_SETUP_MODIFY_TYPE_INFO_MSG(_infoMsg,_infoMask,_infoBuf, \
|
|
_typeInfoMask,_typeInfoBuf) \
|
|
((_infoMsg)->modifyInfoMask = (_infoMask), \
|
|
(_infoMsg)->modifyInfo = (_infoBuf),\
|
|
(_infoMsg)->modifyTypeInfoMask = (_typeInfoMask), \
|
|
(_infoMsg)->modifyTypeInfo = (_typeInfoBuf), \
|
|
(_infoMsg)->parentZid = zINVALID_ZID, \
|
|
(_infoMsg)->modifyFlags = 0)
|
|
|
|
/* Defines for modifyFlags */
|
|
#define MF_DONT_AUTO_SET_DELETE_RENAME_INHIBIT 0x00000001
|
|
#define MF_DONT_AUTO_SET_RENAME_INHIBIT 0x00000002
|
|
#define MF_ALLOW_MODIFY_WITH_DENY_READ_WRITE 0x00000004
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* This defines the message structure for renaming a beast.
|
|
*---------------------------------------------------------------------------*/
|
|
typedef struct RenameMsg_s
|
|
{
|
|
NINT renameFlags;
|
|
NINT renameSeqNum; /* Internal only, NOT set by the caller */
|
|
// cnt NINT retNameUniquifier; /* New name uniquifier for the beast's new name */
|
|
NINT retNumRenamed; /* receives count of how many were renamed*/
|
|
} RenameMsg_s;
|
|
|
|
#define COMN_SETUP_RENAME_MSG(_renMsg, _renFlags) \
|
|
((_renMsg)->renameFlags = (_renFlags))
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* This defines the message structure for searching a container.
|
|
*---------------------------------------------------------------------------*/
|
|
typedef struct SearchMsg_s
|
|
{
|
|
SearchMapIDP_s srchMap; /* holds ID of searchmap*/
|
|
NINT srchSeqNum; /* holds current sequence number,
|
|
* receives next sequence number*/
|
|
NINT srchOpt; /* search options (see PSSCOMN.H)*/
|
|
NINT nameType; /* name type to search for */
|
|
BOOL (*checkFunc)( /* optional function pointer to determine */
|
|
struct NamingMsg_s *nameMsg, /* if a subdir should be used in WILD_searchAllDirsForFile */
|
|
void *parms1,
|
|
NINT parm2);
|
|
void *parm1; /* parameter to be passed to the function */
|
|
NINT parm2; /* parameter to be passed to the function */
|
|
} SearchMsg_s;
|
|
|
|
#define COMN_INIT_SEARCH_MSG(_srchMsg) \
|
|
(LB_bzero((_srchMsg),sizeof(SearchMsg_s)))
|
|
|
|
#define COMN_SETUP_SEARCH_MSG(_srchMsg,_smid,_opt,_ntype) \
|
|
(COMN_SET_SEARCHMAP_ID(&(_srchMsg)->srchMap,(_smid)), \
|
|
(_srchMsg)->srchOpt = (_opt), \
|
|
(_srchMsg)->nameType = (_ntype), \
|
|
(_srchMsg)->checkFunc = NULL)
|
|
|
|
#define COMN_SETUP_WILDOPEN_SEARCH_MSG(_srchMsg,_ntype) \
|
|
(COMN_SET_SEARCHMAP_ID(&(_srchMsg)->srchMap,0), \
|
|
(_srchMsg)->srchOpt = SMAPOPT_32BitMode, \
|
|
(_srchMsg)->nameType = (_ntype), \
|
|
(_srchMsg)->checkFunc = NULL)
|
|
|
|
#define COMN_SETUP_WILDREAD_SEARCH_MSG(_srchMsg,_smid,_srchOpt) \
|
|
(COMN_SET_SEARCHMAP_ID(&(_srchMsg)->srchMap,(_smid)), \
|
|
(_srchMsg)->srchOpt = (_srchOpt), \
|
|
(_srchMsg)->checkFunc = NULL)
|
|
|
|
#define COMN_SETUP_WILDREAD_SEARCHMAP_MSG(_srchMsg,_smap,_srchOpt) \
|
|
(COMN_SET_SEARCHMAP(&(_srchMsg)->srchMap,0,(_smap)), \
|
|
(_srchMsg)->srchOpt = (_srchOpt), \
|
|
(_srchMsg)->checkFunc = NULL)
|
|
|
|
#define COMN_SETUP_FULL_SEARCH_MSG(_srchMsg,_smid,_opt,_seqnum,_ntype) \
|
|
(COMN_SET_SEARCHMAP_ID(&(_srchMsg)->srchMap,(_smid)), \
|
|
(_srchMsg)->srchOpt = (_opt), \
|
|
(_srchMsg)->srchSeqNum = (_seqnum), \
|
|
(_srchMsg)->nameType = (_ntype), \
|
|
(_srchMsg)->checkFunc = NULL)
|
|
|
|
/*#define COMN_SET_SEQNUM_SEARCH_MSG(_srchMsg,_seqnum,_ntype) \
|
|
((_srchMsg)->srchSeqNum = (_seqnum), \
|
|
(_srchMsg)->srchOpt |= SMAPOPT_seqNumber)*/
|
|
|
|
#define COMN_SET_SEARCH_CHECK_FUNC(_srchMsg, _funcptr, _parm1, _parm2) \
|
|
((_srchMsg)->checkFunc = (_funcptr), \
|
|
(_srchMsg)->parm1 = (_parm1), \
|
|
(_srchMsg)->parm2 = (_parm2))
|
|
|
|
#define COMN_SET_SEARCH_LOOKUP_ZID(_srchMsg, zid) \
|
|
((_srchMsg)->srchMap.ptr->lookupZID = (zid))
|
|
|
|
#define COMN_GET_SEARCH_LOOKUP_ZID(_srchMsg) \
|
|
((_srchMsg)->srchMap.ptr->lookupZID)
|
|
|
|
/*-------------------------------------------------------------------------
|
|
* This defines the type of searchmap mode we want. The low word defines
|
|
* the mode and the high word defines option bits
|
|
*-------------------------------------------------------------------------*/
|
|
#define SMAPOPT_Undefined 0 /* no defined modes*/
|
|
#define SMAPOPT_32BitMode 1 /* use 32bit searchmap ID's*/
|
|
#define SMAPOPT_16BitMode 2 /* use 16bit searchmap ID's*/
|
|
|
|
#define SMAPOPT_includeDeletedNameType 0x00010000 /* if SET, and primary search
|
|
* nameType is zNTYPE_FILE, then
|
|
* the search will include both
|
|
* zNTYPE_FILE and zNTYPE_DELETED_FILE,
|
|
* with the deleted files/dirs being
|
|
* returned after the non-deleted
|
|
* ones. */
|
|
#define SMAPOPT_noWildCardChars 0x00020000 /* if SET, the search map was used
|
|
* to find an explicit file name
|
|
* with no wildcard characters.
|
|
* We had to add this to get around
|
|
* a WIN 95 Rename/Move bug where two
|
|
* separate search maps were established,
|
|
* one using wildcarding and one
|
|
* without. The find next on the
|
|
* one with wildcarding failed,
|
|
* because it used the wrong searchMap */
|
|
#define SMAPOPT_notReusable 0x00040000 /* if SET, the search map will be
|
|
* malloc'd when it is created and
|
|
* it will be free'd when it is
|
|
* closed. This should only be
|
|
* used by semantic agents which
|
|
* guarantee to cleanup all search
|
|
* maps. These type of search maps
|
|
* to not get put into the reusable
|
|
* pool. If this bit is NOT SET
|
|
* the searchmap will be taken from
|
|
* and returned to a fixed size
|
|
* reusable pool of search maps */
|
|
#define SMAPOPT_matchAllEntries 0x00080000 /* if SET, return the next entry
|
|
* without checking wildcard matching */
|
|
#define SMAPOPT_returnLastEntry 0x00100000 /* if SET, return the same entry we
|
|
* returned last time READDIR was
|
|
* called. This option is automatically
|
|
* cleared after each use*/
|
|
#define SMAPOPT_doRootdirFlag 0x00200000 /* if SET, then the high nible of the
|
|
* MAPID is set to 0xf000 if this is the
|
|
* rootdirectory, else it is zero*/
|
|
#define SMAPOPT_seqNumber 0x00400000 /* if SET, generate a sequence number*/
|
|
#define SMAPOPT_searchAllDirs 0x00800000 /* if SET, this searches an entire
|
|
* subtree. The default is to return
|
|
* directories before returning their
|
|
* contents. If the opposite behavior
|
|
* is desired, set SMAPOPT_returnAllFilesFirst
|
|
* too. */
|
|
#define SMAPOPT_returnAllFilesFirst 0x01000000 /* This bit is only checked if
|
|
* SMAPOPT_searchAllDirs is also set.
|
|
* If this bit is set TOO, then all
|
|
* files are returned before returning
|
|
* their containing directories. */
|
|
#define SMAPOPT_usedDOSafterLONG 0x10000000 /* if SET, this search map was used on
|
|
* a wildcard search with a long
|
|
* namespace, but the long did not
|
|
* match, so we tried DOS name space
|
|
* and it worked. Until this search
|
|
* map is reset, only use DOS
|
|
* (internal, only set by NSS) */
|
|
#define SMAPOPT_preserveAccessDenied 0x20000000 /* If SET, and an access denied
|
|
* error occurs, and no other files
|
|
* are located, return the access
|
|
* denied error */
|
|
#define SMAPOPT_atEndOfDir 0x40000000 /* if set, this search map has
|
|
* reached the end of the directory
|
|
* and returned an error--so subsequent
|
|
* searches should fail)
|
|
* (internal, only set by NSS */
|
|
#define SMAPOPT_inactive 0x80000000 /* if set, this search map is on the
|
|
* INACTIVE list (internal, only set
|
|
* by NSS)*/
|
|
|
|
#define SMAPOPT_MODE(mode) ((mode) & 0x0000ffff) /* used to extract the mode
|
|
* portion of the searchmap operations*/
|
|
|
|
#define INVALID_SEARCHMAP_ID (-1)
|
|
|
|
/*=========================================================================
|
|
* Definition of zInfo_s used for returning/modifying information about a
|
|
* file object.
|
|
*=========================================================================*/
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* Macros for working with file handles
|
|
*---------------------------------------------------------------------------*/
|
|
#define COMN_RESOLVE_FILEHANDLE(_genMsg,_fhIDP) \
|
|
(((_fhIDP)->ptr != NULL) ? (_fhIDP)->ptr : COMN_DoResolveFileHandle((_genMsg),(_fhIDP)))
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* Macros for working with semantic agent generic handles
|
|
*---------------------------------------------------------------------------*/
|
|
#define COMN_RESOLVE_SAHANDLE(_genMsg,_sahIDP) \
|
|
(((_sahIDP)->ptr != NULL) ? (_sahIDP)->ptr : COMN_DoResolveSemanticAgentHandle((_genMsg),(_sahIDP)))
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* Macros for working with context handles
|
|
*---------------------------------------------------------------------------*/
|
|
#define COMN_RESOLVE_CONTEXTHANDLE(_genMsg,_cxhIDP) \
|
|
(((_cxhIDP)->ptr != NULL) ? (_cxhIDP)->ptr : COMN_DoResolveContextHandle((_genMsg),(_cxhIDP)))
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* Macros for working with name spaces
|
|
*---------------------------------------------------------------------------*/
|
|
/* This will return the nameSpaceMask for a given name type */
|
|
#ifdef _NSS_INTERNAL_
|
|
extern NINT NameTypeNameSpaces[zNTYPE_MAX_DEFINED]; /* Internal only */
|
|
#endif
|
|
|
|
#define COMN_GetNameTypeNameSpaceMask(_nType) \
|
|
(((_nType) > zNTYPE_MAX_DEFINED) ? 0 : NameTypeNameSpaces[(_nType)])
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* Routine for getting given datastream's physical storage info
|
|
* including that of its compressed stream (if any)
|
|
* (used to be a macro)
|
|
*---------------------------------------------------------------------------*/
|
|
extern STATUS COMN_GetStorageInfo(
|
|
GeneralMsg_s *genMsg,
|
|
void *voidBeast, /* Must be a RootBeast */
|
|
GetStorageInfo_s *getStorageInfo);
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* Get the # blocks currently contributed by given beast to the
|
|
* Volume's purgeableBlk count.
|
|
*---------------------------------------------------------------------------*/
|
|
STATUS
|
|
COMN_GetPurgeableBlksCnt(
|
|
GeneralMsg_s *genMsg,
|
|
void *voidBeast,
|
|
QUAD *purgeableBlks); /* out */
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* Save the beast's contribution to its volume's purgeableBlks count
|
|
* in the beast's compression info area.
|
|
*---------------------------------------------------------------------------*/
|
|
void
|
|
COMN_saveBeastPurgeableBlksCnt(
|
|
GeneralMsg_s *genMsg,
|
|
NamedBeast_s *beast,
|
|
RootBeast_s *compBeast,
|
|
Blknum_t purgeableBlks);
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* Macros for getting physical storage info. It differs from COMN_GetStorageInfo
|
|
* in that it gets just the info for this specific beast. COMN_GetStorageInfo
|
|
* can combine allocated storage from other beasts as in the case of
|
|
* compression.
|
|
*---------------------------------------------------------------------------*/
|
|
#define COMN_GetBeastStorageInfo(_genMsg,_beast,_gsiPtr) \
|
|
(((RootBeast_s *)(_beast))->ROOTcomnOps.BST_getStorageInfo((_genMsg),(_beast), \
|
|
(_gsiPtr)))
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* Defines for task parameter on COMN_CleanupTaskBasedContexthandles and
|
|
* COMN_EndOfTaskCleanup.
|
|
*---------------------------------------------------------------------------*/
|
|
#define CLEANUP_ALL_TASKS 0
|
|
#define CLEANUP_CURRENT_TASK 1
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* Defines for Path Work Buffers
|
|
*---------------------------------------------------------------------------*/
|
|
/*---------------------------------------------------------------------------
|
|
* This code will cause a compile error if the sizes are not in the correct ranges.
|
|
*---------------------------------------------------------------------------*/
|
|
#define PATHWORKBUF_SIZE 2048 /* multiples of this buffer must fit in a memory page */
|
|
#define UNI_PATHWORKBUF_SIZE (PATHWORKBUF_SIZE / sizeof(unicode_t))
|
|
#if (PATHWORKBUF_SIZE < (zMAX_FULL_NAME * 2))
|
|
#error The PATHWORKBUF_SIZE must be >= (zMAX_FULL_NAME * 2)
|
|
#endif
|
|
|
|
/*-------------------------------------------------------------------------
|
|
* This is the default transaction ID return from storage systems that
|
|
* don't support transactioning. This would be returned from the Storage
|
|
* System by "BeginXLocal".
|
|
*-------------------------------------------------------------------------*/
|
|
#define NIL_METADATA_XACTION ((void *)0)
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* Defines for LSS Info
|
|
*
|
|
* FixFixFix
|
|
* FixFixFix
|
|
* FixFixFix
|
|
*
|
|
* Eventually, there should probably be an LSS Info structure returned by
|
|
* an Admin volume LSS object, via the standard zGetInfo function. However,
|
|
* that cannot happen in the short term, and we need an internal way of getting
|
|
* supported attribute info from an LSS, where no current beasts exist.
|
|
* This LSS info structure is given to us by the LSS's when they register,
|
|
* the common layer stores it, and the CONONE NLM passes the data on to the
|
|
* console One uitilties on the client.
|
|
*---------------------------------------------------------------------------*/
|
|
typedef struct LSSInfo_s
|
|
{
|
|
NINT lssID; /* The LSS ID */
|
|
BOOL canCreateNew; /* The LSS allows external sources to
|
|
* create volumes and/or pools */
|
|
QUAD poolSupportedFeatures; /* The features supported by this pool */
|
|
QUAD poolDefaultEnabledFeatures;/* Default enabled features on this pool */
|
|
QUAD poolChangableFeatures; /* Modifyable features on this pool */
|
|
QUAD volSupportedFeatures; /* The features supported by this volume */
|
|
QUAD volDefaultEnabledFeatures; /* Default enabled features on this volume */
|
|
QUAD volChangableFeatures; /* Modifyable features on this volume */
|
|
} LSSInfo_s;
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* _COMNPARAMS_H */
|