195 lines
6.0 KiB
C
195 lines
6.0 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:
|
|
| Data structures for NSS task and user transactions for the common layer.
|
|
|
|
|
| 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 _NSSTASK_H_
|
|
#define _NSSTASK_H_
|
|
|
|
#ifndef _NSS_MSG_H_
|
|
# include "msg.h"
|
|
#endif
|
|
|
|
#ifndef _PSSCONNECTION_H_
|
|
# include "pssConnection.h"
|
|
#endif
|
|
|
|
#ifndef _COMNLOCK_H_
|
|
# include "comnLock.h"
|
|
#endif
|
|
|
|
#define START_TASK_IDS (1 << 31) /* Positive task Ids reserved for NetWare
|
|
* semantic agent.
|
|
*/
|
|
#ifndef _COMNPARAMS_H_
|
|
typedef struct UserXaction_s UserXaction_s;
|
|
#endif /* _COMNPARAMS_H_ */
|
|
|
|
typedef struct Master_s
|
|
{
|
|
mManager_s mgr;
|
|
NSSConnection_s *nssConn;
|
|
DQlink_t siblingMasters;
|
|
DQhead_t tasks;
|
|
LONG nextTaskID; /* Might be implemented so it is based off
|
|
* of the newest taskID.
|
|
*/
|
|
struct Task_s *defaultTask; /* Makes backwards compatibility for
|
|
* easier for now until everything
|
|
* has been converted to the new
|
|
* messages. MSGFIX
|
|
* This is the same as task 0
|
|
* (Might leave it in).
|
|
*/
|
|
} Master_s;
|
|
|
|
typedef struct Task_s
|
|
{
|
|
Master_s *master;
|
|
LONG taskID;
|
|
BYTE victim;
|
|
BYTE reserved[3];
|
|
DQlink_t collection; /* Used to collect tasks no longer in use */
|
|
DQlink_t siblingTasks; /* Tasks with the same master */
|
|
DQhead_t xactions;
|
|
Xid_t defaultXid;
|
|
} Task_s;
|
|
|
|
/*
|
|
* The HomeXaction is to track when all the resources attached
|
|
* to a transaction have been written to their home location on
|
|
* disk. The reason that it is a separate data structure is that
|
|
* TTS needs to reuse the same transaction structure so it can
|
|
* keep the same lock set across multiple transaction.
|
|
*/
|
|
typedef struct HomeXaction_s
|
|
{
|
|
UserXaction_s *userXaction;
|
|
DQlink_t timeOrderLink;
|
|
NINT lastLogRec; /* byte offset in transaction log file
|
|
* of last part of this transaction
|
|
*/
|
|
NINT beginLogRec; /* byte offset in transaction log file
|
|
* of "begin record "
|
|
*/
|
|
Agent_s homeAgent;
|
|
VolumeID_t LogVolumeID; /* Volume ID transaction is associated with */
|
|
} HomeXaction_s;
|
|
|
|
struct UserXaction_s
|
|
{
|
|
HomeXaction_s *homeXaction;
|
|
/*
|
|
* Idle--->Begin--->Active--->Commit---+
|
|
* ^ | |
|
|
* | v |
|
|
* +<---------------Abort |
|
|
* | |
|
|
* +<---------------------------------+
|
|
* |
|
|
* v
|
|
* Free
|
|
*/
|
|
enum {
|
|
IDLE_UXACTION,
|
|
BEGIN_UXACTION,
|
|
ACTIVE_UXACTION,
|
|
COMMIT_UXACTION,
|
|
ABORT_UXACTION} state; /* Valid states for a transaction */
|
|
Task_s *task;
|
|
struct UserXaction_s *parent;
|
|
Xid_t xid;
|
|
Agent_s commitAgent;
|
|
DQlink_t siblingXactions;
|
|
DQlink_t sameHashXactions;
|
|
DQhead_t childXactions;
|
|
LockSet_s byteRangeLocks; /* Set of byte range locks */
|
|
/*
|
|
* Right now, we don't support these lock types from NSS
|
|
*/
|
|
// LockSet_s recordLocks; /* Logical record locks */
|
|
// LockSet_s fileLocks; /* File locks */
|
|
VolumeID_t LogVolumeID; /* Volume ID transaction is associated with */
|
|
struct UserXaction_s *waitFor; /* The xaction it is waiting for*/
|
|
};
|
|
|
|
extern DQhead_t HomeTimeOrderList;
|
|
|
|
extern Task_s *lookupTask(Master_s *master, NINT taskID);
|
|
extern UserXaction_s *lookupXaction(Xid_t xid);
|
|
extern UserXaction_s *lookupActiveXaction(Xid_t xid);
|
|
extern UserXaction_s *lookupDefaultXaction (Master_s *master, NINT taskID);
|
|
extern Task_s *allocTask(Master_s *master, NINT taskID);
|
|
extern UserXaction_s *allocUserXaction(Task_s *task, UserXaction_s *parentXaction);
|
|
extern HomeXaction_s *allocHomeXaction(UserXaction_s *uxaction);
|
|
extern void freeUserXaction(UserXaction_s *xaction);
|
|
extern UserXaction_s *resolveXaction(
|
|
Xid_t xid,
|
|
FileHandle_s *fh,
|
|
GeneralMsg_s *genMsg,
|
|
NSSConnection_s *nssConn,
|
|
NINT taskID,
|
|
BOOL createDefaultXaction);
|
|
|
|
//extern void COMN_CommitUserXaction(UserXaction_s *xaction);
|
|
//extern void COMN_AbortUserXaction(UserXaction_s *xaction);
|
|
//extern void COMN_HomeUserXaction(UserXaction_s *xaction);
|
|
|
|
extern STATUS MGR_Startup();
|
|
extern void MGR_Shutdown();
|
|
|
|
extern void COMN_CleanupAllMasters(NSSConnection_s *nssConn);
|
|
extern Master_s *createMaster(NSSConnection_s *nssConn);
|
|
extern void COMN_CleanupTask(Task_s *task);
|
|
extern void COMN_CleanupMaster(Master_s *master);
|
|
|
|
extern STATUS COMN_BeginTask (
|
|
GeneralMsg_s *genMsg,
|
|
Master_s *master,
|
|
NINT *taskID);
|
|
|
|
extern STATUS COMN_EndTask (
|
|
GeneralMsg_s *genMsg,
|
|
Master_s *master,
|
|
NINT taskID);
|
|
|
|
#endif
|