Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
Xpl0itU committed Oct 31, 2022
1 parent 004d405 commit db63c44
Show file tree
Hide file tree
Showing 32 changed files with 21,785 additions and 21,767 deletions.
12 changes: 6 additions & 6 deletions src/fatfs/devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ extern "C" {
#endif

/* Definitions of physical drive number for each drive */
#define DEV_SD 0
#define DEV_USB_EXT 1
#define DEV_SD 0
#define DEV_USB_EXT 1

#define DEV_SD_NAME "sd"
#define DEV_SD_NAME "sd"
#define DEV_USB_EXT_NAME "extusb"

#define SD_PATH "/dev/sdcard01"
#define USB_EXT1_PATH "/dev/usb01"
#define USB_EXT2_PATH "/dev/usb02"
#define SD_PATH "/dev/sdcard01"
#define USB_EXT1_PATH "/dev/usb01"
#define USB_EXT2_PATH "/dev/usb02"

extern int deviceFds[FF_VOLUMES];
extern const char *devicePaths[FF_VOLUMES];
Expand Down
230 changes: 106 additions & 124 deletions src/fatfs/diskio.c

Large diffs are not rendered by default.

86 changes: 43 additions & 43 deletions src/fatfs/diskio.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,78 +11,78 @@ extern "C" {

#include <coreinit/filesystem_fsa.h>

#define DEV_SD_REF 0
#define DEV_USB01_REF 1
#define DEV_USB02_REF 2
#define DEV_SD_REF 0
#define DEV_USB01_REF 1
#define DEV_USB02_REF 2

extern bool fatMounted[FF_VOLUMES];
extern const char* VolumeStr[FF_VOLUMES];
extern const char *VolumeStr[FF_VOLUMES];

/* Status of Disk Functions */
typedef BYTE DSTATUS;
typedef BYTE DSTATUS;

/* Results of Disk Functions */
typedef enum {
RES_OK = 0, /* 0: Successful */
RES_ERROR, /* 1: R/W Error */
RES_WRPRT, /* 2: Write Protected */
RES_NOTRDY, /* 3: Not Ready */
RES_PARERR /* 4: Invalid Parameter */
RES_OK = 0, /* 0: Successful */
RES_ERROR, /* 1: R/W Error */
RES_WRPRT, /* 2: Write Protected */
RES_NOTRDY, /* 3: Not Ready */
RES_PARERR /* 4: Invalid Parameter */
} DRESULT;

/*---------------------------------------*/
/* Prototypes for disk control functions */

FSError wiiu_readSectors(BYTE pdrv, LBA_t sectorIdx, UINT sectorCount, BYTE* outputBuff);
FSError wiiu_writeSectors(BYTE pdrv, LBA_t sectorIdx, UINT sectorCount, const BYTE* inputBuff);
FSError wiiu_readSectors(BYTE pdrv, LBA_t sectorIdx, UINT sectorCount, BYTE *outputBuff);
FSError wiiu_writeSectors(BYTE pdrv, LBA_t sectorIdx, UINT sectorCount, const BYTE *inputBuff);


DSTATUS disk_initialize (BYTE pdrv);
DSTATUS disk_shutdown (BYTE pdrv);
DSTATUS disk_status (BYTE pdrv);
DRESULT disk_read (BYTE pdrv, BYTE* buff, LBA_t sector, UINT count);
DRESULT disk_write (BYTE pdrv, const BYTE* buff, LBA_t sector, UINT count);
DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
DSTATUS disk_initialize(BYTE pdrv);
DSTATUS disk_shutdown(BYTE pdrv);
DSTATUS disk_status(BYTE pdrv);
DRESULT disk_read(BYTE pdrv, BYTE *buff, LBA_t sector, UINT count);
DRESULT disk_write(BYTE pdrv, const BYTE *buff, LBA_t sector, UINT count);
DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void *buff);


/* Disk Status Bits (DSTATUS) */

#define STA_NOINIT 0x01 /* Drive not initialized */
#define STA_NODISK 0x02 /* No medium in the drive */
#define STA_PROTECT 0x04 /* Write protected */
#define STA_NOINIT 0x01 /* Drive not initialized */
#define STA_NODISK 0x02 /* No medium in the drive */
#define STA_PROTECT 0x04 /* Write protected */


/* Command code for disk_ioctrl function */

/* Generic command (Used by FatFs) */
#define CTRL_SYNC 0 /* Complete pending write process (needed at FF_FS_READONLY == 0) */
#define GET_SECTOR_COUNT 1 /* Get media size (needed at FF_USE_MKFS == 1) */
#define GET_SECTOR_SIZE 2 /* Get sector size (needed at FF_MAX_SS != FF_MIN_SS) */
#define GET_BLOCK_SIZE 3 /* Get erase block size (needed at FF_USE_MKFS == 1) */
#define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at FF_USE_TRIM == 1) */
#define SET_CACHE_COUNT 69
#define CTRL_FORCE_SYNC 70
#define CTRL_SYNC 0 /* Complete pending write process (needed at FF_FS_READONLY == 0) */
#define GET_SECTOR_COUNT 1 /* Get media size (needed at FF_USE_MKFS == 1) */
#define GET_SECTOR_SIZE 2 /* Get sector size (needed at FF_MAX_SS != FF_MIN_SS) */
#define GET_BLOCK_SIZE 3 /* Get erase block size (needed at FF_USE_MKFS == 1) */
#define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at FF_USE_TRIM == 1) */
#define SET_CACHE_COUNT 69
#define CTRL_FORCE_SYNC 70

/* Generic command (Not used by FatFs) */
#define CTRL_POWER 5 /* Get/Set power status */
#define CTRL_LOCK 6 /* Lock/Unlock media removal */
#define CTRL_EJECT 7 /* Eject media */
#define CTRL_FORMAT 8 /* Create physical format on the media */
#define CTRL_POWER 5 /* Get/Set power status */
#define CTRL_LOCK 6 /* Lock/Unlock media removal */
#define CTRL_EJECT 7 /* Eject media */
#define CTRL_FORMAT 8 /* Create physical format on the media */

/* MMC/SDC specific ioctl command */
#define MMC_GET_TYPE 10 /* Get card type */
#define MMC_GET_CSD 11 /* Get CSD */
#define MMC_GET_CID 12 /* Get CID */
#define MMC_GET_OCR 13 /* Get OCR */
#define MMC_GET_SDSTAT 14 /* Get SD status */
#define ISDIO_READ 55 /* Read data form SD iSDIO register */
#define ISDIO_WRITE 56 /* Write data to SD iSDIO register */
#define ISDIO_MRITE 57 /* Masked write data to SD iSDIO register */
#define MMC_GET_TYPE 10 /* Get card type */
#define MMC_GET_CSD 11 /* Get CSD */
#define MMC_GET_CID 12 /* Get CID */
#define MMC_GET_OCR 13 /* Get OCR */
#define MMC_GET_SDSTAT 14 /* Get SD status */
#define ISDIO_READ 55 /* Read data form SD iSDIO register */
#define ISDIO_WRITE 56 /* Write data to SD iSDIO register */
#define ISDIO_MRITE 57 /* Masked write data to SD iSDIO register */

/* ATA/CF specific ioctl command */
#define ATA_GET_REV 20 /* Get F/W revision */
#define ATA_GET_MODEL 21 /* Get model name */
#define ATA_GET_SN 22 /* Get serial number */
#define ATA_GET_REV 20 /* Get F/W revision */
#define ATA_GET_MODEL 21 /* Get model name */
#define ATA_GET_SN 22 /* Get serial number */

#ifdef __cplusplus
}
Expand Down
64 changes: 32 additions & 32 deletions src/fatfs/extusb_devoptab/extusb_devoptab.c
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
#include <sys/iosupport.h>
#include "extusb_devoptab.h"
#include "../devices.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/iosupport.h>
#include <whb/log.h>
#include <whb/log_console.h>
#include "../devices.h"
#include "extusb_devoptab.h"

#ifdef __cplusplus
extern "C" {
#endif

static devoptab_t
extusb_fs_devoptab =
{
.name = "sd",
.structSize = sizeof(__extusb_fs_file_t),
.open_r = __extusb_fs_open,
.close_r = __extusb_fs_close,
.write_r = __extusb_fs_write,
.read_r = __extusb_fs_read,
.seek_r = __extusb_fs_seek,
.fstat_r = __extusb_fs_fstat,
.stat_r = __extusb_fs_stat,
.link_r = __extusb_fs_link,
.unlink_r = __extusb_fs_unlink,
.chdir_r = __extusb_fs_chdir,
.rename_r = __extusb_fs_rename,
.mkdir_r = __extusb_fs_mkdir,
.dirStateSize = sizeof(__extusb_fs_dir_t),
.diropen_r = __extusb_fs_diropen,
.dirreset_r = __extusb_fs_dirreset,
.dirnext_r = __extusb_fs_dirnext,
.dirclose_r = __extusb_fs_dirclose,
.statvfs_r = __extusb_fs_statvfs,
.ftruncate_r = __extusb_fs_ftruncate,
.fsync_r = __extusb_fs_fsync,
.deviceData = NULL,
.chmod_r = __extusb_fs_chmod,
.fchmod_r = __extusb_fs_fchmod,
.rmdir_r = __extusb_fs_rmdir,
};
{
.name = "sd",
.structSize = sizeof(__extusb_fs_file_t),
.open_r = __extusb_fs_open,
.close_r = __extusb_fs_close,
.write_r = __extusb_fs_write,
.read_r = __extusb_fs_read,
.seek_r = __extusb_fs_seek,
.fstat_r = __extusb_fs_fstat,
.stat_r = __extusb_fs_stat,
.link_r = __extusb_fs_link,
.unlink_r = __extusb_fs_unlink,
.chdir_r = __extusb_fs_chdir,
.rename_r = __extusb_fs_rename,
.mkdir_r = __extusb_fs_mkdir,
.dirStateSize = sizeof(__extusb_fs_dir_t),
.diropen_r = __extusb_fs_diropen,
.dirreset_r = __extusb_fs_dirreset,
.dirnext_r = __extusb_fs_dirnext,
.dirclose_r = __extusb_fs_dirclose,
.statvfs_r = __extusb_fs_statvfs,
.ftruncate_r = __extusb_fs_ftruncate,
.fsync_r = __extusb_fs_fsync,
.deviceData = NULL,
.chmod_r = __extusb_fs_chmod,
.fchmod_r = __extusb_fs_fchmod,
.rmdir_r = __extusb_fs_rmdir,
};

static BOOL extusb_fs_initialised = false;

Expand Down
4 changes: 2 additions & 2 deletions src/fatfs/extusb_devoptab/extusb_devoptab.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

#include <coreinit/filesystem.h>

#include "../ff.h"
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <sys/iosupport.h>
#include <sys/param.h>
#include <unistd.h>
#include "../ff.h"

#ifdef __cplusplus
extern "C" {
Expand Down
5 changes: 2 additions & 3 deletions src/fatfs/extusb_devoptab/extusb_fs_chdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
extern "C" {
#endif

int
__extusb_fs_chdir(struct _reent *r,
const char *path) {
int __extusb_fs_chdir(struct _reent *r,
const char *path) {
if (!path) {
r->_errno = EINVAL;
return -1;
Expand Down
9 changes: 4 additions & 5 deletions src/fatfs/extusb_devoptab/extusb_fs_chmod.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#include <sys/stat.h>
#include "extusb_devoptab.h"
#include <sys/stat.h>

#ifdef __cplusplus
extern "C" {
#endif

int
__extusb_fs_chmod(struct _reent *r,
const char *path,
mode_t mode) {
int __extusb_fs_chmod(struct _reent *r,
const char *path,
mode_t mode) {
if (!path) {
r->_errno = EINVAL;
return -1;
Expand Down
5 changes: 2 additions & 3 deletions src/fatfs/extusb_devoptab/extusb_fs_dirclose.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
extern "C" {
#endif

int
__extusb_fs_dirclose(struct _reent *r,
DIR_ITER *dirState) {
int __extusb_fs_dirclose(struct _reent *r,
DIR_ITER *dirState) {

if (!dirState) {
r->_errno = EINVAL;
Expand Down
9 changes: 4 additions & 5 deletions src/fatfs/extusb_devoptab/extusb_fs_dirnext.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
extern "C" {
#endif

int
__extusb_fs_dirnext(struct _reent *r,
DIR_ITER *dirState,
char *filename,
struct stat *filestat) {
int __extusb_fs_dirnext(struct _reent *r,
DIR_ITER *dirState,
char *filename,
struct stat *filestat) {
if (!dirState || !filename || !filestat) {
r->_errno = EINVAL;
return -1;
Expand Down
5 changes: 2 additions & 3 deletions src/fatfs/extusb_devoptab/extusb_fs_dirreset.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
extern "C" {
#endif

int
__extusb_fs_dirreset(struct _reent *r,
DIR_ITER *dirState) {
int __extusb_fs_dirreset(struct _reent *r,
DIR_ITER *dirState) {
if (!dirState) {
r->_errno = EINVAL;
return -1;
Expand Down
7 changes: 3 additions & 4 deletions src/fatfs/extusb_devoptab/extusb_fs_fchmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
extern "C" {
#endif

int
__extusb_fs_fchmod(struct _reent *r,
void *fd,
mode_t mode) {
int __extusb_fs_fchmod(struct _reent *r,
void *fd,
mode_t mode) {
if (!fd) {
r->_errno = EINVAL;
return -1;
Expand Down
7 changes: 3 additions & 4 deletions src/fatfs/extusb_devoptab/extusb_fs_fstat.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
extern "C" {
#endif

int
__extusb_fs_fstat(struct _reent *r,
void *fd,
struct stat *st) {
int __extusb_fs_fstat(struct _reent *r,
void *fd,
struct stat *st) {
if (!fd || !st) {
r->_errno = EINVAL;
return -1;
Expand Down
5 changes: 2 additions & 3 deletions src/fatfs/extusb_devoptab/extusb_fs_fsync.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
extern "C" {
#endif

int
__extusb_fs_fsync(struct _reent *r,
void *fd) {
int __extusb_fs_fsync(struct _reent *r,
void *fd) {
if (!fd) {
r->_errno = EINVAL;
return -1;
Expand Down
7 changes: 3 additions & 4 deletions src/fatfs/extusb_devoptab/extusb_fs_link.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
extern "C" {
#endif

int
__extusb_fs_link(struct _reent *r,
const char *existing,
const char *newLink) {
int __extusb_fs_link(struct _reent *r,
const char *existing,
const char *newLink) {
r->_errno = ENOSYS;
return -1;
}
Expand Down
7 changes: 3 additions & 4 deletions src/fatfs/extusb_devoptab/extusb_fs_mkdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
extern "C" {
#endif

int
__extusb_fs_mkdir(struct _reent *r,
const char *path,
int mode) {
int __extusb_fs_mkdir(struct _reent *r,
const char *path,
int mode) {
char *fixedPath;

if (!path) {
Expand Down
7 changes: 3 additions & 4 deletions src/fatfs/extusb_devoptab/extusb_fs_rename.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
extern "C" {
#endif

int
__extusb_fs_rename(struct _reent *r,
const char *oldName,
const char *newName) {
int __extusb_fs_rename(struct _reent *r,
const char *oldName,
const char *newName) {
char *fixedOldPath, *fixedNewPath;

if (!oldName || !newName) {
Expand Down
Loading

0 comments on commit db63c44

Please sign in to comment.