summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-02-08 14:23:12 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-02-09 09:32:29 +0100
commit81737c1d436add87e26a22dca9dd750b9655de01 (patch)
treefc85417cd52a3967c970a57ab95352d33baae6e8 /include
parente0ae56c00864b0c1dc77b34d26c4e59096ad5403 (diff)
downloadbarebox-81737c1d436add87e26a22dca9dd750b9655de01.tar.gz
barebox-81737c1d436add87e26a22dca9dd750b9655de01.tar.xz
mtd: Fix erasing of devices >4GiB
When a device >4GiB is erased, not only the offset can be bigger than 4GiB, but also the size. This happens with the simplest command to erase a device: erase /dev/nand0. Make the size argument a 64bit type to make this work. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/driver.h4
-rw-r--r--include/fs.h4
2 files changed, 4 insertions, 4 deletions
diff --git a/include/driver.h b/include/driver.h
index 31c673452f..ce8c966734 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -425,7 +425,7 @@ struct file_operations {
int (*open)(struct cdev*, unsigned long flags);
int (*close)(struct cdev*);
int (*flush)(struct cdev*);
- int (*erase)(struct cdev*, size_t count, loff_t offset);
+ int (*erase)(struct cdev*, loff_t count, loff_t offset);
int (*protect)(struct cdev*, size_t count, loff_t offset, int prot);
int (*memmap)(struct cdev*, void **map, int flags);
};
@@ -470,7 +470,7 @@ int cdev_flush(struct cdev *cdev);
ssize_t cdev_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags);
ssize_t cdev_write(struct cdev *cdev, const void *buf, size_t count, loff_t offset, ulong flags);
int cdev_ioctl(struct cdev *cdev, int cmd, void *buf);
-int cdev_erase(struct cdev *cdev, size_t count, loff_t offset);
+int cdev_erase(struct cdev *cdev, loff_t count, loff_t offset);
#define DEVFS_PARTITION_FIXED (1U << 0)
#define DEVFS_PARTITION_READONLY (1U << 1)
diff --git a/include/fs.h b/include/fs.h
index 23156eadae..9f4164ed77 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -70,7 +70,7 @@ struct fs_driver_d {
int (*stat)(struct device_d *dev, const char *file, struct stat *stat);
int (*ioctl)(struct device_d *dev, FILE *f, int request, void *buf);
- int (*erase)(struct device_d *dev, FILE *f, size_t count,
+ int (*erase)(struct device_d *dev, FILE *f, loff_t count,
loff_t offset);
int (*protect)(struct device_d *dev, FILE *f, size_t count,
loff_t offset, int prot);
@@ -145,7 +145,7 @@ int mount (const char *device, const char *fsname, const char *path,
int umount(const char *pathname);
/* not-so-standard functions */
-int erase(int fd, size_t count, loff_t offset);
+int erase(int fd, loff_t count, loff_t offset);
int protect(int fd, size_t count, loff_t offset, int prot);
int protect_file(const char *file, int prot);
void *memmap(int fd, int flags);