diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2011-07-22 09:23:43 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2011-07-22 09:23:43 -0500 |
commit | bf1cd9b4f54c8f630291dcd057c3aa293a510bcb (patch) | |
tree | f348eb9684fcc99b35797e47e12903881c8ede8b /block.c | |
parent | d1afc48b7cfdb4490f322d5d82a2aae6d545ec06 (diff) | |
parent | aaf55b4795d95d87353a08710f237f88d81a3c35 (diff) |
Merge remote-tracking branch 'kwolf/for-anthony' into staging
Diffstat (limited to 'block.c')
-rw-r--r-- | block.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -1147,6 +1147,25 @@ int bdrv_truncate(BlockDriverState *bs, int64_t offset) } /** + * Length of a allocated file in bytes. Sparse files are counted by actual + * allocated space. Return < 0 if error or unknown. + */ +int64_t bdrv_get_allocated_file_size(BlockDriverState *bs) +{ + BlockDriver *drv = bs->drv; + if (!drv) { + return -ENOMEDIUM; + } + if (drv->bdrv_get_allocated_file_size) { + return drv->bdrv_get_allocated_file_size(bs); + } + if (bs->file) { + return bdrv_get_allocated_file_size(bs->file); + } + return -ENOTSUP; +} + +/** * Length of a file in bytes. Return < 0 if error or unknown. */ int64_t bdrv_getlength(BlockDriverState *bs) |