Skip to content

Commit

Permalink
fatfs: Use correct LBA_t/FSIZE_t types in our interfaces to FatFS
Browse files Browse the repository at this point in the history
  • Loading branch information
keirf committed Oct 25, 2020
1 parent b0c0d0b commit 6fe58c5
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion inc/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void F_close(FIL *fp);
void F_read(FIL *fp, void *buff, UINT btr, UINT *br);
void F_write(FIL *fp, const void *buff, UINT btw, UINT *bw);
void F_sync(FIL *fp);
void F_lseek(FIL *fp, DWORD ofs);
void F_lseek(FIL *fp, FSIZE_t ofs);
void F_truncate(FIL *fp);
void F_opendir(DIR *dp, const TCHAR *path);
void F_closedir(DIR *dp);
Expand Down
4 changes: 2 additions & 2 deletions inc/volume.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
struct volume_ops {
DSTATUS (*initialize)(BYTE);
DSTATUS (*status)(BYTE);
DRESULT (*read)(BYTE, BYTE *, DWORD, UINT);
DRESULT (*write)(BYTE, const BYTE *, DWORD, UINT);
DRESULT (*read)(BYTE, BYTE *, LBA_t, UINT);
DRESULT (*write)(BYTE, const BYTE *, LBA_t, UINT);
DRESULT (*ioctl)(BYTE, BYTE, void *);
bool_t (*connected)(void);
bool_t (*readonly)(void);
Expand Down
2 changes: 1 addition & 1 deletion src/fatfs/ff.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ typedef struct {
FSIZE_t fsize; /* File size */
WORD fdate; /* Modified date */
WORD ftime; /* Modified time */
DWORD dir_sect; /* Sector number containing the directory entry (not used at exFAT) */
LBA_t dir_sect; /* Sector number containing the directory entry (not used at exFAT) */
BYTE* dir_ptr; /* Pointer to the directory entry in the win[] (not used at exFAT) */
BYTE fattrib; /* File attribute */
#if FF_USE_LFN
Expand Down
2 changes: 1 addition & 1 deletion src/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void F_truncate(FIL *fp)

#endif /* !FF_FS_READONLY */

void F_lseek(FIL *fp, DWORD ofs)
void F_lseek(FIL *fp, LBA_t ofs)
{
FRESULT fr;
#if !FF_FS_READONLY
Expand Down
2 changes: 0 additions & 2 deletions src/image/da.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
* See the file COPYING for more details, or visit <http://unlicense.org>.
*/

#include "../fatfs/diskio.h"

#define DA_SIG "HxCFEDA"

#define SEC_SZ 512
Expand Down
6 changes: 2 additions & 4 deletions src/sd_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
* See the file COPYING for more details, or visit <http://unlicense.org>.
*/

#include "fatfs/diskio.h"

#if 1
/* We can now switch to Default Speed (25MHz). Closest we can get is 36Mhz/2 =
* 18MHz. */
Expand Down Expand Up @@ -413,7 +411,7 @@ static DRESULT handle_sd_result(DRESULT res)
return res;
}

static DRESULT sd_disk_read(BYTE pdrv, BYTE *buff, DWORD sector, UINT count)
static DRESULT sd_disk_read(BYTE pdrv, BYTE *buff, LBA_t sector, UINT count)
{
uint8_t retry = 0;
UINT todo;
Expand Down Expand Up @@ -450,7 +448,7 @@ static DRESULT sd_disk_read(BYTE pdrv, BYTE *buff, DWORD sector, UINT count)
}

static DRESULT sd_disk_write(
BYTE pdrv, const BYTE *buff, DWORD sector, UINT count)
BYTE pdrv, const BYTE *buff, LBA_t sector, UINT count)
{
uint8_t retry = 0;
UINT todo;
Expand Down
4 changes: 2 additions & 2 deletions src/usb/usbh_msc_fatfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ static DRESULT handle_usb_status(BYTE status)
return RES_OK;
}

static DRESULT usb_disk_read(BYTE pdrv, BYTE *buff, DWORD sector, UINT count)
static DRESULT usb_disk_read(BYTE pdrv, BYTE *buff, LBA_t sector, UINT count)
{
BYTE status;

Expand All @@ -240,7 +240,7 @@ static DRESULT usb_disk_read(BYTE pdrv, BYTE *buff, DWORD sector, UINT count)
}

static DRESULT usb_disk_write(
BYTE pdrv, const BYTE *buff, DWORD sector, UINT count)
BYTE pdrv, const BYTE *buff, LBA_t sector, UINT count)
{
BYTE status;

Expand Down
4 changes: 2 additions & 2 deletions src/volume.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ DSTATUS disk_status(BYTE pdrv)
return vol_ops->status(pdrv);
}

DRESULT disk_read(BYTE pdrv, BYTE *buff, DWORD sector, UINT count)
DRESULT disk_read(BYTE pdrv, BYTE *buff, LBA_t sector, UINT count)
{
DRESULT res;
const void *p;
Expand All @@ -89,7 +89,7 @@ DRESULT disk_read(BYTE pdrv, BYTE *buff, DWORD sector, UINT count)
return res;
}

DRESULT disk_write(BYTE pdrv, const BYTE *buff, DWORD sector, UINT count)
DRESULT disk_write(BYTE pdrv, const BYTE *buff, LBA_t sector, UINT count)
{
DRESULT res = vol_ops->write(pdrv, buff, sector, count);
struct cache *c;
Expand Down

0 comments on commit 6fe58c5

Please sign in to comment.