ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/holofile.c
(Generate patch)

Comparing ray/src/hd/holofile.c (file contents):
Revision 3.36 by gwlarson, Mon Feb 1 09:56:18 1999 UTC vs.
Revision 3.39 by gwlarson, Tue Mar 9 08:40:11 1999 UTC

# Line 14 | Line 14 | static char SCCSid[] = "$SunId$ SGI";
14  
15   #ifndef CACHESIZE
16   #ifdef BIGMEM
17 < #define CACHESIZE       32      /* default cache size (Mbytes, 0==inf) */
17 > #define CACHESIZE       17      /* default cache size (Mbytes, 0==inf) */
18   #else
19 < #define CACHESIZE       12
19 > #define CACHESIZE       5
20   #endif
21   #endif
22   #ifndef FREEBEAMS
# Line 30 | Line 30 | static char SCCSid[] = "$SunId$ SGI";
30   #endif
31   #ifndef FF_DEFAULT
32                                  /* when to free a beam fragment */
33 < #define FF_DEFAULT      (FF_ALLOC|FF_WRITE|FF_KILL)
33 > #define FF_DEFAULT      (FF_WRITE|FF_KILL)
34   #endif
35   #ifndef MINDIRSEL
36                                  /* minimum directory seek length */
# Line 191 | Line 191 | memerr:
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   {
# Line 203 | Line 203 | int    i;
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;
# Line 559 | Line 559 | int    i;
559          biglob(hp)->nrd -= bi->nrd;             /* tell fragment it's free */
560          bi->nrd = 0;
561          bi->fo = 0L;
562 +        hdmarkdirty(hp, i);                     /* assume we'll reallocate */
563          return(1);
564   }
565  
# Line 621 | Line 622 | hdsyncbeam(hp, i)              /* sync beam in memory with beam on
622   register HOLO   *hp;
623   register int    i;
624   {
625 +        int     fragfreed;
626          unsigned int4   nrays;
627          unsigned int    n;
628          long    nfo;
# Line 632 | Line 634 | register int   i;
634                                          /* is current fragment OK? */
635          if (hp->bl[i] == NULL || (nrays = hp->bl[i]->nrm) == hp->bi[i].nrd)
636                  return(0);
637 <        if (hdfragflags&FF_WRITE && hp->bi[i].nrd)
638 <                hdfreefrag(hp, i);      /* relinquish old fragment */
637 >                                        /* relinquish old fragment? */
638 >        fragfreed = hdfragflags&FF_WRITE && hp->bi[i].nrd && hdfreefrag(hp,i);
639          if (nrays) {                    /* get and write new fragment */
640                  nfo = hdallocfrag(hp->fd, nrays);
641                  errno = 0;
# Line 650 | Line 652 | register int   i;
652                  hp->bi[i].fo = 0L;
653          biglob(hp)->nrd += nrays - hp->bi[i].nrd;
654          hp->bi[i].nrd = nrays;
655 <        markdirty(hp, i);               /* section directory now out of date */
655 >        if (!fragfreed)
656 >                hdmarkdirty(hp, i);             /* need to flag dir. ent. */
657          return(1);
658   }
659  
# Line 726 | Line 729 | register int   i;
729          if (hp->bl[i] != NULL) {        /* free memory */
730                  blglob(hp)->nrm -= nchanged = hp->bl[i]->nrm;
731                  free((char *)hp->bl[i]);
732 +                hp->bl[i] = NULL;
733          } else
734                  nchanged = hp->bi[i].nrd;
735 <        if (hp->bi[i].nrd) {
736 <                if (hdfragflags&FF_KILL)
737 <                        hdfreefrag(hp, i);
734 <                biglob(hp)->nrd -= hp->bi[i].nrd;
735 <                hp->bi[i].nrd = 0;      /* make sure it's gone */
735 >        if (hp->bi[i].nrd && !(hdfragflags&FF_KILL && hdfreefrag(hp,i))) {
736 >                biglob(hp)->nrd -= hp->bi[i].nrd;       /* free failed */
737 >                hp->bi[i].nrd = 0;
738                  hp->bi[i].fo = 0L;
739 +                hdmarkdirty(hp, i);
740          }
738        hp->bl[i] = NULL;
741          return(nchanged);
742   }
743  
# Line 829 | Line 831 | register HOLO  *hp;            /* NULL means clean up all */
831                  return;
832          }
833                                          /* flush all data and free memory */
834 <        hdfreebeam(hp, 0);
833 <        hdsync(hp, 0);
834 >        hdflush(hp);
835                                          /* release fragment resources */
836          hdrelease(hp->fd);
837                                          /* remove hp from active list */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines