-
Notifications
You must be signed in to change notification settings - Fork 2
/
trustee.c
91 lines (81 loc) · 2.31 KB
/
trustee.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/***************************************************************************
*
* Copyright (c) 1997-2022 Jeff V. Merkey
* 7260 SE Tenino St.
* Portland, Oregon 97206
* jeffmerkey@gmail.com
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the Lesser GNU Public License as published by the
* Free Software Foundation, version 2.1, or any later version.
*
* 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.
*
* Original Authorship :
* source code written by Jeff V. Merkey
*
* Original Contributors :
* Jeff V. Merkey
*
*
*
****************************************************************************
*
*
* AUTHOR : Jeff V. Merkey (jeffmerkey@gmail.com)
* FILE : TRUSTEE.C
* DESCRIP : Trustee Hashing Functions
* DATE : November 1, 1998
*
*
***************************************************************************/
#include "globals.h"
THASH *GetTrusteeEntry(VOLUME *volume, ULONG entry, ULONG Directory)
{
register THASH *tname;
register THASH_LIST *HashTable;
register ULONG Value, pos;
Value = (Directory & (volume->TrusteeHashLimit - 1));
HashTable = (THASH_LIST *) volume->TrusteeHash;
if (!HashTable)
return 0;
tname = (THASH *) HashTable[Value].head;
pos = 0;
while (tname)
{
if (tname->Parent == Directory)
{
if (entry == pos)
return tname;
pos++;
}
tname = tname->next;
}
return 0;
}
UHASH *GetUserQuotaEntry(VOLUME *volume, ULONG entry, ULONG Directory)
{
register UHASH *uname;
register UHASH_LIST *HashTable;
register ULONG Value, pos;
Value = (Directory & (volume->UserQuotaHashLimit - 1));
HashTable = (UHASH_LIST *) volume->UserQuotaHash;
if (!HashTable)
return 0;
uname = (UHASH *) HashTable[Value].head;
pos = 0;
while (uname)
{
if (uname->Parent == Directory)
{
if (entry == pos)
return uname;
pos++;
}
uname = uname->next;
}
return 0;
}