From 7ad1d777868e63be9b3bcdad8fc41556356426b8 Mon Sep 17 00:00:00 2001 From: Michel Rottleuthner Date: Tue, 23 Jan 2018 19:32:09 +0100 Subject: [PATCH] pkg/fatfs: align to interface changes of FatFs R0.13a --- pkg/fatfs/fatfs_diskio/mtd/mtd_diskio.c | 22 +++++++++++----------- pkg/fatfs/fatfs_vfs/fatfs_vfs.c | 2 +- tests/pkg_fatfs/main.c | 4 ++-- tests/pkg_fatfs_vfs/main.c | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/pkg/fatfs/fatfs_diskio/mtd/mtd_diskio.c b/pkg/fatfs/fatfs_diskio/mtd/mtd_diskio.c index bf985a2521..5e07239754 100644 --- a/pkg/fatfs/fatfs_diskio/mtd/mtd_diskio.c +++ b/pkg/fatfs/fatfs_diskio/mtd/mtd_diskio.c @@ -31,7 +31,7 @@ #endif /* mtd devices for use by FatFs should be provided by the application */ -extern mtd_dev_t *fatfs_mtd_devs[_VOLUMES]; +extern mtd_dev_t *fatfs_mtd_devs[FF_VOLUMES]; /** * @brief returns the status of the disk @@ -45,7 +45,7 @@ extern mtd_dev_t *fatfs_mtd_devs[_VOLUMES]; DSTATUS disk_status(BYTE pdrv) { DEBUG("disk_status %d\n", pdrv); - if (pdrv >= _VOLUMES) { + if (pdrv >= FF_VOLUMES) { return STA_NODISK; } else if (fatfs_mtd_devs[pdrv]->driver == NULL){ return STA_NOINIT; @@ -66,7 +66,7 @@ DSTATUS disk_status(BYTE pdrv) DSTATUS disk_initialize(BYTE pdrv) { DEBUG("disk_initialize %d\n", pdrv); - if (pdrv >= _VOLUMES) { + if (pdrv >= FF_VOLUMES) { return STA_NODISK; } else if (fatfs_mtd_devs[pdrv]->driver == NULL){ return STA_NOINIT; @@ -91,7 +91,7 @@ DSTATUS disk_initialize(BYTE pdrv) DRESULT disk_read(BYTE pdrv, BYTE *buff, DWORD sector, UINT count) { DEBUG("disk_read: %d, %lu, %d\n", pdrv, sector, count); - if ((pdrv >= _VOLUMES) || (fatfs_mtd_devs[pdrv]->driver == NULL)) { + if ((pdrv >= FF_VOLUMES) || (fatfs_mtd_devs[pdrv]->driver == NULL)) { return RES_PARERR; } @@ -122,7 +122,7 @@ DRESULT disk_read(BYTE pdrv, BYTE *buff, DWORD sector, UINT count) DRESULT disk_write(BYTE pdrv, const BYTE *buff, DWORD sector, UINT count) { DEBUG("disk_write: %d, %lu, %d\n", pdrv, sector, count); - if ((pdrv >= _VOLUMES) || (fatfs_mtd_devs[pdrv]->driver == NULL)) { + if ((pdrv >= FF_VOLUMES) || (fatfs_mtd_devs[pdrv]->driver == NULL)) { return RES_PARERR; } @@ -150,7 +150,7 @@ DRESULT disk_write(BYTE pdrv, const BYTE *buff, DWORD sector, UINT count) /** * @brief perform miscellaneous low-level control functions * - * @param[in] pdrv Physical drive nmuber (0.._VOLUMES-1) + * @param[in] pdrv Physical drive nmuber (0..FF_VOLUMES-1) * @param[in out] cmd Control code * @param[in] sector Buffer to send/receive control data * @@ -160,18 +160,18 @@ DRESULT disk_write(BYTE pdrv, const BYTE *buff, DWORD sector, UINT count) */ DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void *buff) { - if ((pdrv >= _VOLUMES) || (fatfs_mtd_devs[pdrv]->driver == NULL)) { + if ((pdrv >= FF_VOLUMES) || (fatfs_mtd_devs[pdrv]->driver == NULL)) { return RES_PARERR; } switch (cmd) { -#if (_FS_READONLY == 0) +#if (FF_FS_READONLY == 0) case CTRL_SYNC: /* r/w is always finished within r/w-functions of mtd */ return RES_OK; #endif -#if (_USE_MKFS == 1) +#if (FF_USE_MKFS == 1) case GET_SECTOR_COUNT: *(DWORD *)buff = fatfs_mtd_devs[pdrv]->sector_count; return RES_OK; @@ -183,13 +183,13 @@ DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void *buff) return RES_OK; #endif -#if (_MAX_SS != _MIN_SS) +#if (FF_MAX_SS != FF_MIN_SS) case GET_SECTOR_SIZE: *(DWORD *)buff = fatfs_mtd_devs[pdrv]->page_size; return RES_OK; #endif -#if (_USE_TRIM == 1) +#if (FF_USE_TRIM == 1) case CTRL_TRIM: return RES_OK; #endif diff --git a/pkg/fatfs/fatfs_vfs/fatfs_vfs.c b/pkg/fatfs/fatfs_vfs/fatfs_vfs.c index da304e401a..4f49d3c43f 100644 --- a/pkg/fatfs/fatfs_vfs/fatfs_vfs.c +++ b/pkg/fatfs/fatfs_vfs/fatfs_vfs.c @@ -73,7 +73,7 @@ static int _umount(vfs_mount_t *mountp) snprintf(volume_str, sizeof(volume_str), "%d:/", fs_desc->vol_idx); DEBUG("unmounting file system of volume '%s'\n", volume_str); - FRESULT res = f_mount(NULL, volume_str, 1); + FRESULT res = f_unmount(volume_str); if (res == FR_OK) { DEBUG("[OK]"); diff --git a/tests/pkg_fatfs/main.c b/tests/pkg_fatfs/main.c index 8637ae7943..1e62711392 100644 --- a/tests/pkg_fatfs/main.c +++ b/tests/pkg_fatfs/main.c @@ -106,7 +106,7 @@ static int _mount(int argc, char **argv) } else { - #if _MAX_SS == _MIN_SS + #if FF_MAX_SS == FF_MIN_SS uint16_t sector_size = TEST_FATFS_FIXED_SECTOR_SIZE; #else uint16_t sector_size = fs->ssize; @@ -349,7 +349,7 @@ static int _mkfs(int argc, char **argv) char volume_str[TEST_FATFS_MAX_VOL_STR_LEN]; sprintf(volume_str, "%d:/", vol_idx); - BYTE work[_MAX_SS]; + BYTE work[FF_MAX_SS]; puts("formatting media..."); diff --git a/tests/pkg_fatfs_vfs/main.c b/tests/pkg_fatfs_vfs/main.c index 5065bb7bef..0db6de3c94 100644 --- a/tests/pkg_fatfs_vfs/main.c +++ b/tests/pkg_fatfs_vfs/main.c @@ -62,7 +62,7 @@ static vfs_mount_t _test_vfs_mount = { }; /* provide mtd devices for use within diskio layer of fatfs */ -mtd_dev_t *fatfs_mtd_devs[_VOLUMES]; +mtd_dev_t *fatfs_mtd_devs[FF_VOLUMES]; #ifdef MODULE_MTD_NATIVE /* mtd device for native is provided in boards/native/board_init.c */