129 |
|
} |
130 |
|
hdfragl[fd].nlinks++; |
131 |
|
hdfragl[fd].writable = wr; /* set writable flag */ |
132 |
< |
hdfragl[fd].flen = lseek(fd, (off_t)0L, 2); /* get file length */ |
132 |
> |
hdfragl[fd].flen = lseek(fd, (off_t)0, 2); /* get file length */ |
133 |
|
} |
134 |
|
|
135 |
|
|
161 |
|
register int n; |
162 |
|
/* prepare for system errors */ |
163 |
|
errno = 0; |
164 |
< |
if ((fpos = lseek(fd, (off_t)0L, 1)) < 0) |
164 |
> |
if ((fpos = lseek(fd, (off_t)0, 1)) < 0) |
165 |
|
error(SYSTEM, "cannot determine holodeck file position"); |
166 |
|
if (hproto == NULL) { /* assume we're loading it */ |
167 |
|
HDGRID hpr; |
355 |
|
if (fd < 0) |
356 |
|
return(-1); |
357 |
|
if (fd >= nhdfragls || !hdfragl[fd].nlinks) { |
358 |
< |
if ((fpos = lseek(fd, (off_t)0L, 1)) < 0) |
358 |
> |
if ((fpos = lseek(fd, (off_t)0, 1)) < 0) |
359 |
|
return(-1); |
360 |
< |
flen = lseek(fd, (off_t)0L, 2); |
360 |
> |
flen = lseek(fd, (off_t)0, 2); |
361 |
|
lseek(fd, fpos, 0); |
362 |
|
return(flen); |
363 |
|
} |
469 |
|
hdfilord(hb1, hb2) /* order beams for quick loading */ |
470 |
|
register HDBEAMI *hb1, *hb2; |
471 |
|
{ |
472 |
< |
register long c; |
472 |
> |
register off_t c; |
473 |
|
/* residents go first */ |
474 |
|
if (hb2->h->bl[hb2->b] != NULL) |
475 |
|
return(hb1->h->bl[hb1->b] == NULL); |
476 |
|
if (hb1->h->bl[hb1->b] != NULL) |
477 |
|
return(-1); |
478 |
|
/* otherwise sort by file descriptor */ |
479 |
< |
if ((c = hb1->h->fd - hb2->h->fd)) |
480 |
< |
return(c); |
479 |
> |
if (hb1->h->fd != hb2->h->fd) |
480 |
> |
return(hb1->h->fd - hb2->h->fd); |
481 |
|
/* then by position in file */ |
482 |
|
c = hb1->h->bi[hb1->b].fo - hb2->h->bi[hb2->b].fo; |
483 |
|
return(c > 0 ? 1 : c < 0 ? -1 : 0); |
602 |
|
} |
603 |
|
biglob(hp)->nrd -= bi->nrd; /* tell fragment it's free */ |
604 |
|
bi->nrd = 0; |
605 |
< |
bi->fo = 0L; |
605 |
> |
bi->fo = 0; |
606 |
|
hdmarkdirty(hp, i); /* assume we'll reallocate */ |
607 |
|
return(1); |
608 |
|
} |
612 |
|
hdfragOK(fd, listlen, listsiz) /* get fragment list status for file */ |
613 |
|
int fd; |
614 |
|
int *listlen; |
615 |
< |
register int4 *listsiz; |
615 |
> |
register int32 *listsiz; |
616 |
|
{ |
617 |
|
register struct fraglist *f; |
618 |
|
register int i; |
635 |
|
off_t |
636 |
|
hdallocfrag(fd, nrays) /* allocate a file fragment */ |
637 |
|
int fd; |
638 |
< |
unsigned int4 nrays; |
638 |
> |
uint32 nrays; |
639 |
|
{ |
640 |
|
register struct fraglist *f; |
641 |
|
register int j; |
667 |
|
register int i; |
668 |
|
{ |
669 |
|
int fragfreed; |
670 |
< |
unsigned int4 nrays; |
670 |
> |
uint32 nrays; |
671 |
|
unsigned int n; |
672 |
|
off_t nfo; |
673 |
|
/* check file status */ |
693 |
|
} |
694 |
|
hp->bi[i].fo = nfo; |
695 |
|
} else |
696 |
< |
hp->bi[i].fo = 0L; |
696 |
> |
hp->bi[i].fo = 0; |
697 |
|
biglob(hp)->nrd += nrays - hp->bi[i].nrd; |
698 |
|
hp->bi[i].nrd = nrays; |
699 |
|
if (!fragfreed) |
781 |
|
if (hp->bi[i].nrd && !(hdfragflags&FF_KILL && hdfreefrag(hp,i))) { |
782 |
|
biglob(hp)->nrd -= hp->bi[i].nrd; /* free failed */ |
783 |
|
hp->bi[i].nrd = 0; |
784 |
< |
hp->bi[i].fo = 0L; |
784 |
> |
hp->bi[i].fo = 0; |
785 |
|
hdmarkdirty(hp, i); |
786 |
|
} |
787 |
|
return(nchanged); |