154 lines
5.9 KiB
C
154 lines
5.9 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 Storage Services (NSS) module
|
|
|
|
|
|---------------------------------------------------------------------------
|
|
|
|
|
| $Author: taysom $
|
|
| $Date: 2004-12-31 01:10:58 +0530 (Fri, 31 Dec 2004) $
|
|
|
|
|
| $RCSfile$
|
|
| $Revision: 465 $
|
|
|
|
|
|---------------------------------------------------------------------------
|
|
| This module is used to:
|
|
| This defines the interfaces into the PSS portion of the connection
|
|
| structure.
|
|
|
|
|
| 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 _SAGENTHANDLE_H_
|
|
#define _SAGENTHANDLE_H_
|
|
|
|
#ifndef _COMNPARAMS_H_
|
|
#include <comnParams.h>
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef void (*SAgentHandleCleanup_t)(struct SAHandle_s *sAgentHandle);
|
|
|
|
/*-------------------------------------------------------------------------
|
|
* One of these structures are allocated for each object in the system that is
|
|
* allocated for generic Semantic Agent access.
|
|
*-------------------------------------------------------------------------*/
|
|
struct SAHandle_s
|
|
{
|
|
LONG handleID; /* the handle ID for this handle */
|
|
LONG taskID; /* task this handle is assoicated with*/
|
|
LONG useCount; /* Handle currently in-use count */
|
|
NSSConnection_s *pssConn; /* pss connection structure pointer*/
|
|
LONG semanticAgentID; /* semantic agent which owns this handle */
|
|
SAgentHandleCleanup_t cleanup; /* address of a routine to call when
|
|
* cleaning up this handle */
|
|
//
|
|
// If the following three fields need to be reintroduced, you will have
|
|
// to efficiently update them. The SAHandle_s should really reference
|
|
// a regular fileHandle to get this information.
|
|
//
|
|
// Zid_t beastParentZid; /* Must be accurate if beast is non-NULL*/
|
|
// NINT beastNameUniquifier; /* Name uniquifier for the beast */
|
|
// NINT beastNameType; /* Name Type for the beastNameUniquifier */
|
|
|
|
NamedBeast_s *beast; /* optional object pointer for the handle*/
|
|
|
|
/* The Semantic agent may include this structure as the first element
|
|
* in a larger structure, and use it for any internal handle type. */
|
|
};
|
|
|
|
/*-------------------------------------------------------------------------
|
|
* An array of this structure is used to keep track of the semantic agent
|
|
* handles that are in use on the given connection. The handle is used as
|
|
* an index into this array. This array also keeps track of the current
|
|
* sequence number for semantic agent handles.
|
|
*-------------------------------------------------------------------------*/
|
|
typedef struct SAHandleCtrl_s {
|
|
LONG handle; /* current handle (with seqnum) for this SAH */
|
|
SAHandle_s *sah; /* pointer to SAHandle_s structure*/
|
|
} SAHandleCtrl_s;
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
* This goes in PSS connection structure. It controls semantic agent handles.
|
|
*-------------------------------------------------------------------------*/
|
|
typedef struct SAgentHandleCtrl_s {
|
|
Latch_s saLatch; /* latch */
|
|
NINT nextFree; /* next free index into ARRAY*/
|
|
NINT arraySize; /* how many elements are in the array*/
|
|
SAHandleCtrl_s *list; /* pointer to array of semantic Agent handles */
|
|
} SAgentHandleCtrl_s;
|
|
|
|
/*-------------------------------------------------------------------------
|
|
* Macros for manipulating generic semantic agent handles
|
|
*-------------------------------------------------------------------------*/
|
|
#define FIRST_SAHANDLE_INDEX 0 /* first index into array*/
|
|
#define SAH_SEQ_SHIFT 10 /* defines how many bits are in the SEQUENCE portion of the handle*/
|
|
#define SAH_SEQ_MASK ((1<<SAH_SEQ_SHIFT)-1)
|
|
|
|
#define SAHANDLE_INDEX(_h) ((NINT)((-(((SNINT)(_h)) >> SAH_SEQ_SHIFT))-2))
|
|
#define SAHANDLE_INC(_h) ((_h) = (((_h) & ~SAH_SEQ_MASK) | (((_h) + 1) & SAH_SEQ_MASK)))
|
|
#define SAHANDLE_MAKE(_i,_s) ((NINT)(((-((SNINT)(_i)+2)) << SAH_SEQ_SHIFT) | ((_s) & SAH_SEQ_MASK)))
|
|
|
|
#define SAHANDLE_ARRAY_INC 32 /* units we grow the extended attribute array*/
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* Internal Common Layer Prototypes for working with file handles
|
|
*---------------------------------------------------------------------------*/
|
|
extern void SAH_RemoveAllSAHsOnConnection(
|
|
NSSConnection_s *pssConn);
|
|
|
|
extern void SAH_RemoveAllSAHsOnConnectionTask(
|
|
GeneralMsg_s *genMsg,
|
|
NSSConnection_s *pssConn);
|
|
|
|
extern void SAH_RemoveAllSAHsOnVolume(
|
|
NSSConnection_s *pssConn,
|
|
Volume_s *vol);
|
|
|
|
extern void SAH_RemoveAllSAgentSAHsOnVolume(
|
|
GeneralMsg_s *genMsg,
|
|
NSSConnection_s *pssConn,
|
|
Volume_s *vol);
|
|
|
|
//extern void SAH_FixupAllSAHsOnBeast(
|
|
// GeneralMsg_s *genMsg,
|
|
// NamedBeast_s *beast,
|
|
// File_s *oldDir,
|
|
// File_s *newDir,
|
|
// NINT oldNameUniquifier,
|
|
// NINT newNameUniquifier,
|
|
// NINT newNameType);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* _SAGENTHANDLE_H_ */
|