ref: 2057a5f4d23e187fad7c3d5ebb261e72233ce592
parent: 0225f4b6bbff4f2517a53b11ddcbeb57d7193f21
author: ngkaho1234 <ngkaho1234@gmail.com>
date: Sat Nov 14 05:52:15 EST 2015
define _LARGEFILE64_SOURCE to be able to access large files.
--- a/blockdev/linux/ext4_filedev.c
+++ b/blockdev/linux/ext4_filedev.c
@@ -26,6 +26,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#define _LARGEFILE64_SOURCE
#define _FILE_OFFSET_BITS 64
#include <ext4_config.h>
@@ -70,7 +71,7 @@
/*No buffering at file.*/
setbuf(dev_file, 0);
- if (fseek(dev_file, 0, SEEK_END))
+ if (fseeko(dev_file, 0, SEEK_END))
return EFAULT;
_filedev.ph_bcnt = ftell(dev_file) / _filedev.ph_bsize;
@@ -83,7 +84,7 @@
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 (fseeko(dev_file, blk_id * bdev->ph_bsize, SEEK_SET))
return EIO;
if (!fread(buf, bdev->ph_bsize * blk_cnt, 1, dev_file))
@@ -109,7 +110,7 @@
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 (fseeko(dev_file, blk_id * bdev->ph_bsize, SEEK_SET))
return EIO;
if (!fwrite(buf, bdev->ph_bsize * blk_cnt, 1, dev_file))