summaryrefslogtreecommitdiff
path: root/fs/reiserfs/dev.c
diff options
context:
space:
mode:
authorAlbert ARIBAUD <albert.u.boot@aribaud.net>2012-09-30 23:49:17 +0200
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2012-09-30 23:49:17 +0200
commit1c27059a2f7158a9c9a8778535b030935d75179d (patch)
treebf577d5c9f0da21c5d57feed1091214e54c39dec /fs/reiserfs/dev.c
parent8f0732ac3dc3bdbbcada313dc4b4b38d5d2c376a (diff)
parent4668a086bb0a769b741e3a4ffab85f1c41c7cdb8 (diff)
downloadu-boot-imx-1c27059a2f7158a9c9a8778535b030935d75179d.zip
u-boot-imx-1c27059a2f7158a9c9a8778535b030935d75179d.tar.gz
u-boot-imx-1c27059a2f7158a9c9a8778535b030935d75179d.tar.bz2
Merge remote-tracking branch 'u-boot/master'
Diffstat (limited to 'fs/reiserfs/dev.c')
-rw-r--r--fs/reiserfs/dev.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/fs/reiserfs/dev.c b/fs/reiserfs/dev.c
index 1facfaf..cb288d6 100644
--- a/fs/reiserfs/dev.c
+++ b/fs/reiserfs/dev.c
@@ -25,24 +25,13 @@
#include "reiserfs_private.h"
static block_dev_desc_t *reiserfs_block_dev_desc;
-static disk_partition_t part_info;
+static disk_partition_t *part_info;
-int reiserfs_set_blk_dev(block_dev_desc_t *rbdd, int part)
+void reiserfs_set_blk_dev(block_dev_desc_t *rbdd, disk_partition_t *info)
{
reiserfs_block_dev_desc = rbdd;
-
- if (part == 0) {
- /* disk doesn't use partition table */
- part_info.start = 0;
- part_info.size = rbdd->lba;
- part_info.blksz = rbdd->blksz;
- } else {
- if (get_partition_info (reiserfs_block_dev_desc, part, &part_info)) {
- return 0;
- }
- }
- return (part_info.size);
+ part_info = info;
}
@@ -59,7 +48,7 @@ int reiserfs_devread (int sector, int byte_offset, int byte_len, char *buf)
*/
if (sector < 0
|| ((sector + ((byte_offset + byte_len - 1) >> SECTOR_BITS))
- >= part_info.size)) {
+ >= part_info->size)) {
/* errnum = ERR_OUTSIDE_PART; */
printf (" ** reiserfs_devread() read outside partition\n");
return 0;
@@ -83,7 +72,8 @@ int reiserfs_devread (int sector, int byte_offset, int byte_len, char *buf)
if (byte_offset != 0) {
/* read first part which isn't aligned with start of sector */
if (reiserfs_block_dev_desc->block_read(reiserfs_block_dev_desc->dev,
- part_info.start+sector, 1, (unsigned long *)sec_buf) != 1) {
+ part_info->start + sector, 1,
+ (unsigned long *)sec_buf) != 1) {
printf (" ** reiserfs_devread() read error\n");
return 0;
}
@@ -96,8 +86,8 @@ int reiserfs_devread (int sector, int byte_offset, int byte_len, char *buf)
/* read sector aligned part */
block_len = byte_len & ~(SECTOR_SIZE-1);
if (reiserfs_block_dev_desc->block_read(reiserfs_block_dev_desc->dev,
- part_info.start+sector, block_len/SECTOR_SIZE, (unsigned long *)buf) !=
- block_len/SECTOR_SIZE) {
+ part_info->start + sector, block_len/SECTOR_SIZE,
+ (unsigned long *)buf) != block_len/SECTOR_SIZE) {
printf (" ** reiserfs_devread() read error - block\n");
return 0;
}
@@ -108,7 +98,8 @@ int reiserfs_devread (int sector, int byte_offset, int byte_len, char *buf)
if ( byte_len != 0 ) {
/* read rest of data which are not in whole sector */
if (reiserfs_block_dev_desc->block_read(reiserfs_block_dev_desc->dev,
- part_info.start+sector, 1, (unsigned long *)sec_buf) != 1) {
+ part_info->start + sector, 1,
+ (unsigned long *)sec_buf) != 1) {
printf (" ** reiserfs_devread() read error - last part\n");
return 0;
}