summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/block.c6
-rw-r--r--common/partitions.c29
2 files changed, 3 insertions, 32 deletions
diff --git a/common/block.c b/common/block.c
index 71ecfd5..e40374f 100644
--- a/common/block.c
+++ b/common/block.c
@@ -179,7 +179,7 @@ static void *block_get(struct block_device *blk, int block)
}
static ssize_t block_read(struct cdev *cdev, void *buf, size_t count,
- unsigned long offset, unsigned long flags)
+ loff_t offset, unsigned long flags)
{
struct block_device *blk = cdev->priv;
unsigned long mask = BLOCKSIZE(blk) - 1;
@@ -256,7 +256,7 @@ static int block_put(struct block_device *blk, const void *buf, int block)
}
static ssize_t block_write(struct cdev *cdev, const void *buf, size_t count,
- unsigned long offset, ulong flags)
+ loff_t offset, ulong flags)
{
struct block_device *blk = cdev->priv;
unsigned long mask = BLOCKSIZE(blk) - 1;
@@ -338,7 +338,7 @@ static struct file_operations block_ops = {
int blockdevice_register(struct block_device *blk)
{
- size_t size = blk->num_blocks * BLOCKSIZE(blk);
+ loff_t size = (loff_t)blk->num_blocks * BLOCKSIZE(blk);
int ret;
int i;
diff --git a/common/partitions.c b/common/partitions.c
index 74b4f12..a8c9625 100644
--- a/common/partitions.c
+++ b/common/partitions.c
@@ -43,23 +43,6 @@ struct partition_desc {
};
/**
- * Reject values which cannot be used in Barebox
- * @param val Value to be check
- * @return 0 if value can be used in Barebox, -EINVAL if not
- *
- * @note this routine can be removed when Barebox uses file offsets larger
- * than 32 bit
- */
-static int check_offset_value(uint64_t val)
-{
-#if 1 /* until Barebox can handle 64 bit offsets */
- if (val > (__INT_MAX__ / SECTOR_SIZE))
- return -EINVAL;
-#endif
- return 0;
-}
-
-/**
* Guess the size of the disk, based on the partition table entries
* @param dev device to create partitions for
* @param table partition table
@@ -76,12 +59,6 @@ static int disk_guess_size(struct device_d *dev, struct partition_entry *table)
size += get_unaligned(&table[i].partition_size);
}
}
- /* limit disk sector counts we can't handle due to 32 bit limits */
- if (check_offset_value(size) != 0) {
- dev_warn(dev, "Warning: Sector count limited due to 31 bit"
- "contraints\n");
- size = __INT_MAX__ / SECTOR_SIZE;
- }
return (int)size;
}
@@ -126,12 +103,6 @@ static void __maybe_unused try_dos_partition(struct block_device *blk,
pentry.first_sec = get_unaligned(&table[i].partition_start);
pentry.size = get_unaligned(&table[i].partition_size);
- /* do we have to ignore this partition due to limitations? */
- if (check_offset_value(pentry.first_sec) != 0)
- continue;
- if (check_offset_value(pentry.size) != 0)
- continue;
-
if (pentry.first_sec != 0) {
pd->parts[pd->used_entries].first_sec = pentry.first_sec;
pd->parts[pd->used_entries].size = pentry.size;