summaryrefslogtreecommitdiff
path: root/blockdev
diff options
context:
space:
mode:
authorgkostka <kostka.grzegorz@gmail.com>2014-01-17 18:03:38 +0000
committergkostka <kostka.grzegorz@gmail.com>2014-01-17 18:03:38 +0000
commit614f11dab4983bf4e750cd14a4c90437e352bcf5 (patch)
tree3ac1469c38fa05d40a098e824ff666efc3c7d03b /blockdev
parentbc9718e5e24ce9416d6315c9f708181df1a0f5b0 (diff)
Support for large files and block devices.
Diffstat (limited to 'blockdev')
-rw-r--r--blockdev/filedev/ext4_filedev.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/blockdev/filedev/ext4_filedev.c b/blockdev/filedev/ext4_filedev.c
index 437e840..07bf150 100644
--- a/blockdev/filedev/ext4_filedev.c
+++ b/blockdev/filedev/ext4_filedev.c
@@ -71,7 +71,7 @@ EXT4_BCACHE_STATIC_INSTANCE(__cache, CONFIG_BLOCK_DEV_CACHE_SIZE, 1024);
/******************************************************************************/
static int filedev_open(struct ext4_blockdev *bdev)
{
- dev_file = fopen(fname, "r+b");
+ dev_file = fopen64(fname, "r+b");
if(!dev_file)
return EIO;
@@ -79,7 +79,7 @@ static int filedev_open(struct ext4_blockdev *bdev)
/*No buffering at file.*/
setbuf(dev_file, 0);
- if(fseek(dev_file, 0, SEEK_END))
+ if(fseeko64(dev_file, 0, SEEK_END))
return EFAULT;
_filedev.ph_bcnt = ftell(dev_file) / _filedev.ph_bsize;
@@ -92,7 +92,7 @@ static int filedev_open(struct ext4_blockdev *bdev)
static int filedev_bread(struct ext4_blockdev *bdev, void *buf, uint64_t blk_id,
uint32_t blk_cnt)
{
- if(fseek(dev_file, blk_id * bdev->ph_bsize, SEEK_SET))
+ if(fseeko64(dev_file, blk_id * bdev->ph_bsize, SEEK_SET))
return EIO;
if(!fread(buf, bdev->ph_bsize * blk_cnt, 1, dev_file))
@@ -118,7 +118,7 @@ static void drop_cache(void)
static int filedev_bwrite(struct ext4_blockdev *bdev, const void *buf,
uint64_t blk_id, uint32_t blk_cnt)
{
- if(fseek(dev_file, blk_id * bdev->ph_bsize, SEEK_SET))
+ if(fseeko64(dev_file, blk_id * bdev->ph_bsize, SEEK_SET))
return EIO;
if(!fwrite(buf, bdev->ph_bsize * blk_cnt, 1, dev_file))