make cdev 64bit capable
Next step to 64bit support: Make cdev size a 64bit type. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
849ce2df7a
commit
be573120fe
|
@ -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;
|
||||
|
||||
|
|
|
@ -339,7 +339,7 @@ static int do_devinfo_subtree(struct device_d *dev, int depth)
|
|||
list_for_each_entry(cdev, &dev->cdevs, devices_list) {
|
||||
for (i = 0; i < depth + 1; i++)
|
||||
printf(" ");
|
||||
printf("`---- 0x%08lx-0x%08lx: /dev/%s\n",
|
||||
printf("`---- 0x%08llx-0x%08llx: /dev/%s\n",
|
||||
cdev->offset,
|
||||
cdev->offset + cdev->size - 1,
|
||||
cdev->name);
|
||||
|
|
|
@ -96,7 +96,7 @@ void cdev_close(struct cdev *cdev)
|
|||
cdev->ops->close(cdev);
|
||||
}
|
||||
|
||||
ssize_t cdev_read(struct cdev *cdev, void *buf, size_t count, ulong offset, ulong flags)
|
||||
ssize_t cdev_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags)
|
||||
{
|
||||
if (!cdev->ops->read)
|
||||
return -ENOSYS;
|
||||
|
@ -104,7 +104,7 @@ ssize_t cdev_read(struct cdev *cdev, void *buf, size_t count, ulong offset, ulon
|
|||
return cdev->ops->read(cdev, buf, count, cdev->offset +offset, flags);
|
||||
}
|
||||
|
||||
ssize_t cdev_write(struct cdev *cdev, const void *buf, size_t count, ulong offset, ulong flags)
|
||||
ssize_t cdev_write(struct cdev *cdev, const void *buf, size_t count, loff_t offset, ulong flags)
|
||||
{
|
||||
if (!cdev->ops->write)
|
||||
return -ENOSYS;
|
||||
|
@ -165,10 +165,11 @@ static int partition_ioctl(struct cdev *cdev, int request, void *buf)
|
|||
case MEMGETREGIONINFO:
|
||||
if (cdev->mtd) {
|
||||
struct region_info_user *reg = buf;
|
||||
int erasesize_shift = ffs(cdev->mtd->erasesize) - 1;
|
||||
|
||||
reg->offset = cdev->offset;
|
||||
reg->erasesize = cdev->mtd->erasesize;
|
||||
reg->numblocks = cdev->size/reg->erasesize;
|
||||
reg->numblocks = cdev->size >> erasesize_shift;
|
||||
reg->regionindex = cdev->mtd->index;
|
||||
}
|
||||
break;
|
||||
|
@ -191,7 +192,7 @@ int cdev_ioctl(struct cdev *cdev, int request, void *buf)
|
|||
return cdev->ops->ioctl(cdev, request, buf);
|
||||
}
|
||||
|
||||
int cdev_erase(struct cdev *cdev, size_t count, unsigned long offset)
|
||||
int cdev_erase(struct cdev *cdev, size_t count, loff_t offset)
|
||||
{
|
||||
if (!cdev->ops->erase)
|
||||
return -ENOSYS;
|
||||
|
|
|
@ -55,7 +55,7 @@ static int devfs_write(struct device_d *_dev, FILE *f, const void *buf, size_t s
|
|||
static loff_t devfs_lseek(struct device_d *_dev, FILE *f, loff_t pos)
|
||||
{
|
||||
struct cdev *cdev = f->inode;
|
||||
off_t ret = -1;
|
||||
loff_t ret = -1;
|
||||
|
||||
if (cdev->ops->lseek)
|
||||
ret = cdev->ops->lseek(cdev, pos + cdev->offset);
|
||||
|
@ -100,7 +100,7 @@ static int devfs_memmap(struct device_d *_dev, FILE *f, void **map, int flags)
|
|||
ret = cdev->ops->memmap(cdev, map, flags);
|
||||
|
||||
if (!ret)
|
||||
*map = (void *)((unsigned long)*map + cdev->offset);
|
||||
*map = (void *)((unsigned long)*map + (unsigned long)cdev->offset);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
2
fs/fs.c
2
fs/fs.c
|
@ -697,7 +697,7 @@ loff_t lseek(int fildes, loff_t offset, int whence)
|
|||
struct device_d *dev;
|
||||
struct fs_driver_d *fsdrv;
|
||||
FILE *f = &files[fildes];
|
||||
off_t pos;
|
||||
loff_t pos;
|
||||
int ret;
|
||||
|
||||
if (check_fd(fildes))
|
||||
|
|
|
@ -395,8 +395,8 @@ struct cdev {
|
|||
struct list_head list;
|
||||
struct list_head devices_list;
|
||||
char *name;
|
||||
unsigned long offset;
|
||||
size_t size;
|
||||
loff_t offset;
|
||||
loff_t size;
|
||||
unsigned int flags;
|
||||
int open;
|
||||
struct mtd_info *mtd;
|
||||
|
@ -409,10 +409,10 @@ struct cdev *cdev_by_name(const char *filename);
|
|||
struct cdev *cdev_open(const char *name, unsigned long flags);
|
||||
void cdev_close(struct cdev *cdev);
|
||||
int cdev_flush(struct cdev *cdev);
|
||||
ssize_t cdev_read(struct cdev *cdev, void *buf, size_t count, ulong offset, ulong flags);
|
||||
ssize_t cdev_write(struct cdev *cdev, const void *buf, size_t count, ulong offset, ulong flags);
|
||||
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, unsigned long offset);
|
||||
int cdev_erase(struct cdev *cdev, size_t count, loff_t offset);
|
||||
|
||||
#define DEVFS_PARTITION_FIXED (1 << 0)
|
||||
#define DEVFS_PARTITION_READONLY (1 << 1)
|
||||
|
|
Loading…
Reference in New Issue