From cff16051bb1183126df24eb67f81e3eaefbd5f50 Mon Sep 17 00:00:00 2001 From: Michael Hope Date: Sun, 31 Dec 2017 18:15:16 +0100 Subject: [PATCH] disk: delete the GET_DISK_SIZE IOCTL. The argument is a u32_t which limits the maximum disk size to 4 GiB. Rather than fix this, delete the ioctl and switch the only use to GET_SECTOR_COUNT instead. Signed-off-by: Michael Hope --- ext/fs/fat/zfs_diskio.c | 7 ++----- include/disk_access.h | 4 ++-- subsys/disk/disk_access_flash.c | 3 --- subsys/disk/disk_access_ram.c | 3 --- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/ext/fs/fat/zfs_diskio.c b/ext/fs/fat/zfs_diskio.c index 654fd586f44..2bd7c5f18aa 100644 --- a/ext/fs/fat/zfs_diskio.c +++ b/ext/fs/fat/zfs_diskio.c @@ -88,7 +88,6 @@ DRESULT disk_write(BYTE pdrv, const BYTE *buff, DWORD sector, UINT count) DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void *buff) { int ret = RES_OK; - uint32_t tmp = 0; switch (cmd) { case CTRL_SYNC: @@ -98,11 +97,9 @@ DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void *buff) break; case GET_SECTOR_COUNT: - if (disk_access_ioctl(DISK_IOCTL_GET_DISK_SIZE, &tmp) != 0) { + if (disk_access_ioctl(DISK_IOCTL_GET_SECTOR_COUNT, buff) != 0) { ret = RES_ERROR; - } else { - *(uint32_t *) buff = (tmp / _MIN_SS) ; - } + } break; case GET_BLOCK_SIZE: diff --git a/include/disk_access.h b/include/disk_access.h index c4fc139dcc1..f62342f5c91 100644 --- a/include/disk_access.h +++ b/include/disk_access.h @@ -29,13 +29,13 @@ extern "C" { #define DISK_IOCTL_GET_SECTOR_COUNT 1 /* Get the size of a disk SECTOR in bytes */ #define DISK_IOCTL_GET_SECTOR_SIZE 2 -/* Get the size of the disk in bytes */ -#define DISK_IOCTL_GET_DISK_SIZE 3 /* How many sectors constitute a FLASH Erase block */ #define DISK_IOCTL_GET_ERASE_BLOCK_SZ 4 /* Commit any cached read/writes to disk */ #define DISK_IOCTL_CTRL_SYNC 5 +/* 3 is reserved. It used to be DISK_IOCTL_GET_DISK_SIZE */ + /* Possible return bitmasks for disk_status() */ #define DISK_STATUS_OK 0x00 #define DISK_STATUS_UNINIT 0x01 diff --git a/subsys/disk/disk_access_flash.c b/subsys/disk/disk_access_flash.c index 9b9d0ac0bc4..26dc1131d30 100644 --- a/subsys/disk/disk_access_flash.c +++ b/subsys/disk/disk_access_flash.c @@ -268,9 +268,6 @@ int disk_access_ioctl(u8_t cmd, void *buff) case DISK_IOCTL_GET_ERASE_BLOCK_SZ: /* in sectors */ *(u32_t *)buff = CONFIG_DISK_ERASE_BLOCK_SIZE / SECTOR_SIZE; return 0; - case DISK_IOCTL_GET_DISK_SIZE: - *(u32_t *)buff = CONFIG_DISK_VOLUME_SIZE; - return 0; default: break; } diff --git a/subsys/disk/disk_access_ram.c b/subsys/disk/disk_access_ram.c index 6bdaef7fcde..4a116dfd836 100644 --- a/subsys/disk/disk_access_ram.c +++ b/subsys/disk/disk_access_ram.c @@ -71,9 +71,6 @@ int disk_access_ioctl(u8_t cmd, void *buff) case DISK_IOCTL_GET_ERASE_BLOCK_SZ: *(u32_t *)buff = 1; break; - case DISK_IOCTL_GET_DISK_SIZE: - *(u32_t *)buff = RAMDISK_VOLUME_SIZE; - break; default: return -EINVAL; }