#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <memory.h>
#include "udanax.h"
Include dependency graph for diskalloc.cxx:

Go to the source code of this file.
Functions | |
| typediskloafptr | diskalloc () |
| ??? | |
| void | diskfree (typediskloafptrdigit loafptr) |
| ??? | |
| void | diskset (typediskloafptrdigit loafptr) |
| ??? | |
| bool | readallocinfo (int fd) |
| ??? | |
| void | initheader () |
| ??? | |
| void | diskallocexit (int fd) |
| ??? | |
| void | writeallocinfo (int fd) |
| ??? | |
| bool | goodblock (typediskloafptrdigit diskptr) |
| ??? | |
Variables | |
| int | enffiledes |
| bool | isxumain |
| bool | maximumsetupsizehasbeenhit = false |
| int | maximumsetupsize = 0 |
| Diskheader | diskheader |
| char | mask [8] = { 1, 2, 4, 8, 16, 32, 64, 128 } |
(to be defined)
Definition in file diskalloc.cxx.
|
|
??? (to be defined) Definition at line 114 of file diskalloc.cxx. References assert, Diskheader::bitmap, BITMAPSIZE, typediskloafptr::diskblocknumber, diskheader, typediskloafptr::insidediskblocknumber, mask, maximumsetupsize, and maximumsetupsizehasbeenhit. Referenced by partialdiskalloc(), and savepartialdiskalloctabletodisk().
00117 {
00118 int i, j;
00119 typediskloafptr ret;
00120
00121 for (i = 0; i < BITMAPSIZE && !diskheader.bitmap[i]; ++i)
00122 ;
00123
00124 if (i == BITMAPSIZE)
00125 assert(0); // Out of diskalloc bitmap space
00126
00127 for (j = 0; j < 8; ++j) {
00128 if (diskheader.bitmap[i] & mask[j]) {
00129 diskheader.bitmap[i] = diskheader.bitmap[i] & ~mask[j];
00130 break;
00131 }
00132 }
00133 ret.diskblocknumber = i * 8 + j;
00134 ret.insidediskblocknumber = 0 /* 1 */ ;
00135
00136 if (maximumsetupsize && ret.diskblocknumber >= maximumsetupsize)
00137 maximumsetupsizehasbeenhit = true;
00138
00139 return ret;
00140 }
|
|
|
??? (to be defined) Definition at line 244 of file diskalloc.cxx. References diskheader, Diskheader::hasenftops, savepartialdiskalloctabletodisk(), and writeallocinfo(). Referenced by closediskfile().
00246 {
00247 diskheader.hasenftops = true;
00248 savepartialdiskalloctabletodisk();
00249 writeallocinfo(fd);
00250 }
|
|
|
??? (to be defined) Definition at line 151 of file diskalloc.cxx. References assert, Diskheader::bitmap, diskheader, DISKPTRNULL, goodblock(), mask, and typediskloafptrdigit. Referenced by changerefcount(), and readpartialdiskalloctablefromdisk().
00153 {
00154 if (loafptr == DISKPTRNULL)
00155 return;
00156
00157 if (!goodblock(loafptr))
00158 assert(0); // Unallocated block in diskfree
00159
00160 diskheader.bitmap[loafptr / 8] = diskheader.bitmap[loafptr / 8] | mask[loafptr % 8];
00161 }
|
|
|
??? (to be defined) Definition at line 171 of file diskalloc.cxx. References assert, Diskheader::bitmap, diskheader, DISKPTRNULL, goodblock(), mask, and typediskloafptrdigit. Referenced by deletefullcrumandgarbageddescendents().
00173 {
00174 if (loafptr == DISKPTRNULL)
00175 return;
00176
00177 if (!goodblock(loafptr))
00178 assert(0); // Unallocated block in diskfree
00179
00180 diskheader.bitmap[loafptr / 8] = diskheader.bitmap[loafptr / 8] & ~mask[loafptr % 8];
00181 }
|
|
|
??? (to be defined) Definition at line 282 of file diskalloc.cxx. References Diskheader::bitmap, diskheader, mask, and typediskloafptrdigit. Referenced by actuallyreadrawloaf(), actuallywriteloaf(), diskfree(), diskset(), FileBlockIO::get(), and FileBlockIO::put().
00284 {
00285 if (diskptr == 0)
00286 return false;
00287
00288 return !(diskheader.bitmap[diskptr / 8] & mask[diskptr % 8]);
00289 }
|
|
|
??? (to be defined) Definition at line 224 of file diskalloc.cxx. References Diskheader::bitmap, clear, diskheader, Diskheader::hasenftops, initincorealloctables(), and NUMDISKLOAFSINHEADER. Referenced by initenffile(), and readallocinfo().
00225 {
00226 memset(diskheader.bitmap, 0xFF, sizeof(diskheader.bitmap)); /* free all */
00227 clear(diskheader.bitmap, (NUMDISKLOAFSINHEADER + 3) / 8 + 1);
00228
00229 /* unfree bitmap and granf and spanf */
00230 /* zzzz this rounds up a byte thus may reserve unused blocks fix by clearing bits ! */
00231
00232 diskheader.hasenftops = false;
00233 initincorealloctables();
00234 }
|
|
|
??? (to be defined) Definition at line 191 of file diskalloc.cxx. References assert, diskheader, enffiledes, Diskheader::hasenftops, initheader(), L, and readpartialdiskalloctablefromdisk(). Referenced by initenffile().
00193 {
00194 if (lseek(fd, 0L, 0) < 0) {
00195 perror("lseek in readallocinfo");
00196 assert(0); // lseek failed
00197 }
00198
00199 if (read(fd, (char *)&diskheader, sizeof(diskheader)) <= 0) {
00200 perror("read");
00201 assert(0); // read
00202 }
00203
00204 bool ret = diskheader.hasenftops;
00205 if (ret) {
00206 enffiledes = fd;
00207 readpartialdiskalloctablefromdisk();
00208 } else {
00209 L("Old enffile invalid... re-initializing\n");
00210 initheader();
00211 }
00212
00213 return ret;
00214 }
|
|
|
??? (to be defined) Definition at line 260 of file diskalloc.cxx. References assert, diskheader, and L. Referenced by diskallocexit(), and initenffile().
|
|
|
Definition at line 96 of file diskalloc.cxx. Referenced by diskalloc(), diskallocexit(), diskfree(), diskset(), goodblock(), initheader(), orglwritepart2(), readallocinfo(), and writeallocinfo(). |
|
|
Definition at line 90 of file diskalloc.cxx. Referenced by actuallyreadrawloaf(), actuallywriteloaf(), closediskfile(), initenffile(), and readallocinfo(). |
|
|
Definition at line 91 of file diskalloc.cxx. |
|
|
Definition at line 98 of file diskalloc.cxx. Referenced by diskalloc(), diskfree(), diskset(), and goodblock(). |
|
|
Definition at line 94 of file diskalloc.cxx. Referenced by diskalloc(), and setmaximumsetupsize(). |
|
|
Definition at line 93 of file diskalloc.cxx. |
1.3.4