Files
mars-nwe/include/nwnss/internal/dirQuotas.h
2026-06-16 13:45:46 +02:00

189 lines
5.6 KiB
C

/****************************************************************************
|
| (C) Copyright 1995-1998 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) module
|
|---------------------------------------------------------------------------
|
| $Author: taysom $
| $Date: 2005-04-20 22:31:00 +0530 (Wed, 20 Apr 2005) $
|
| $RCSfile$
| $Revision: 946 $
|
|---------------------------------------------------------------------------
| This module is used to:
| This defines all of the primitive BEASTS inside of PSS
|
| 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 _DIRQUOTAS_H_
#define _DIRQUOTAS_H_
/****************************************************************************
* Main directory quota cache structure
*****************************************************************************/
typedef struct DirQuotaCacheCtrl_s
{
QUAD gets; /* number of times we did gets on the cache */
QUAD hits; /* number of cache hits */
Latch_s latch; /* latch to control changes in this structure */
NINT numHashEntries; /* number of entries in the has table */
DQhead_t (*hash)[]; /* pointer to hash array */
DQhead_t LRUqueue; /* head of the Least Recently Used queue */
DQhead_t unusedQueue; /* head of the unused cache packets queue */
NINT maxEntries; /* max allowed entries in the cache */
NINT numEntries; /* number of entries in the cache */
NINT numUnusedEntries; /* number of unused cache entries */
NINT numAdded; /* incremented each time an entry is added */
NINT numRemoved; /* number of entries removed (not victom selected) */
NINT numVictimSelected; /* number of entries that have been victim selected */
NINT unusedEntryHit; /* number of time we found an unused entry when adding */
} DirQuotaCacheCtrl_s;
extern DirQuotaCacheCtrl_s DirQuotaCache;
#define DEFAULT_DIRQ_CACHE_SIZE 8192
#define MAX_DIR_QUOTAS_SCHEDULED 2
typedef struct DirQuotaCacheNode_s
{
DQlink_t hashLink; /* hash list link field */
DQlink_t LRUlink; /* LRU link field */
Zid_t volume; /* volume for the entry */
Zid_t dir; /* zid for the entry (value to return)*/
SQUAD quota; /* directory quota */
SQUAD usedAmount; /* amount of space already in use */
Zid_t parentQuota; /* zid of the next higher quota in the directory hierarchy */
Latch_s latch; /* latch for changing and computing usedAmount */
QUAD levelCount; /* number of dir levels to get to parent */
} DirQuotaCacheNode_s;
/*
* This is the structure used to hold lists of disk quotas
*/
typedef struct DirQuotaEntry_s
{
SQUAD quota;
SQUAD usedAmount;
QUAD level; /* the number of hops from the root - a quad for alignment */
} DirQuotaEntry_s;
/****************************************************************************
*
* Function Prototypes
*
****************************************************************************/
void DIRQ_ChangeVolumeDirectoryQuotasByName(
GeneralMsg_s *genMsg,
unicode_t *name,
BOOL enableQuotas);
void DIRQ_FixDirectoryQuotas(
GeneralMsg_s *genMsg,
unicode_t *name);
void DIRQ_DisableDirectoryQuotas(
Volume_s *vol);
STATUS DIRQ_SetDirectoryQuota(
GeneralMsg_s *genMsg,
Volume_s *volume,
File_s *beast,
SQUAD quota);
STATUS DIRQ_GetDirectoryQuotas(
GeneralMsg_s *genMsg,
Volume_s *volume,
Zid_t dirZid,
NINT numEntries,
DirQuotaEntry_s *entries,
NINT *numEntriesUsed,
BOOL allowClassicEmulation);
STATUS DIRQ_RemoveDirectoryQuota(
GeneralMsg_s *genMsg,
Volume_s *volume,
File_s *beast);
void DIRQ_ComputeUsedAmount(
Volume_s *volume,
Zid_t dirZid,
SQUAD *amountUsed,
BOOL volumeIsActive);
void DIRQ_AdjustUsedDirSpace(
Xaction_s *xaction,
Volume_s *volume,
RootBeast_s *child,
SQUAD amountToAdjust);
STATUS DIRQ_CheckDirQuotas(
GeneralMsg_s *genMsg,
RootBeast_s *beast,
SQUAD amount);
STATUS DIRQ_MinDirQuota (
GeneralMsg_s *genMsg,
RootBeast_s *beast,
SQUAD *amount);
BOOL DIRQ_ThereAreDirQuotas(
Volume_s *volume,
Zid_t zid);
void DIRQ_InvalidateDirQuotaCache(
Volume_s *volume);
SQUAD DIRQ_GetADirectoryQuota(
Volume_s *volume,
Zid_t originalZid);
STATUS DIRQ_ChangeDirQuotaAttribute(
GeneralMsg_s *genMsg,
Volume_s *vol,
BOOL enableQuotas);
void DIRQ_FixSetQuotaQueue(
Volume_s *vol);
STATUS DIRQ_Startup();
void DIRQ_Shutdown();
#if NSS_DEBUG IS_ENABLED
/* Pre-define struct(s) so Linux compiler doesn't complain */
struct PCLSwitchDef_s;
void DIRQ_DoDisplayCache(
struct PCLSwitchDef_s *switchDef,
NINT options,
void *userParm);
#endif
#endif