• Home
  • Raw
  • Download

Lines Matching refs:off

57   off_t off;     /**< Offset to a memory mapped region */  member
127 if (s->off >= impl->fsize) { in _exfile_initmmap_slot_lw()
130 nlen = MIN(s->maxlen, impl->fsize - s->off); in _exfile_initmmap_slot_lw()
157 s->mmap = mmap(s->mmap, s->len, prot, flags, impl->fh, s->off); // -V774 in _exfile_initmmap_slot_lw()
275 static iwrc _exfile_write(struct IWFS_EXT *f, off_t off, const void *buf, size_t siz, size_t *sp) { in _exfile_write() argument
278 off_t end = off + siz; in _exfile_write()
282 if (off < 0 || end < 0) { in _exfile_write()
285 if (impl->maxoff && off + siz > impl->maxoff) { in _exfile_write()
302 if (!s->len || wp + off <= s->off) { in _exfile_write()
305 if (s->off > off) { in _exfile_write()
306 len = MIN(wp, s->off - off); in _exfile_write()
307 rc = impl->file.write(&impl->file, off, (const char *) buf + (siz - wp), (size_t) len, sp); in _exfile_write()
310 off = off + *sp; in _exfile_write()
312 if (wp > 0 && s->off <= off && s->off + s->len > off) { in _exfile_write()
313 len = MIN(wp, s->off + s->len - off); in _exfile_write()
315 … rc = impl->dlsnr->onwrite(impl->dlsnr, off - s->off, (const char *) buf + (siz - wp), len, 0); in _exfile_write()
318 memcpy(s->mmap + (off - s->off), (const char *) buf + (siz - wp), (size_t) len); in _exfile_write()
320 off += len; in _exfile_write()
325 rc = impl->file.write(&impl->file, off, (const char *) buf + (siz - wp), (size_t) wp, sp); in _exfile_write()
339 static iwrc _exfile_read(struct IWFS_EXT *f, off_t off, void *buf, size_t siz, size_t *sp) { in _exfile_read() argument
342 off_t end = off + siz; in _exfile_read()
345 if (off < 0 || end < 0) { in _exfile_read()
353 siz = (size_t)(impl->fsize - off); in _exfile_read()
357 if (!s->len || rp + off <= s->off) { in _exfile_read()
360 if (s->off > off) { in _exfile_read()
361 len = MIN(rp, s->off - off); in _exfile_read()
362 rc = impl->file.read(&impl->file, off, (char *) buf + (siz - rp), (size_t) len, sp); in _exfile_read()
365 off = off + *sp; in _exfile_read()
367 if (rp > 0 && s->off <= off && s->off + s->len > off) { in _exfile_read()
368 len = MIN(rp, s->off + s->len - off); in _exfile_read()
369 memcpy((char *) buf + (siz - rp), s->mmap + (off - s->off), (size_t) len); in _exfile_read()
371 off += len; in _exfile_read()
376 rc = impl->file.read(&impl->file, off, (char *) buf + (siz - rp), (size_t) rp, sp); in _exfile_read()
399 static iwrc _exfile_copy(struct IWFS_EXT *f, off_t off, size_t siz, off_t noff) { in _exfile_copy() argument
404 if (s && s->mmap && s->off == 0 && s->len >= noff + siz) { // fully mmaped file in _exfile_copy()
408 rc = impl->dlsnr->onwrite(impl->dlsnr, noff, s->mmap + off, siz, 0); in _exfile_copy()
411 memmove(s->mmap + noff, s->mmap + off, siz); in _exfile_copy()
413 IWRC(impl->file.copy(&impl->file, off, siz, noff), rc); in _exfile_copy()
419 static iwrc _exfile_remove_mmap_lw(struct IWFS_EXT *f, off_t off) { in _exfile_remove_mmap_lw() argument
424 if (s->off == off) { in _exfile_remove_mmap_lw()
469 IWRC(_exfile_remove_mmap_lw(f, s->off), rc); in _exfile_close()
506 static iwrc _exfile_add_mmap_lw(struct IWFS_EXT *f, off_t off, size_t maxlen, iwfs_ext_mmap_opts_t … in _exfile_add_mmap_lw() argument
512 if ((uint64_t) off & (impl->psize - 1)) { in _exfile_add_mmap_lw()
516 if (OFF_T_MAX - off < maxlen) { in _exfile_add_mmap_lw()
517 maxlen = (size_t)(OFF_T_MAX - off); in _exfile_add_mmap_lw()
520 if (tmp < maxlen || OFF_T_MAX - off < tmp) { in _exfile_add_mmap_lw()
535 ns->off = off; in _exfile_add_mmap_lw()
548 off_t e1 = s->off + s->maxlen; in _exfile_add_mmap_lw()
549 off_t e2 = ns->off + ns->maxlen; in _exfile_add_mmap_lw()
550 if (IW_RANGES_OVERLAP(s->off, e1, ns->off, e2)) { in _exfile_add_mmap_lw()
554 if (ns->off < s->off) { in _exfile_add_mmap_lw()
588 static iwrc _exfile_add_mmap(struct IWFS_EXT *f, off_t off, size_t maxlen, iwfs_ext_mmap_opts_t mmo… in _exfile_add_mmap() argument
589 assert(f && off >= 0); in _exfile_add_mmap()
592 rc = _exfile_add_mmap_lw(f, off, maxlen, mmopts); in _exfile_add_mmap()
597 iwrc _exfile_acquire_mmap(struct IWFS_EXT *f, off_t off, uint8_t **mm, size_t *sp) { in _exfile_acquire_mmap() argument
598 assert(f && mm && off >= 0); in _exfile_acquire_mmap()
609 if (s->off == off) { in _exfile_acquire_mmap()
628 iwrc _exfile_probe_mmap_lr(struct IWFS_EXT *f, off_t off, uint8_t **mm, size_t *sp) { in _exfile_probe_mmap_lr() argument
629 assert(f && mm && off >= 0); in _exfile_probe_mmap_lr()
638 if (s->off == off) { in _exfile_probe_mmap_lr()
657 iwrc _exfile_probe_mmap(struct IWFS_EXT *f, off_t off, uint8_t **mm, size_t *sp) { in _exfile_probe_mmap() argument
660 rc = _exfile_probe_mmap_lr(f, off, mm, sp); in _exfile_probe_mmap()
670 static iwrc _exfile_remove_mmap(struct IWFS_EXT *f, off_t off) { in _exfile_remove_mmap() argument
671 assert(f && off >= 0); in _exfile_remove_mmap()
674 rc = _exfile_remove_mmap_lw(f, off); in _exfile_remove_mmap()
679 static iwrc _exfile_sync_mmap_lr(struct IWFS_EXT *f, off_t off, iwfs_sync_flags flags) { in _exfile_sync_mmap_lr() argument
680 assert(f && off >= 0); in _exfile_sync_mmap_lr()
686 if (s->off == off) { in _exfile_sync_mmap_lr()
707 static iwrc _exfile_sync_mmap(struct IWFS_EXT *f, off_t off, iwfs_sync_flags flags) { in _exfile_sync_mmap() argument
710 rc = _exfile_sync_mmap_lr(f, off, flags); in _exfile_sync_mmap()