Lines Matching refs:sector_num
886 static inline int32_t sector2cluster(BDRVVVFATState* s,off_t sector_num) in sector2cluster() argument
888 return (sector_num - s->offset_to_root_dir) / s->sectors_per_cluster; in sector2cluster()
1476 vvfat_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors) in vvfat_read() argument
1481 for(i=0;i<nb_sectors;i++,sector_num++) { in vvfat_read()
1482 if (sector_num >= bs->total_sectors) in vvfat_read()
1487 ret = bdrv_co_is_allocated(s->qcow->bs, sector_num * BDRV_SECTOR_SIZE, in vvfat_read()
1494 " allocated\n", sector_num, in vvfat_read()
1496 if (bdrv_co_pread(s->qcow, sector_num * BDRV_SECTOR_SIZE, n, in vvfat_read()
1501 sector_num += (n >> BDRV_SECTOR_BITS) - 1; in vvfat_read()
1505 sector_num)); in vvfat_read()
1507 if (sector_num < s->offset_to_root_dir) { in vvfat_read()
1508 if (sector_num < s->offset_to_fat) { in vvfat_read()
1510 &(s->first_sectors[sector_num * 0x200]), in vvfat_read()
1512 } else if (sector_num < s->offset_to_fat + s->sectors_per_fat) { in vvfat_read()
1514 &(s->fat.pointer[(sector_num in vvfat_read()
1517 } else if (sector_num < s->offset_to_root_dir) { in vvfat_read()
1519 &(s->fat.pointer[(sector_num - s->offset_to_fat in vvfat_read()
1524 uint32_t sector = sector_num - s->offset_to_root_dir, in vvfat_read()
1544 uint64_t sector_num = offset >> BDRV_SECTOR_BITS; in vvfat_co_preadv() local
1557 ret = vvfat_read(bs, sector_num, buf, nb_sectors); in vvfat_co_preadv()
2978 vvfat_write(BlockDriverState *bs, int64_t sector_num, in vvfat_write() argument
2994 if (sector_num == s->offset_to_bootsector && nb_sectors == 1) { in vvfat_write()
3023 if (sector_num < s->offset_to_fat) in vvfat_write()
3030 first_cluster = sector2cluster(s, sector_num); in vvfat_write()
3031 last_cluster = sector2cluster(s, sector_num + nb_sectors - 1); in vvfat_write()
3056 if (begin < sector_num) in vvfat_write()
3057 begin = sector_num; in vvfat_write()
3058 if (end > sector_num + nb_sectors) in vvfat_write()
3059 end = sector_num + nb_sectors; in vvfat_write()
3062 direntries = (direntry_t*)(buf + 0x200 * (begin - sector_num)); in vvfat_write()
3087 DLOG(fprintf(stderr, "Write to qcow backend: %d + %d\n", (int)sector_num, nb_sectors)); in vvfat_write()
3088 ret = bdrv_co_pwrite(s->qcow, sector_num * BDRV_SECTOR_SIZE, in vvfat_write()
3115 uint64_t sector_num = offset >> BDRV_SECTOR_BITS; in vvfat_co_pwritev() local
3129 ret = vvfat_write(bs, sector_num, buf, nb_sectors); in vvfat_co_pwritev()