Lines Matching refs:pos
296 loff_t pos = lseek64(fd, 0, SEEK_CUR);
301 while (pos + size <= (int) partition->size) {
302 if (lseek64(fd, pos, SEEK_SET) != pos || read(fd, data, size) != size) {
304 pos, strerror(errno));
311 after.failed - before.failed, pos);
314 } else if ((mgbb = ioctl(fd, MEMGETBADBLOCK, &pos))) {
317 mgbb, pos, errno);
322 pos += partition->erase_size;
398 static void add_bad_block_offset(MtdWriteContext *ctx, off_t pos) {
404 ctx->bad_block_offsets[ctx->bad_block_count++] = pos;
412 off_t pos = lseek(fd, 0, SEEK_CUR);
413 if (pos == (off_t) -1) return 1;
416 while (pos + size <= (int) partition->size) {
417 loff_t bpos = pos;
420 add_bad_block_offset(ctx, pos);
423 pos, ret, errno);
424 pos += partition->erase_size;
429 erase_info.start = pos;
435 pos, strerror(errno));
438 if (lseek(fd, pos, SEEK_SET) != pos ||
441 pos, strerror(errno));
445 if (lseek(fd, pos, SEEK_SET) != pos ||
448 pos, strerror(errno));
453 pos, strerror(errno));
460 printf("mtd: successfully wrote block at %lx\n", pos);
465 add_bad_block_offset(ctx, pos);
466 printf("mtd: skipping write block at 0x%08lx\n", pos);
468 pos += partition->erase_size;
515 off_t pos = lseek(ctx->fd, 0, SEEK_CUR);
516 if ((off_t) pos == (off_t) -1) return pos;
518 const int total = (ctx->partition->size - pos) / ctx->partition->erase_size;
527 loff_t bpos = pos;
529 printf("mtd: not erasing bad block at 0x%08lx\n", pos);
530 pos += ctx->partition->erase_size;
535 erase_info.start = pos;
538 printf("mtd: erase failure at 0x%08lx\n", pos);
540 pos
543 return pos;
558 /* Return the offset of the first good block at or after pos (which
559 * might be pos itself).
561 off_t mtd_find_write_start(MtdWriteContext *ctx, off_t pos) {
564 if (ctx->bad_block_offsets[i] == pos) {
565 pos += ctx->partition->erase_size;
566 } else if (ctx->bad_block_offsets[i] > pos) {
567 return pos;
570 return pos;