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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
--- src/fman.c.orig Mon May 10 17:05:20 1999
+++ src/fman.c Mon Jun 4 16:08:50 2007
@@ -471,6 +471,14 @@
}
+Private void
+ReturnCache(cptr)
+ CACHE *cptr;
+{
+ CDR_FREE_LIST(cptr) = FREE_LIST();
+ FREE_LIST() = cptr;
+}
+
/*
* CacheIt() --- cache it. The cache slot is moved into
* the head of the LRU list.
@@ -480,7 +488,6 @@
int port;
{
CACHE *cptr;
- Private void ReturnCache();
if ((cptr = RequireCache()) == (CACHE*)NULL){
fprintf(stderr, "VFlib: CacheIt() - error\n");
@@ -521,19 +528,36 @@
return cptr;
}
-Private void
-ReturnCache(cptr)
- CACHE *cptr;
-{
- CDR_FREE_LIST(cptr) = FREE_LIST();
- FREE_LIST() = cptr;
-}
-
/**
** LRU LIST
**/
+Private int
+LRUPutTop2(cptr, f)
+ CACHE *cptr;
+ int f;
+{
+ CACHE *cptr_f;
+ FILE_Port port;
+ int val;
+
+ cptr_f = CacheLRUList.l_forw;
+ cptr->l_forw = cptr_f;
+ cptr_f->l_back = cptr;
+ cptr->l_back = &CacheLRUList;
+ CacheLRUList.l_forw = cptr;
+
+ val = 0;
+ if (f == TRUE){
+ port = cptr->port;
+ if (VFFM_Internal_Open(port) < 0)
+ val = -1;
+ }
+
+ return val;
+}
+
/* LRUMoveTop() - moves a cache block into the top of LRU list.
* THE CACHE *MUST* BE IN LRU LIST.
*/
@@ -542,7 +566,6 @@
CACHE *cptr;
{
CACHE *cptr_b, *cptr_f;
- Private int LRUPutTop2();
cptr_b = cptr->l_back;
cptr_f = cptr->l_forw;
@@ -558,36 +581,9 @@
LRUPutTop(cptr)
CACHE *cptr;
{
- Private int LRUPutTop2();
-
return LRUPutTop2(cptr, TRUE);
}
-Private int
-LRUPutTop2(cptr, f)
- CACHE *cptr;
- int f;
-{
- CACHE *cptr_f;
- FILE_Port port;
- int val;
-
- cptr_f = CacheLRUList.l_forw;
- cptr->l_forw = cptr_f;
- cptr_f->l_back = cptr;
- cptr->l_back = &CacheLRUList;
- CacheLRUList.l_forw = cptr;
-
- val = 0;
- if (f == TRUE){
- port = cptr->port;
- if (VFFM_Internal_Open(port) < 0)
- val = -1;
- }
-
- return val;
-}
-
Private int
LRUDeleteTail()
|