Skip to content

Commit 86a6544

Browse files
Fix C-style comments in fatfs_example.c
Co-Authored-By: andrew@wolfssl.com <andrew@wolfssl.com>
1 parent d8e94e5 commit 86a6544

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

ide/Linux-FATFS/fatfs_example.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,33 @@
99

1010
static FILE *storage_file = NULL;
1111

12-
// Initialize the storage file
12+
/* Initialize the storage file */
1313
DSTATUS disk_initialize(BYTE pdrv) {
14-
if (pdrv != 0) return STA_NOINIT; // Only support one drive (0)
14+
if (pdrv != 0) return STA_NOINIT; /* Only support one drive (0) */
1515

16-
// Open the storage file in read/write binary mode
16+
/* Open the storage file in read/write binary mode */
1717
storage_file = fopen(STORAGE_FILE_PATH, "r+b");
1818
if (!storage_file) {
1919
perror("Failed to open storage file");
2020
return STA_NODISK | STA_NOINIT;
2121
}
2222

23-
return 0; // Initialization successful
23+
return 0; /* Initialization successful */
2424
}
2525

26-
// Get the status of the storage file
26+
/* Get the status of the storage file */
2727
DSTATUS disk_status(BYTE pdrv) {
28-
if (pdrv != 0) return STA_NOINIT; // Only support one drive (0)
28+
if (pdrv != 0) return STA_NOINIT; /* Only support one drive (0) */
2929
if (!storage_file) return STA_NODISK;
3030
return 0;
3131
}
3232

33-
// Read sectors from the storage file
33+
/* Read sectors from the storage file */
3434
DRESULT disk_read(BYTE pdrv, BYTE* buff, LBA_t sector, UINT count) {
35-
if (pdrv != 0) return RES_PARERR; // Only support one drive (0)
35+
if (pdrv != 0) return RES_PARERR; /* Only support one drive (0) */
3636
if (!storage_file) return RES_NOTRDY;
3737

38-
off_t offset = sector * FF_MIN_SS; // Calculate the byte offset
38+
off_t offset = sector * FF_MIN_SS; /* Calculate the byte offset */
3939
if (fseek(storage_file, offset, SEEK_SET) != 0) {
4040
perror("Failed to seek in storage file");
4141
return RES_ERROR;
@@ -50,12 +50,12 @@ DRESULT disk_read(BYTE pdrv, BYTE* buff, LBA_t sector, UINT count) {
5050
return RES_OK;
5151
}
5252

53-
// Write sectors to the storage file
53+
/* Write sectors to the storage file */
5454
DRESULT disk_write(BYTE pdrv, const BYTE* buff, LBA_t sector, UINT count) {
55-
if (pdrv != 0) return RES_PARERR; // Only support one drive (0)
55+
if (pdrv != 0) return RES_PARERR; /* Only support one drive (0) */
5656
if (!storage_file) return RES_NOTRDY;
5757

58-
off_t offset = sector * FF_MIN_SS; // Calculate the byte offset
58+
off_t offset = sector * FF_MIN_SS; /* Calculate the byte offset */
5959
if (fseek(storage_file, offset, SEEK_SET) != 0) {
6060
perror("Failed to seek in storage file");
6161
return RES_ERROR;
@@ -67,17 +67,17 @@ DRESULT disk_write(BYTE pdrv, const BYTE* buff, LBA_t sector, UINT count) {
6767
return RES_ERROR;
6868
}
6969

70-
fflush(storage_file); // Ensure data is written to disk
70+
fflush(storage_file); /* Ensure data is written to disk */
7171
return RES_OK;
7272
}
7373

74-
// Control the device
74+
/* Control the device */
7575
DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void* buff) {
76-
if (pdrv != 0) return RES_PARERR; // Only support one drive (0)
76+
if (pdrv != 0) return RES_PARERR; /* Only support one drive (0) */
7777

7878
switch (cmd) {
7979
case CTRL_SYNC:
80-
// Ensure all data is written to disk
80+
/* Ensure all data is written to disk */
8181
fflush(storage_file);
8282
break;
8383

@@ -86,7 +86,7 @@ DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void* buff) {
8686
break;
8787

8888
case GET_BLOCK_SIZE:
89-
*(DWORD*)buff = 1; // One sector per block (minimum)
89+
*(DWORD*)buff = 1; /* One sector per block (minimum) */
9090
break;
9191

9292
default:
@@ -96,19 +96,19 @@ DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void* buff) {
9696
return RES_OK;
9797
}
9898

99-
// Function to deinitialize the storage file
99+
/* Function to deinitialize the storage file */
100100
DSTATUS disk_deinitialize(BYTE pdrv) {
101-
if (pdrv != 0) return STA_NOINIT; // Only support one drive (0)
101+
if (pdrv != 0) return STA_NOINIT; /* Only support one drive (0) */
102102

103103
if (storage_file) {
104104
fclose(storage_file);
105105
storage_file = NULL;
106106
}
107107

108-
return 0; // Deinitialization successful
108+
return 0; /* Deinitialization successful */
109109
}
110110

111-
// FatFs disk I/O driver interface
111+
/* FatFs disk I/O driver interface */
112112
DSTATUS disk_status_(BYTE pdrv) { return disk_status(pdrv); }
113113
DRESULT disk_read_(BYTE pdrv, BYTE* buff, LBA_t sector, UINT count) { return disk_read(pdrv, buff, sector, count); }
114114
DRESULT disk_write_(BYTE pdrv, const BYTE* buff, LBA_t sector, UINT count) { return disk_write(pdrv, buff, sector, count); }

0 commit comments

Comments
 (0)