New targets for:
[lwext4.git] / blockdev / filedev / ext4_filedev.c
index 07bf1507a665989a0a97352655d2c10c7a400484..aa6360097bd55f4704924f3880455742f6132c6b 100644 (file)
@@ -25,6 +25,9 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+
+#define _FILE_OFFSET_BITS 64
+
 #include <ext4_config.h>
 #include <ext4_blockdev.h>
 #include <ext4_errno.h>
@@ -42,7 +45,7 @@ static const char *fname = "ext2";
 /**@brief   Image file descriptor.*/
 static FILE *dev_file;
 
-#define DROP_LINUXCACHE_BUFFERS 1
+#define DROP_LINUXCACHE_BUFFERS 0
 
 
 /**********************BLOCKDEV INTERFACE**************************************/
@@ -65,13 +68,10 @@ EXT4_BLOCKDEV_STATIC_INSTANCE(
     filedev_close
 );
 
-/******************************************************************************/
-EXT4_BCACHE_STATIC_INSTANCE(__cache, CONFIG_BLOCK_DEV_CACHE_SIZE, 1024);
-
 /******************************************************************************/
 static int filedev_open(struct ext4_blockdev *bdev)
 {
-    dev_file = fopen64(fname, "r+b");
+    dev_file = fopen(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(fseeko64(dev_file, 0, SEEK_END))
+    if(fseek(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(fseeko64(dev_file, blk_id * bdev->ph_bsize, SEEK_SET))
+    if(fseek(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(fseeko64(dev_file, blk_id * bdev->ph_bsize, SEEK_SET))
+    if(fseek(dev_file, blk_id * bdev->ph_bsize, SEEK_SET))
         return EIO;
 
     if(!fwrite(buf, bdev->ph_bsize * blk_cnt, 1, dev_file))
@@ -134,13 +134,6 @@ static int filedev_close(struct  ext4_blockdev *bdev)
     return EOK;
 }
 
-
-/******************************************************************************/
-
-struct ext4_bcache* ext4_filecache_get(void)
-{
-    return &__cache;
-}
 /******************************************************************************/
 struct ext4_blockdev* ext4_filedev_get(void)
 {