Lines Matching refs:offset

50                 ptrdiff_t offset = &hex[m * 3] - hex;  in dump()  local
51 snprintf(hex + offset, sizeof(hex) - offset, "%02x ", in dump()
69 static inline bool is_erasure(fec_handle *f, uint64_t offset, in is_erasure() argument
72 if (unlikely(offset >= f->data_size)) { in is_erasure()
80 uint64_t n = offset / FEC_BLOCKSIZE; in is_erasure()
86 static inline bool is_zero(fec_handle *f, uint64_t offset) in is_zero() argument
90 if (hashtree.hash_data.empty() || unlikely(offset >= f->data_size)) { in is_zero()
94 uint64_t hash_offset = (offset / FEC_BLOCKSIZE) * SHA256_DIGEST_LENGTH; in is_zero()
107 static int __ecc_read(fec_handle *f, void *rs, uint8_t *dest, uint64_t offset, in __ecc_read() argument
110 check(offset % FEC_BLOCKSIZE == 0); in __ecc_read()
115 uint64_t rsb = offset - (offset / (e->rounds * FEC_BLOCKSIZE)) * in __ecc_read()
128 if (interleaved == offset) { in __ecc_read()
235 uint64_t offset, size_t *errors) in ecc_read() argument
239 check(offset < f->data_size); in ecc_read()
240 check(offset + count <= f->data_size); in ecc_read()
243 debug("[%" PRIu64 ", %" PRIu64 ")", offset, offset + count); in ecc_read()
252 uint64_t curr = offset / FEC_BLOCKSIZE; in ecc_read()
253 size_t coff = (size_t)(offset - curr * FEC_BLOCKSIZE); in ecc_read()
286 uint64_t offset, size_t *errors) in verity_read() argument
290 check(offset < f->data_size); in verity_read()
291 check(offset + count <= f->data_size); in verity_read()
295 debug("[%" PRIu64 ", %" PRIu64 ")", offset, offset + count); in verity_read()
304 uint64_t curr = offset / FEC_BLOCKSIZE; in verity_read()
305 size_t coff = (size_t)(offset - curr * FEC_BLOCKSIZE); in verity_read()
346 offset, offset + count, curr); in verity_read()
350 offset, offset + count, curr); in verity_read()
370 offset, offset + count, curr, curr_offset); in verity_read()
403 int fec_seek(struct fec_handle *f, int64_t offset, int whence) in fec_seek() argument
408 if (offset < 0) { in fec_seek()
413 f->pos = offset; in fec_seek()
415 if (offset < 0 && f->pos < (uint64_t)-offset) { in fec_seek()
418 } else if (offset > 0 && (uint64_t)offset > UINT64_MAX - f->pos) { in fec_seek()
423 f->pos += offset; in fec_seek()
425 if (offset >= 0) { in fec_seek()
428 } else if ((uint64_t)-offset > f->size) { in fec_seek()
433 f->pos = f->size + offset; in fec_seek()
458 static inline size_t get_max_count(uint64_t offset, size_t count, uint64_t max) in get_max_count() argument
460 if (offset >= max) { in get_max_count()
462 } else if (offset > max - count) { in get_max_count()
463 return (size_t)(max - offset); in get_max_count()
471 bool raw_pread(int fd, void *buf, size_t count, uint64_t offset) { in raw_pread() argument
478 ssize_t n = TEMP_FAILURE_RETRY(pread64(fd, p, remaining, offset)); in raw_pread()
486 offset += n; in raw_pread()
493 bool raw_pwrite(int fd, const void *buf, size_t count, uint64_t offset) { in raw_pwrite() argument
500 ssize_t n = TEMP_FAILURE_RETRY(pwrite64(fd, p, remaining, offset)); in raw_pwrite()
508 offset += n; in raw_pwrite()
517 uint64_t offset) in fec_pread() argument
522 if (unlikely(offset > UINT64_MAX - count)) { in fec_pread()
529 get_max_count(offset, count, f->data_size), offset, in fec_pread()
534 count = get_max_count(offset, count, f->data_size); in fec_pread()
535 ssize_t rc = process(f, (uint8_t *)buf, count, offset, ecc_read); in fec_pread()
544 count = get_max_count(offset, count, f->size); in fec_pread()
547 if (raw_pread(f->fd, buf, count, offset)) { in fec_pread()