summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/dev.c23
-rw-r--r--fs/ext4/ext4_common.c27
-rw-r--r--fs/fat/fat.c6
-rw-r--r--fs/fat/fat_write.c5
4 files changed, 24 insertions, 37 deletions
diff --git a/fs/ext4/dev.c b/fs/ext4/dev.c
index 3eef66f847..ee84d3fbe1 100644
--- a/fs/ext4/dev.c
+++ b/fs/ext4/dev.c
@@ -24,6 +24,7 @@
*/
#include <common.h>
+#include <blk.h>
#include <config.h>
#include <memalign.h>
#include <ext4fs.h>
@@ -76,9 +77,8 @@ int ext4fs_devread(lbaint_t sector, int byte_offset, int byte_len, char *buf)
if (byte_offset != 0) {
int readlen;
/* read first part which isn't aligned with start of sector */
- if (ext4fs_blk_desc->block_read(ext4fs_blk_desc,
- part_info->start + sector,
- 1, (void *)sec_buf) != 1) {
+ if (blk_dread(ext4fs_blk_desc, part_info->start + sector, 1,
+ (void *)sec_buf) != 1) {
printf(" ** ext2fs_devread() read error **\n");
return 0;
}
@@ -100,17 +100,15 @@ int ext4fs_devread(lbaint_t sector, int byte_offset, int byte_len, char *buf)
ALLOC_CACHE_ALIGN_BUFFER(u8, p, ext4fs_blk_desc->blksz);
block_len = ext4fs_blk_desc->blksz;
- ext4fs_blk_desc->block_read(ext4fs_blk_desc,
- part_info->start + sector,
- 1, (void *)p);
+ blk_dread(ext4fs_blk_desc, part_info->start + sector, 1,
+ (void *)p);
memcpy(buf, p, byte_len);
return 1;
}
- if (ext4fs_blk_desc->block_read(ext4fs_blk_desc,
- part_info->start + sector,
- block_len >> log2blksz, (void *)buf)
- != block_len >> log2blksz) {
+ if (blk_dread(ext4fs_blk_desc, part_info->start + sector,
+ block_len >> log2blksz, (void *)buf) !=
+ block_len >> log2blksz) {
printf(" ** %s read error - block\n", __func__);
return 0;
}
@@ -121,9 +119,8 @@ int ext4fs_devread(lbaint_t sector, int byte_offset, int byte_len, char *buf)
if (byte_len != 0) {
/* read rest of data which are not in whole sector */
- if (ext4fs_blk_desc->block_read(ext4fs_blk_desc,
- part_info->start + sector,
- 1, (void *)sec_buf) != 1) {
+ if (blk_dread(ext4fs_blk_desc, part_info->start + sector, 1,
+ (void *)sec_buf) != 1) {
printf("* %s read error - last part\n", __func__);
return 0;
}
diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
index 294a46eadf..84fba767c1 100644
--- a/fs/ext4/ext4_common.c
+++ b/fs/ext4/ext4_common.c
@@ -81,29 +81,20 @@ void put_ext4(uint64_t off, void *buf, uint32_t size)
}
if (remainder) {
- if (fs->dev_desc->block_read) {
- fs->dev_desc->block_read(fs->dev_desc,
- startblock, 1, sec_buf);
- temp_ptr = sec_buf;
- memcpy((temp_ptr + remainder),
- (unsigned char *)buf, size);
- fs->dev_desc->block_write(fs->dev_desc,
- startblock, 1, sec_buf);
- }
+ blk_dread(fs->dev_desc, startblock, 1, sec_buf);
+ temp_ptr = sec_buf;
+ memcpy((temp_ptr + remainder), (unsigned char *)buf, size);
+ blk_dwrite(fs->dev_desc, startblock, 1, sec_buf);
} else {
if (size >> log2blksz != 0) {
- fs->dev_desc->block_write(fs->dev_desc,
- startblock,
- size >> log2blksz,
- (unsigned long *)buf);
+ blk_dwrite(fs->dev_desc, startblock, size >> log2blksz,
+ (unsigned long *)buf);
} else {
- fs->dev_desc->block_read(fs->dev_desc,
- startblock, 1, sec_buf);
+ blk_dread(fs->dev_desc, startblock, 1, sec_buf);
temp_ptr = sec_buf;
memcpy(temp_ptr, buf, size);
- fs->dev_desc->block_write(fs->dev_desc,
- startblock, 1,
- (unsigned long *)sec_buf);
+ blk_dwrite(fs->dev_desc, startblock, 1,
+ (unsigned long *)sec_buf);
}
}
}
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index f87ddd7630..600a90e309 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -10,6 +10,7 @@
*/
#include <common.h>
+#include <blk.h>
#include <config.h>
#include <exports.h>
#include <fat.h>
@@ -48,11 +49,10 @@ static int disk_read(__u32 block, __u32 nr_blocks, void *buf)
{
ulong ret;
- if (!cur_dev || !cur_dev->block_read)
+ if (!cur_dev)
return -1;
- ret = cur_dev->block_read(cur_dev, cur_part_info.start + block,
- nr_blocks, buf);
+ ret = blk_dread(cur_dev, cur_part_info.start + block, nr_blocks, buf);
if (nr_blocks && ret == 0)
return -1;
diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index 5ed324ce1a..baa85ec3b4 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -32,7 +32,7 @@ static int disk_write(__u32 block, __u32 nr_blocks, void *buf)
{
ulong ret;
- if (!cur_dev || !cur_dev->block_write)
+ if (!cur_dev)
return -1;
if (cur_part_info.start + block + nr_blocks >
@@ -41,8 +41,7 @@ static int disk_write(__u32 block, __u32 nr_blocks, void *buf)
return -1;
}
- ret = cur_dev->block_write(cur_dev, cur_part_info.start + block,
- nr_blocks, buf);
+ ret = blk_dwrite(cur_dev, cur_part_info.start + block, nr_blocks, buf);
if (nr_blocks && ret == 0)
return -1;
OpenPOWER on IntegriCloud