Files
mars-nwe/include/nwnss/include/cmActivity.h
2026-06-16 15:31:38 +02:00

102 lines
4.1 KiB
C

/****************************************************************************
|
| (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
|
|***************************************************************************
|
| NSS Compression Management module
|
|---------------------------------------------------------------------------
|
| $Author: taysom $
| $Date: 2004-12-31 01:10:58 +0530 (Fri, 31 Dec 2004) $
|
| $RCSfile$
| $Revision: 465 $
|
|---------------------------------------------------------------------------
| Module Description:
|
+-------------------------------------------------------------------------*/
#ifndef _CM_ACTIVITY_H_
#define _CM_ACTIVITY_H_
typedef struct CMStream_s
{
struct CMActivity_s *activity;
RootBeast_s *beast; /* Beast being read/written */
QUAD beastOffset; /* offset in the beast where the stream starts */
QUAD beastSize; /* size of the part of the beast
* comprising the stream */
QUAD streamOffset; /* current logical offset for stream I/O */
Blknum_t curHoleBlks; /* # of hole blks (if any) starting at
* streamOffset */
} CMStream_s;
typedef struct CMActivity_s
{
DQlink_t allActivitiesChain;
DQlink_t beastActivitiesChain;
BYTE state; /* Activity's state */
#define CM_ACTIVITY_STATE_AVAILABLE 0 /* available for use */
#define CM_ACTIVITY_STATE_RUNNABLE 1 /* waiting for a thread to run on */
#define CM_ACTIVITY_STATE_RUNNING 2 /* Running on a thread */
#define CM_ACTIVITY_STATE_SUSPENDED 3 /* suspended */
#define CM_ACTIVITY_STATE_ABORTING 4 /* abortion in progress; still inside
* algorithm */
#define CM_ACTIVITY_STATE_ABORTED 5 /* abortion complete */
#define CM_ACTIVITY_STATE_FINISHED 6 /* activity finished execution */
BYTE op;
#define CM_ACTIVITY_OP_COMPRESS 0
#define CM_ACTIVITY_OP_DECOMPRESS 1
BYTE algoID; /* The ID of the algorithm being used */
BYTE algoVersion; /* Version# of algorithm being used */
BOOL keepSrcChunk; /* Keep src chunk as precious;
* A compressed/uncompressed version of a chunk
* is precious if only it contains valid data
* and the other version doesn't */
CMStream_s decompStream; /* Uncompressed stream */
CMStream_s compStream; /* Compressed stream */
CMStream_s tmpStream; /* Temporary stream (needed by netware algo) */
QUAD sizeDone; /* srcStream size already (de)compressed */
#ifdef USE_BG_THREAD_FOR_COMPRESSION
THREAD threadID;
#endif /* USE_BG_THREAD_FOR_COMPRESSION */
FsmLite_s fsm;
} CMActivity_s;
extern STATUS CM_activityAlloc(
NINT activityOp,
CMActivity_s **activity,
BOOL wait);
extern void CM_activityFree(CMActivity_s *activity);
extern void CM_activityThreadRun(THREAD threadID, CMActivity_s *activity);
extern void CM_activityWorkToDoRun(FsmLite_s *workToDoFsm, ADDR unused);
extern void CM_activityAbort(CMActivity_s *activity, STATUS errCode, BOOL wait);
extern void CM_activitySuspend(CMActivity_s *activity);
extern void CM_activityResume(CMActivity_s *activity);
/* External function to invoke compression algorithm;
* called by CM_activityRun */
extern STATUS
ALGOMGR_invokeCompAlgo(CMActivity_s *activity);
#endif /* _CM_ACTIVITY_H_ */