summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2021-02-16 21:02:03 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2021-02-18 09:23:42 +0100
commit130fbc7f6c67357a58823c8f17ecef7d276386a9 (patch)
treecbf03d20fa48605aac314b871ffa925c76a2013f /include
parent47fe8d54c41a8076bb936f4b45304117af3a493d (diff)
downloadbarebox-130fbc7f6c67357a58823c8f17ecef7d276386a9.tar.gz
barebox-130fbc7f6c67357a58823c8f17ecef7d276386a9.tar.xz
block: use 64-bit types for sector offset and count on all platforms
barebox' use of int for the sector offset puts an upper bound of 1TB on the size of supported block devices, which is already exceeded by common place USB mass storage. Increasing the sizes involved to 64 bit like Linux does won't magically add missing driver support, but it gives us at least a fighting chance. Do so. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/ata_drive.h4
-rw-r--r--include/block.h15
-rw-r--r--include/linux/types.h5
3 files changed, 10 insertions, 14 deletions
diff --git a/include/ata_drive.h b/include/ata_drive.h
index eae74db855..6b8915c9cb 100644
--- a/include/ata_drive.h
+++ b/include/ata_drive.h
@@ -115,8 +115,8 @@ struct ata_port;
struct ata_port_operations {
int (*init)(struct ata_port *port);
- int (*read)(struct ata_port *port, void *buf, unsigned int block, int num_blocks);
- int (*write)(struct ata_port *port, const void *buf, unsigned int block, int num_blocks);
+ int (*read)(struct ata_port *port, void *buf, sector_t block, blkcnt_t num_blocks);
+ int (*write)(struct ata_port *port, const void *buf, sector_t block, blkcnt_t num_blocks);
int (*read_id)(struct ata_port *port, void *buf);
int (*reset)(struct ata_port *port);
};
diff --git a/include/block.h b/include/block.h
index a1de266194..d3a154bf73 100644
--- a/include/block.h
+++ b/include/block.h
@@ -4,12 +4,13 @@
#include <driver.h>
#include <linux/list.h>
+#include <linux/types.h>
struct block_device;
struct block_device_ops {
- int (*read)(struct block_device *, void *buf, int block, int num_blocks);
- int (*write)(struct block_device *, const void *buf, int block, int num_blocks);
+ int (*read)(struct block_device *, void *buf, sector_t block, blkcnt_t num_blocks);
+ int (*write)(struct block_device *, const void *buf, sector_t block, blkcnt_t num_blocks);
int (*flush)(struct block_device *);
};
@@ -20,12 +21,12 @@ struct block_device {
struct list_head list;
struct block_device_ops *ops;
int blockbits;
- int num_blocks;
+ blkcnt_t num_blocks;
int rdbufsize;
int blkmask;
- loff_t discard_start;
- loff_t discard_size;
+ sector_t discard_start;
+ blkcnt_t discard_size;
struct list_head buffered_blocks;
struct list_head idle_blocks;
@@ -40,8 +41,8 @@ extern struct list_head block_device_list;
int blockdevice_register(struct block_device *blk);
int blockdevice_unregister(struct block_device *blk);
-int block_read(struct block_device *blk, void *buf, int block, int num_blocks);
-int block_write(struct block_device *blk, void *buf, int block, int num_blocks);
+int block_read(struct block_device *blk, void *buf, sector_t block, blkcnt_t num_blocks);
+int block_write(struct block_device *blk, void *buf, sector_t block, blkcnt_t num_blocks);
static inline int block_flush(struct block_device *blk)
{
diff --git a/include/linux/types.h b/include/linux/types.h
index fa7684e31e..5716a4c92f 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -166,13 +166,8 @@ typedef __u32 __bitwise __wsum;
*
* blkcnt_t is the type of the inode's block count.
*/
-#ifdef CONFIG_LBDAF
typedef u64 sector_t;
typedef u64 blkcnt_t;
-#else
-typedef unsigned long sector_t;
-typedef unsigned long blkcnt_t;
-#endif
/*
* The type of an index into the pagecache.