Lines Matching refs:pos
290 loff_t pos = TEMP_FAILURE_RETRY(lseek64(fd, 0, SEEK_CUR)); in read_block() local
291 if (pos == -1) { in read_block()
299 while (pos + size <= (int) partition->size) { in read_block()
300 if (TEMP_FAILURE_RETRY(lseek64(fd, pos, SEEK_SET)) != pos || in read_block()
303 pos, strerror(errno)); in read_block()
310 after.failed - before.failed, pos); in read_block()
313 } else if ((mgbb = ioctl(fd, MEMGETBADBLOCK, &pos))) { in read_block()
316 mgbb, pos, strerror(errno)); in read_block()
321 pos += partition->erase_size; in read_block()
397 static void add_bad_block_offset(MtdWriteContext *ctx, off_t pos) { in add_bad_block_offset() argument
403 ctx->bad_block_offsets[ctx->bad_block_count++] = pos; in add_bad_block_offset()
411 off_t pos = TEMP_FAILURE_RETRY(lseek(fd, 0, SEEK_CUR)); in write_block() local
412 if (pos == (off_t) -1) { in write_block()
418 while (pos + size <= (int) partition->size) { in write_block()
419 loff_t bpos = pos; in write_block()
422 add_bad_block_offset(ctx, pos); in write_block()
425 pos, ret, strerror(errno)); in write_block()
426 pos += partition->erase_size; in write_block()
431 erase_info.start = pos; in write_block()
437 pos, strerror(errno)); in write_block()
440 if (TEMP_FAILURE_RETRY(lseek(fd, pos, SEEK_SET)) != pos || in write_block()
443 pos, strerror(errno)); in write_block()
447 if (TEMP_FAILURE_RETRY(lseek(fd, pos, SEEK_SET)) != pos || in write_block()
450 pos, strerror(errno)); in write_block()
455 pos, strerror(errno)); in write_block()
462 printf("mtd: successfully wrote block at %lx\n", pos); in write_block()
467 add_bad_block_offset(ctx, pos); in write_block()
468 printf("mtd: skipping write block at 0x%08lx\n", pos); in write_block()
470 pos += partition->erase_size; in write_block()
517 off_t pos = TEMP_FAILURE_RETRY(lseek(ctx->fd, 0, SEEK_CUR)); in mtd_erase_blocks() local
518 if ((off_t) pos == (off_t) -1) { in mtd_erase_blocks()
523 const int total = (ctx->partition->size - pos) / ctx->partition->erase_size; in mtd_erase_blocks()
532 loff_t bpos = pos; in mtd_erase_blocks()
534 printf("mtd: not erasing bad block at 0x%08lx\n", pos); in mtd_erase_blocks()
535 pos += ctx->partition->erase_size; in mtd_erase_blocks()
540 erase_info.start = pos; in mtd_erase_blocks()
543 printf("mtd: erase failure at 0x%08lx\n", pos); in mtd_erase_blocks()
545 pos += ctx->partition->erase_size; in mtd_erase_blocks()
548 return pos; in mtd_erase_blocks()