13 |
|
#include "holo.h" |
14 |
|
|
15 |
|
#ifndef CACHESIZE |
16 |
< |
#define CACHESIZE 16 /* default cache size (Mbytes, 0==inf) */ |
16 |
> |
#ifdef BIGMEM |
17 |
> |
#define CACHESIZE 17 /* default cache size (Mbytes, 0==inf) */ |
18 |
> |
#else |
19 |
> |
#define CACHESIZE 5 |
20 |
|
#endif |
21 |
+ |
#endif |
22 |
|
#ifndef FREEBEAMS |
23 |
|
#define FREEBEAMS 1500 /* maximum beams to free at a time */ |
24 |
|
#endif |
191 |
|
} |
192 |
|
|
193 |
|
|
194 |
< |
markdirty(hp, i) /* mark holodeck directory position dirty */ |
194 |
> |
hdmarkdirty(hp, i) /* mark holodeck directory position dirty */ |
195 |
|
register HOLO *hp; |
196 |
|
int i; |
197 |
|
{ |
203 |
|
if (lseek(hp->fd, biglob(hp)->fo+(i-1)*sizeof(BEAMI), 0) < 0 |
204 |
|
|| write(hp->fd, (char *)&smudge, |
205 |
|
sizeof(BEAMI)) != sizeof(BEAMI)) |
206 |
< |
error(SYSTEM, "seek/write error in markdirty"); |
206 |
> |
error(SYSTEM, "seek/write error in hdmarkdirty"); |
207 |
|
hp->dirseg[0].s = i; |
208 |
|
hp->dirseg[0].n = 1; |
209 |
|
return; |
650 |
|
hp->bi[i].fo = 0L; |
651 |
|
biglob(hp)->nrd += nrays - hp->bi[i].nrd; |
652 |
|
hp->bi[i].nrd = nrays; |
653 |
< |
markdirty(hp, i); /* section directory now out of date */ |
653 |
> |
hdmarkdirty(hp, i); /* section directory now out of date */ |
654 |
|
return(1); |
655 |
|
} |
656 |
|
|
671 |
|
if (hdfragl[hp->fd].writerr) /* check for file error */ |
672 |
|
return(0); |
673 |
|
if (i == 0) { /* clear entire holodeck */ |
674 |
+ |
if (blglob(hp)->nrm == 0) |
675 |
+ |
return(0); /* already clear */ |
676 |
|
nchanged = 0; |
677 |
|
for (i = nbeams(hp); i > 0; i--) |
678 |
|
if (hp->bl[i] != NULL) |
679 |
|
nchanged += hdfreebeam(hp, i); |
680 |
+ |
DCHECK(blglob(hp)->nrm != 0, |
681 |
+ |
CONSISTENCY, "bad beam count in hdfreebeam"); |
682 |
|
return(nchanged); |
683 |
|
} |
684 |
|
DCHECK(i < 1 | i > nbeams(hp), |
710 |
|
return(nchanged); |
711 |
|
} |
712 |
|
if (i == 0) { /* clobber entire holodeck */ |
713 |
+ |
if (biglob(hp)->nrd == 0 & blglob(hp)->nrm == 0) |
714 |
+ |
return(0); /* already empty */ |
715 |
|
nchanged = 0; |
716 |
+ |
nchanged = 0; |
717 |
|
for (i = nbeams(hp); i > 0; i--) |
718 |
|
if (hp->bi[i].nrd > 0 || hp->bl[i] != NULL) |
719 |
|
nchanged += hdkillbeam(hp, i); |
829 |
|
return; |
830 |
|
} |
831 |
|
/* flush all data and free memory */ |
832 |
< |
hdfreebeam(hp, 0); |
822 |
< |
hdsync(hp, 0); |
832 |
> |
hdflush(hp); |
833 |
|
/* release fragment resources */ |
834 |
|
hdrelease(hp->fd); |
835 |
|
/* remove hp from active list */ |