Lines Matching refs:offset
83 static struct map *getmapping(Dosdisc_t *dp, Sfoff_t offset, register int whence)
85 static struct map *getmapping(dp, offset, whence)
87 Sfoff_t offset;
93 if(offset <= dp->begin)
95 dummy.logical = dummy.physical = offset;
104 while((++mp)->logical && (whence==SEEK_CUR?mp->physical:mp->logical) <= offset);
224 * returns the current offset
225 * <offset> must be in the current buffer
226 * if <whence> is SEEK_CUR, physical offset converted to logical offset
227 * otherwise, logical offset is converted to physical offset
230 static Sfoff_t cur_offset(Dosdisc_t *dp, Sfoff_t offset,Sfio_t *iop,register int whence)
232 static Sfoff_t cur_offset(dp, offset, iop, whence)
234 Sfoff_t offset;
245 n = offset - dp->plast;
247 offset = dp->llast;
252 n = offset - dp->llast;
253 offset = dp->plast;
255 offset +=n;
272 return(offset+m);
276 static Sfoff_t dos_seek(Sfio_t *iop, Sfoff_t offset, register int whence, Sfdisc_t* disc)
278 static Sfoff_t dos_seek(iop, offset, whence, disc)
280 Sfoff_t offset;
293 offset = sfsk(iop, (Sfoff_t)0,SEEK_CUR,disc);
294 if(offset<=dp->begin)
295 return(offset);
297 if(offset==dp->phere)
299 else if(offset==dp->plast)
301 else if(offset<dp->plast || offset>dp->phere)
302 mp = getmapping(dp,offset,whence);
306 if(offset<dp->llast || offset > dp->lhere)
307 mp = getmapping(dp,offset,whence);
311 return(sfsk(iop,offset,SEEK_END,disc));
331 if(whence==SEEK_CUR && dp->phere>=offset)
333 if(whence==SEEK_SET && dp->lhere>=offset)
340 if(whence==SEEK_END && offset<0)
342 offset = dp->lhere;
350 offset += dp->lhere;
353 physical = cur_offset(dp,offset,iop,whence);
358 dp->lhere = offset;
361 offset = physical;
363 return(offset);