#include <cafe/fs.h>

FSStatus FSGetMountSource(
                FSClient                        *client,
                FSCmdBlock                      *block,
                FSSourceType                    type,
                FSMountSource                   *source,
                FSRetFlag                       errHandling
FSStatus FSGetMountSourceAsync(
                FSClient                        *client,
                FSCmdBlock                      *block,
                FSSourceType                    type,
                FSMountSource                   *source,
                FSRetFlag                       errHandling,
                const   FSAsyncParams           *asyncParams


client Pointer of client buffer.
block Command block.
type Source type.
  • FS_SOURCETYPE_EXTERNAL: External storage device (FAT formatted).
  • FS_SOURCETYPE_HFIO: Host file IO device.
source Pointer to an available mountable source. For more information, see FSMountSource.
errHandling Auto error handling flag. Only indicated errors are returned.
asyncParams (Async API only) Notification parameters for the asynchronous call.

Return Values

Sync API : Return values / Async API: Callback return values

FS_STATUS_OK Successfully retrieved the next available mount source.
FS_STATUS_END There are no more available mount sources.
FS_STATUS_MAX This function use a directory handle. All the directory handles are already used.
FS_STATUS_CANCELED The command was canceled.

Async API: Immediate return values

FS_STATUS_OK Successfully issued request.
FS_STATUS_FATAL_ERROR The argument was invalid.


Find and get one of the available mountable sources of the specified type. This function is for manually mounted external devices (SD with FAT) and Host File IO (HFIO) volume.

If multiple volumes are available for the specified type, the first one on the list is returned. Use FSGetMountSourceNext to get the rest. The context for this procedure is stored per FSClient struct.

Both a sync and async style API are provided. To use the async API, set user the callback and parameters in asyncParams. For more information, see FSAsyncParams.

If this API returns FS_STATUS_END at the first call, it means that any device was not found for the specified type. Since this case is not regarded as an error, do not handle the case using the error handling functions such as FSGetLastError or FSGetErrorCodeForViewer. Use the error handling functions for other cases, such as FSMount or file operation functions for the mounted device, which always return an error if the device is not present.

Cafe SDK supports SD cards on the FS layer only as manually mounted devices. For information about mounting devices manually, see File System Overview. For information about see how to mount and access SD cards, see FS Demos.

To use an SD card, in the Application Config Tool, Storage Information, Storage Access, check Read and Write check boxes for SD cards, and then output an XML.

Without this setup, the application cannot recognize an SD card when it is inserted, and FSGetMountSource immediately returns FS_STATUS_END.

Do Not Call From


Thread that displays graphics Do not call this function from a thread that displays graphics. This function may block indefinitely in error cases and the application must be able to display appropriate messages.
Thread that handles system messages Do not call this function from a thread that handles system messages. This function may block indefinitely in error cases and the application must be able to handle system events such as shutdown.
Callbacks Do not call this function from any callback function.
Interrupt handler Do not call this function from any interrupt handler.
Exception handler Do not call this function from any exception handler.



See Also


Revision History

2014/09/16 Added "Thread that displays graphics" and "Thread that handles system messages" to "Do not call from".
2013/12/11 The permission from Nintendo to use SD Cards for production applications is no longer required.
2013/12/11 Added description that being returned FS_STATUS_END immediately means no valid device is present.
2013/05/08 Automated cleanup pass.
2013/01/10 Added "Callback" to "Do not call from".
2012/11/20 Replaced "FAT32" to "FAT".
2012/07/19 Readability cleanup.
2010/12/12 Initial version.