--- ray/src/hd/holofile.c 2004/01/01 11:21:55 3.55 +++ ray/src/hd/holofile.c 2016/03/06 01:13:17 3.60 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: holofile.c,v 3.55 2004/01/01 11:21:55 schorsch Exp $"; +static const char RCSid[] = "$Id: holofile.c,v 3.60 2016/03/06 01:13:17 schorsch Exp $"; #endif /* * Routines for managing holodeck files @@ -18,9 +18,9 @@ static const char RCSid[] = "$Id: holofile.c,v 3.55 20 #ifndef CACHESIZE #ifdef SMLMEM -#define CACHESIZE 5 +#define CACHESIZE 10 #else -#define CACHESIZE 17 /* default cache size (Mbytes, 0==inf) */ +#define CACHESIZE 100 /* default cache size (Mbytes, 0==inf) */ #endif #endif #ifndef FREEBEAMS @@ -30,7 +30,7 @@ static const char RCSid[] = "$Id: holofile.c,v 3.55 20 #define PCTFREE 15 /* maximum fraction to free (%) */ #endif #ifndef MAXFRAGB -#define MAXFRAGB 16 /* fragment blocks/file to track (0==inf) */ +#define MAXFRAGB 64 /* fragment blocks/file to track (0==inf) */ #endif #ifndef FF_DEFAULT /* when to free a beam fragment */ @@ -42,7 +42,13 @@ static const char RCSid[] = "$Id: holofile.c,v 3.55 20 #endif #ifndef BSD +#ifdef write /* platform.h renames those for Windows */ +#undef write +#endif #define write writebuf /* safe i/o routines */ +#ifdef read +#undef read +#endif #define read readbuf #endif @@ -246,7 +252,8 @@ hdinit( /* initialize a holodeck section in a file */ } if (rtrunc) { sprintf(errmsg, "truncated section, %ld rays lost (%.1f%%)", - rtrunc, 100.*rtrunc/(rtrunc+biglob(hp)->nrd)); + (long)rtrunc, + 100.*rtrunc/(rtrunc+biglob(hp)->nrd)); error(WARNING, errmsg); } /* add to holodeck list */ @@ -403,28 +410,26 @@ hdfilen( /* return file length for fd */ extern off_t hdfiluse( /* compute file usage (in bytes) */ - int fd, /* open file descriptor to check */ - int all /* include overhead and unflushed data */ + int fd /* open file descriptor to check */ ) { off_t total = 0; - register int i, j; + register int j; for (j = 0; hdlist[j] != NULL; j++) { if (hdlist[j]->fd != fd) continue; total += biglob(hdlist[j])->nrd * sizeof(RAYVAL); - if (all) { - for (i = nbeams(hdlist[j]); i > 0; i--) - if (hdlist[j]->bl[i] != NULL) - total += sizeof(RAYVAL) * + total += nbeams(hdlist[j])*sizeof(BEAMI) + sizeof(HDGRID); +#if 0 + for (i = nbeams(hdlist[j]); i > 0; i--) + if (hdlist[j]->bl[i] != NULL) + total += sizeof(RAYVAL) * (hdlist[j]->bl[i]->nrm - hdlist[j]->bi[i].nrd); - total += sizeof(HDGRID) + - nbeams(hdlist[j])*sizeof(BEAMI); - } +#endif } - return(total); /* does not include fragments */ + return(total); /* doesn't include fragments, unflushed rays */ }