diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mtd/mtd-abi.h | 12 | ||||
-rw-r--r-- | include/linux/mtd/mtd.h | 11 |
2 files changed, 20 insertions, 3 deletions
diff --git a/include/linux/mtd/mtd-abi.h b/include/linux/mtd/mtd-abi.h index 11d51e2744..c1ba55bd2d 100644 --- a/include/linux/mtd/mtd-abi.h +++ b/include/linux/mtd/mtd-abi.h @@ -9,6 +9,8 @@ #ifndef DOXYGEN_SHOULD_SKIP_THIS +#include <asm-generic/div64.h> + struct erase_info_user { uint32_t start; uint32_t length; @@ -73,7 +75,7 @@ enum { struct mtd_info_user { uint8_t type; uint32_t flags; - uint32_t size; // Total size of the MTD + uint64_t size; /* Total size of the MTD */ uint32_t erasesize; uint32_t writesize; uint32_t oobsize; // Amount of OOB data per block (e.g. 16) @@ -173,6 +175,14 @@ enum mtd_file_modes { MTD_MODE_RAW, }; + +static inline uint32_t mtd_user_div_by_eb(uint64_t sz, + struct mtd_info_user *mtd_user) +{ + do_div(sz, mtd_user->erasesize); + return sz; +} + #endif /* DOXYGEN_SHOULD_SKIP_THIS */ #endif /* __MTD_ABI_H__ */ diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index e02204a503..970cdb02fa 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -86,7 +86,7 @@ struct mtd_oob_ops { struct mtd_info { u_char type; u_int32_t flags; - u_int32_t size; // Total size of the MTD + u_int64_t size; /* Total size of the MTD */ /* "Major" erase size for the device. Naïve users may take this * to be the only erase size available, or may use the more detailed @@ -219,7 +219,7 @@ struct mtd_info { int p_allow_erasebad; struct mtd_info *master; - uint32_t master_offset; + loff_t master_offset; }; int mtd_erase(struct mtd_info *mtd, struct erase_info *instr); @@ -256,6 +256,13 @@ static inline uint32_t mtd_mod_by_eb(uint64_t sz, struct mtd_info *mtd) { return do_div(sz, mtd->erasesize); } + +static inline uint32_t mtd_div_by_wb(uint64_t sz, struct mtd_info *mtd) +{ + do_div(sz, mtd->writesize); + return sz; +} + /* Kernel-side ioctl definitions */ extern int add_mtd_device(struct mtd_info *mtd, char *devname, int device_id); |