Skip to content

Commit 5a5b90b

Browse files
author
Alrik Vidstrom
committed
Rename to DeviceNames enum to StorageDevices
1 parent 937296a commit 5a5b90b

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

extras/tests/Arduino_POSIXStorage_Test/Arduino_POSIXStorage_Test.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void usbCallback()
4141

4242
void setup() {
4343
bool allTestsOk = true;
44-
enum DeviceNames deviceName;
44+
enum StorageDevices deviceName;
4545
int fileDescriptor = 0;
4646
int retVal = -1;
4747

src/Arduino_POSIXStorage.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ enum BoardTypes detectBoardType()
235235
#endif
236236
} // End of detectBoardType()
237237

238-
void deleteDevice(const enum DeviceNames deviceName, struct DeviceFileSystemCombination * const deviceFileSystemCombination)
238+
void deleteDevice(const enum StorageDevices deviceName, struct DeviceFileSystemCombination * const deviceFileSystemCombination)
239239
{
240240
// The USBHostMSD class for the H7 doesn't correctly support object destruction, so we only delete
241241
// the device object on other platforms or if the device is an SD Card -->
@@ -258,7 +258,7 @@ void deleteDevice(const enum DeviceNames deviceName, struct DeviceFileSystemComb
258258
} // End of deleteDevice()
259259

260260
// WARNING: Don't set errno and return -1 in this function - just return 0 for success or the errno code!
261-
int mountOrFormatFileSystemOnDevice(const enum DeviceNames deviceName,
261+
int mountOrFormatFileSystemOnDevice(const enum StorageDevices deviceName,
262262
struct DeviceFileSystemCombination * const deviceFileSystemCombination,
263263
const enum FileSystems fileSystem,
264264
const char * const mountPoint,
@@ -476,7 +476,7 @@ int mountOrFormatUSBDevice(const enum FileSystems fileSystem,
476476
} // End of mountOrFormatUSB()
477477

478478
// WARNING: Don't set errno and return -1 in this function - just return 0 for success or the errno code!
479-
int mountOrFormat(const enum DeviceNames deviceName,
479+
int mountOrFormat(const enum StorageDevices deviceName,
480480
const enum FileSystems fileSystem,
481481
const enum ActionTypes mountOrFormat)
482482
{
@@ -509,7 +509,7 @@ int mountOrFormat(const enum DeviceNames deviceName,
509509
*********************************************************************************************************
510510
*/
511511

512-
int mount(const enum DeviceNames deviceName,
512+
int mount(const enum StorageDevices deviceName,
513513
const enum FileSystems fileSystem,
514514
const enum MountFlags mountFlags)
515515
{
@@ -528,7 +528,7 @@ int mount(const enum DeviceNames deviceName,
528528
return 0;
529529
} // End of mount()
530530

531-
int mkfs(const enum DeviceNames deviceName, const enum FileSystems fileSystem)
531+
int mkfs(const enum StorageDevices deviceName, const enum FileSystems fileSystem)
532532
{
533533
const int mountOrFormatReturn = mountOrFormat(deviceName, fileSystem, ACTION_FORMAT);
534534
if (0 != mountOrFormatReturn)
@@ -539,7 +539,7 @@ int mkfs(const enum DeviceNames deviceName, const enum FileSystems fileSystem)
539539
return 0;
540540
} // End of mkfs()
541541

542-
int umount(const enum DeviceNames deviceName)
542+
int umount(const enum StorageDevices deviceName)
543543
{
544544
struct DeviceFileSystemCombination *deviceFileSystemCombination = nullptr;
545545

@@ -579,7 +579,7 @@ int umount(const enum DeviceNames deviceName)
579579
}
580580
} // End of umount()
581581

582-
int register_hotplug_callback(const enum DeviceNames deviceName, void (* const callbackFunction)())
582+
int register_hotplug_callback(const enum StorageDevices deviceName, void (* const callbackFunction)())
583583
{
584584
if (true == hotplugCallbackAlreadyRegistered)
585585
{
@@ -641,7 +641,7 @@ int register_hotplug_callback(const enum DeviceNames deviceName, void (* const c
641641
} // End of hotplug_register_callback()
642642

643643
// Not supported by the layer below on these platforms, but might be on other platforms
644-
int deregister_hotplug_callback(const enum DeviceNames deviceName)
644+
int deregister_hotplug_callback(const enum StorageDevices deviceName)
645645
{
646646
(void) deviceName; // Remove when implemented, only here to silence -Wunused-parameter
647647
errno = ENOSYS;

src/Arduino_POSIXStorage.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
*********************************************************************************************************
8989
*/
9090

91-
enum DeviceNames : uint8_t
91+
enum StorageDevices : uint8_t
9292
{
9393
DEV_SDCARD, ///< SD Card
9494
DEV_USB ///< USB Thumb Drive
@@ -119,7 +119,7 @@ enum MountFlags : uint8_t
119119
* @param mountFlags The only valid flag at this time: MNT_DEFAULT.
120120
* @return On success: 0. On failure: -1 with an error code in the errno variable.
121121
*/
122-
int mount(const enum DeviceNames deviceName,
122+
int mount(const enum StorageDevices deviceName,
123123
const enum FileSystems fileSystem,
124124
const enum MountFlags mountFlags);
125125

@@ -128,29 +128,29 @@ int mount(const enum DeviceNames deviceName,
128128
* @param deviceName The device to remove from: DEV_SDCARD or DEV_USB.
129129
* @return On success: 0. On failure: -1 with an error code in the errno variable.
130130
*/
131-
int umount(const enum DeviceNames deviceName);
131+
int umount(const enum StorageDevices deviceName);
132132

133133
/**
134134
* @brief Register a hotplug callback function. Currently only supported for DEV_USB on Portenta C33.
135135
* @param deviceName The device to register for: DEV_SDCARD or DEV_USB.
136136
* @param callbackFunction A function pointer to the callback.
137137
* @return On success: 0. On failure: -1 with an error code in the errno variable.
138138
*/
139-
int register_hotplug_callback(const enum DeviceNames deviceName, void (* const callbackFunction)());
139+
int register_hotplug_callback(const enum StorageDevices deviceName, void (* const callbackFunction)());
140140

141141
/**
142142
* @brief Deregister a previously registered hotplug callback function. Not currently supported on any platform.
143143
* @param deviceName The device to deregister for: DEV_SDCARD or DEV_USB.
144144
* @return On success: 0. On failure: -1 with an error code in the errno variable.
145145
*/
146-
int deregister_hotplug_callback(const enum DeviceNames deviceName);
146+
int deregister_hotplug_callback(const enum StorageDevices deviceName);
147147

148148
/**
149149
* @brief Format a device (make file system).
150150
* @param deviceName The device to format: DEV_SDCARD or DEV_USB.
151151
* @param fileSystem The file system type to format: FS_FAT or FS_LITTLEFS. FS_FAT is probably the better choice for both SD Cards and USB thumb drives in most cases.
152152
* @return On success: 0. On failure: -1 with an error code in the errno variable.
153153
*/
154-
int mkfs(const enum DeviceNames deviceName, const enum FileSystems fileSystem);
154+
int mkfs(const enum StorageDevices deviceName, const enum FileSystems fileSystem);
155155

156156
#endif // Arduino_POSIXStorage_H

0 commit comments

Comments
 (0)