}
static int total_sector;
-static int disk_write(__u32 startblock, __u32 getsize, __u8 *bufptr)
+static int disk_write(__u32 block, __u32 nr_blocks, void *buf)
{
- if (cur_dev == NULL)
+ if (!cur_dev || !cur_dev->block_write)
return -1;
- if (startblock + getsize > total_sector) {
+ if (cur_part_info.start + block + nr_blocks >
+ cur_part_info.start + total_sector) {
printf("error: overflow occurs\n");
return -1;
}
- startblock += part_offset;
-
- if (cur_dev->block_read) {
- return cur_dev->block_write(cur_dev->dev, startblock, getsize,
- (unsigned long *) bufptr);
- }
- return -1;
+ return cur_dev->block_write(cur_dev->dev,
+ cur_part_info.start + block, nr_blocks, buf);
}
/*
if (size % mydata->sect_size)
sect_num++;
- if (startsect + sect_num > total_sector)
+ if (startsect + sect_num > cur_part_info.start + total_sector)
return -1;
return 0;
total_sector = bs.total_sect;
if (total_sector == 0)
- total_sector = part_size;
+ total_sector = cur_part_info.size;
root_cluster = bs.root_cluster;