Revision 94282e71 block/raw-posix.c
b/block/raw-posix.c | ||
---|---|---|
606 | 606 |
int64_t sector_num, |
607 | 607 |
int nb_sectors, int *pnum) |
608 | 608 |
{ |
609 |
BDRVRawState *s = bs->opaque; |
|
610 | 609 |
off_t start, data, hole; |
611 | 610 |
int ret; |
612 | 611 |
|
... | ... | |
616 | 615 |
} |
617 | 616 |
|
618 | 617 |
start = sector_num * BDRV_SECTOR_SIZE; |
618 |
|
|
619 | 619 |
#ifdef CONFIG_FIEMAP |
620 |
|
|
621 |
BDRVRawState *s = bs->opaque; |
|
620 | 622 |
struct { |
621 | 623 |
struct fiemap fm; |
622 | 624 |
struct fiemap_extent fe; |
623 | 625 |
} f; |
626 |
|
|
624 | 627 |
f.fm.fm_start = start; |
625 | 628 |
f.fm.fm_length = (int64_t)nb_sectors * BDRV_SECTOR_SIZE; |
626 | 629 |
f.fm.fm_flags = 0; |
... | ... | |
643 | 646 |
data = f.fe.fe_logical; |
644 | 647 |
hole = f.fe.fe_logical + f.fe.fe_length; |
645 | 648 |
} |
649 |
|
|
646 | 650 |
#elif defined SEEK_HOLE && defined SEEK_DATA |
651 |
|
|
652 |
BDRVRawState *s = bs->opaque; |
|
653 |
|
|
647 | 654 |
hole = lseek(s->fd, start, SEEK_HOLE); |
648 | 655 |
if (hole == -1) { |
649 | 656 |
/* -ENXIO indicates that sector_num was past the end of the file. |
Also available in: Unified diff