My Project
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules
fs.c File Reference
#include <string.h>
#include <3ds.h>

Go to the source code of this file.

Functions

Handle __get_handle_from_list (char *name)
 
Result fsInit (void)
 
Result fsExit (void)
 
Result FSUSER_Initialize (Handle *handle)
 
Result FSUSER_OpenFile (Handle *handle, Handle *out, FS_archive archive, FS_path fileLowPath, u32 openFlags, u32 attributes)
 
Result FSUSER_OpenFileDirectly (Handle *handle, Handle *out, FS_archive archive, FS_path fileLowPath, u32 openFlags, u32 attributes)
 
Result FSUSER_DeleteFile (Handle *handle, FS_archive archive, FS_path fileLowPath)
 
Result FSUSER_RenameFile (Handle *handle, FS_archive srcArchive, FS_path srcFileLowPath, FS_archive destArchive, FS_path destFileLowPath)
 
Result FSUSER_DeleteDirectory (Handle *handle, FS_archive archive, FS_path dirLowPath)
 
Result FSUSER_DeleteDirectoryRecursively (void)
 
Result FSUSER_CreateFile (void)
 
Result FSUSER_CreateDirectory (Handle *handle, FS_archive archive, FS_path dirLowPath)
 
Result FSUSER_RenameDirectory (Handle *handle, FS_archive srcArchive, FS_path srcDirLowPath, FS_archive destArchive, FS_path destDirLowPath)
 
Result FSUSER_OpenDirectory (Handle *handle, Handle *out, FS_archive archive, FS_path dirLowPath)
 
Result FSUSER_OpenArchive (Handle *handle, FS_archive *archive)
 
Result FSUSER_CloseArchive (Handle *handle, FS_archive *archive)
 
Result FSUSER_GetSdmcArchiveResource (Handle *handle, u32 *sectorSize, u32 *clusterSize, u32 *numClusters, u32 *freeClusters)
 
Result FSUSER_IsSdmcDetected (Handle *handle, u32 *detected)
 
Result FSUSER_IsSdmcWritable (Handle *handle, u32 *writable)
 
Result FSFILE_Close (Handle handle)
 
Result FSFILE_Read (Handle handle, u32 *bytesRead, u64 offset, void *buffer, u32 size)
 
Result FSFILE_Write (Handle handle, u32 *bytesWritten, u64 offset, const void *buffer, u32 size, u32 flushFlags)
 
Result FSFILE_GetSize (Handle handle, u64 *size)
 
Result FSFILE_SetSize (Handle handle, u64 size)
 
Result FSFILE_GetAttributes (Handle handle, u32 *attributes)
 
Result FSFILE_SetAttributes (Handle handle, u32 attributes)
 
Result FSFILE_Flush (Handle handle)
 
Result FSDIR_Read (Handle handle, u32 *entriesRead, u32 entryCount, FS_dirent *buffer)
 
Result FSDIR_Close (Handle handle)
 

Function Documentation

Handle __get_handle_from_list ( char *  name)
Result FSDIR_Close ( Handle  handle)

Close an open directory

Parameters
[in]handleOpen directory handle
Returns
error

Definition at line 1325 of file fs.c.

Result FSDIR_Read ( Handle  handle,
u32 entriesRead,
u32  entryCount,
FS_dirent buffer 
)

Read a directory entry from an open directory

Parameters
[in]handleOpen directory handle
[out]entriesReadOutput number of entries read
[in]entryCountNumber of entries to read
[out]bufferOutput buffer
Returns
error

Definition at line 1281 of file fs.c.

Result fsExit ( void  )

Deinitialize FS service

Returns
error

Definition at line 35 of file fs.c.

Result FSFILE_Close ( Handle  handle)

Close an open file

Parameters
[in]handleOpen file handle
Returns
error

Definition at line 911 of file fs.c.

Result FSFILE_Flush ( Handle  handle)

Flush an open file

Parameters
[in]handleOpen file handle
Returns
error

Definition at line 1239 of file fs.c.

Result FSFILE_GetAttributes ( Handle  handle,
u32 attributes 
)

Get attributes for an open file

Parameters
[in]handleOpen file handle
[out]attributesOutput attributes
Returns
error

Definition at line 1161 of file fs.c.

Result FSFILE_GetSize ( Handle  handle,
u64 size 
)

Get the size of an open file

Parameters
[in]handleOpen file handle
[out]sizeOutput size
Returns
error

Definition at line 1078 of file fs.c.

Result FSFILE_Read ( Handle  handle,
u32 bytesRead,
u64  offset,
void *  buffer,
u32  size 
)

Read data from an open file

Parameters
[in]handleOpen file handle
[out]bytesReadNumber of bytes read
[in]offsetFile offset to read from
[out]bufferBuffer to read into
[in]sizeNumber of bytes to read
Returns
error

Definition at line 959 of file fs.c.

Result FSFILE_SetAttributes ( Handle  handle,
u32  attributes 
)

Set attributes for an open file

Parameters
[in]handleOpen file handle
[in]attributesAttributes to set
Returns
error

Definition at line 1202 of file fs.c.

Result FSFILE_SetSize ( Handle  handle,
u64  size 
)

Set the size of an open file

Parameters
[in]handleOpen file handle
[in]sizeSize to set
Returns
error

Definition at line 1120 of file fs.c.

Result FSFILE_Write ( Handle  handle,
u32 bytesWritten,
u64  offset,
const void *  buffer,
u32  size,
u32  flushFlags 
)

Write data to an open file

Parameters
[in]handleOpen file handle
[out]bytesWrittenNumber of bytes read
[in]offsetFile offset to write to
[in]bufferBuffer to write from
[in]sizeNumber of bytes to write
[in]flushFlagsFlush flags
Returns
error
See also
FS Flush Flags
Warning
Using invalid flushFlags can corrupt the archive you're writing to.
Data should not be in read-only memory.

Definition at line 1026 of file fs.c.

Result fsInit ( void  )

Initialize FS service

Returns
error

Definition at line 22 of file fs.c.

Result FSUSER_CloseArchive ( Handle handle,
FS_archive archive 
)

Close an open archive

Parameters
[in]handlefs:USER handle
[in,out]archiveArchive to close
Returns
error

Definition at line 717 of file fs.c.

Result FSUSER_CreateDirectory ( Handle handle,
FS_archive  archive,
FS_path  dirLowPath 
)

Create a directory

Parameters
[in]handlefs:USER handle
[in]archiveOpen archive
[in]dirLowPathDirectory path to create
Returns
error

Definition at line 475 of file fs.c.

Result FSUSER_CreateFile ( void  )

Definition at line 438 of file fs.c.

Result FSUSER_DeleteDirectory ( Handle handle,
FS_archive  archive,
FS_path  dirLowPath 
)

Delete a directory

Parameters
[in]handlefs:USER handle
[in]archiveOpen archive
[in]dirLowPathDirectory path
Returns
error

Definition at line 404 of file fs.c.

Result FSUSER_DeleteDirectoryRecursively ( void  )

Definition at line 431 of file fs.c.

Result FSUSER_DeleteFile ( Handle handle,
FS_archive  archive,
FS_path  fileLowPath 
)

Delete a file

Parameters
[in]handlefs:USER handle
[in]archiveOpen archive
[in]fileLowPathFile path
Returns
error

Definition at line 276 of file fs.c.

Result FSUSER_GetSdmcArchiveResource ( Handle handle,
u32 sectorSize,
u32 clusterSize,
u32 numClusters,
u32 freeClusters 
)

Get SD FAT information

Parameters
[in]handlefs:USER handle
[out]sectorSizeSector size (bytes)
[out]clusterSizeCluster size (bytes)
[out]numClustersTotal number of clusters
[out]freeClustersNumber of free clusters
Returns
error

Definition at line 769 of file fs.c.

Result FSUSER_Initialize ( Handle handle)

Initialize FS service handle

If handle is NULL, this initializes fsuHandle.

Parameters
[in]handlefs:USER service handle
Returns
error

Definition at line 65 of file fs.c.

Result FSUSER_IsSdmcDetected ( Handle handle,
u32 detected 
)

Check if SD card is detected

Parameters
[in]handlefs:USER handle
[out]detectedOutput detected state
Returns
error

Definition at line 825 of file fs.c.

Result FSUSER_IsSdmcWritable ( Handle handle,
u32 writable 
)

Check if SD card is writable

Parameters
[in]handlefs:USER handle
[out]writableOutput writable state
Returns
error

Definition at line 869 of file fs.c.

Result FSUSER_OpenArchive ( Handle handle,
FS_archive archive 
)

Open an archive

Parameters
[in]handlefs:USER handle
[in,out]archiveArchive to open
Returns
error

Definition at line 663 of file fs.c.

Result FSUSER_OpenDirectory ( Handle handle,
Handle out,
FS_archive  archive,
FS_path  dirLowPath 
)

Open a directory

Parameters
[in]handlefs:USER handle
[out]outOutput handle
[in]archiveOpen archive
[in]dirLowPathDirectory path
Returns
error

Definition at line 605 of file fs.c.

Result FSUSER_OpenFile ( Handle handle,
Handle out,
FS_archive  archive,
FS_path  fileLowPath,
u32  openFlags,
u32  attributes 
)

Open a file

Parameters
[in]handlefs:USER handle
[out]outOutput handle
[in]archiveOpen archive
[in]fileLowPathFile path
[in]openFlagsOpen flags
[in]attributesCreate attributes
Note
This requires archive to have been opened
Returns
error
See also
FS Open Flags
FS Create Attributes

Definition at line 130 of file fs.c.

Result FSUSER_OpenFileDirectly ( Handle handle,
Handle out,
FS_archive  archive,
FS_path  fileLowPath,
u32  openFlags,
u32  attributes 
)

Open a file

Parameters
[in]handlefs:USER handle
[out]outOutput handle
[in]archiveOpen archive
[in]fileLowPathFile path
[in]openFlagsOpen flags
[in]attributesCreate attributes
Note
This does not require archive to have been opened
Returns
error
See also
FS Open Flags
FS Create Attributes

Definition at line 209 of file fs.c.

Result FSUSER_RenameDirectory ( Handle handle,
FS_archive  srcArchive,
FS_path  srcDirLowPath,
FS_archive  destArchive,
FS_path  destDirLowPath 
)

Renames or moves a directory.

Parameters
[in]handlefs:USER handle
[in]srcArchiveOpen archive of source
[in]srcDirLowPathDir path to source
[in]destArchiveOpen archive of destination
[in]destDirLowPathDir path to destination
Returns
error

Definition at line 540 of file fs.c.

Result FSUSER_RenameFile ( Handle handle,
FS_archive  srcArchive,
FS_path  srcFileLowPath,
FS_archive  destArchive,
FS_path  destFileLowPath 
)

Renames or moves a file.

Parameters
[in]handlefs:USER handle
[in]srcArchiveOpen archive of source
[in]srcFileLowPathFile path to source
[in]destArchiveOpen archive of destination
[in]destFileLowPathFile path to destination
Returns
error

Definition at line 340 of file fs.c.