# FSCommandType

## Definition

  `#include <nitro/fs.h>`
  `

      typedef	enum {
      	FS_COMMAND_ASYNC_BEGIN = 0,
      	FS_COMMAND_READFILE = FS_COMMAND_ASYNC_BEGIN,
      	FS_COMMAND_WRITEFILE,
      	FS_COMMAND_ASYNC_END,

      	FS_COMMAND_SYNC_BEGIN = FS_COMMAND_ASYNC_END,
      	FS_COMMAND_SEEKDIR = FS_COMMAND_SYNC_BEGIN,
      	FS_COMMAND_READDIR,
      	FS_COMMAND_FINDPATH,
      	FS_COMMAND_GETPATH,
      	FS_COMMAND_OPENFILEFAST,
      	FS_COMMAND_OPENFILEDIRECT,
      	FS_COMMAND_CLOSEFILE,
      	FS_COMMAND_SYNC_END,

      	FS_COMMAND_STATUS_BEGIN = FS_COMMAND_SYNC_END,
      	FS_COMMAND_ACTIVATE = FS_COMMAND_STATUS_BEGIN,
      	FS_COMMAND_IDLE,
      	FS_COMMAND_STATUS_END,

      	FS_COMMAND_INVALID

      } FSCommandType;

  `

## Description

This enumerated type represents commands sent by the file system to an archive. They are defined as follows.

`FS_COMMAND_STATUS_BEGIN` | The first message command ID in a sequence of message commands related to archive state changes.
`FS_COMMAND_STATUS_END` | The final message command ID in a sequence of message commands related to archive state changes, plus 1.
The following message commands occur between `FS_COMMAND_STATUS_BEGIN` and `FS_COMMAND_STATUS_END`.
| `FS_COMMAND_ACTIVATE` | Occurs before an archive in the idle state begins its first operation.
`FS_COMMAND_IDLE` | Occurs after an archive completes its final operation and becomes idle.
`FS_COMMAND_SYNC_BEGIN` | The first command ID in a sequence of synchronous commands.
`FS_COMMAND_SYNC_END` | The final command ID in a sequence of synchronous commands, plus 1.
The following message commands occur between `FS_COMMAND_SYNC_BEGIN` and `FS_COMMAND_SYNC_END`.
| `FS_COMMAND_SEEKDIR` | Command issued by functions that need to search directory locations.
`FS_COMMAND_READDIR` | Command issued by functions that need to read directory entries.
`FS_COMMAND_OPENFILEDIRECT` | Command issued by functions that need to open files by directly specifying the file region.
`FS_COMMAND_OPENFILEFAST` | Command issued by functions that need to open files by using their file IDs.
`FS_COMMAND_CLOSEFILE` | Command issued by functions that need to close files.
`FS_COMMAND_FINDPATH` | Command issued by functions that need to determine a file or directory from a path name.
`FS_COMMAND_GETPATH` | Command issued by functions that need either full path names or the length of full path names.
`FS_COMMAND_ASYNC_BEGIN` | The first command ID in a sequence of asynchronous commands.
`FS_COMMAND_ASYNC_END` | The final command ID in a sequence of asynchronous commands, plus 1.
The following message commands occur between `FS_COMMAND_ASYNC_BEGIN` and `FS_COMMAND_ASYNC_END`.
| `FS_COMMAND_READFILE` | Command issued by functions that need read access to files.
`FS_COMMAND_WRITEFILE` | Command issued by functions that need write access to files.
`FS_COMMAND_INVALID` | Provided as an internal constant that represents invalid commands.

Asynchronous commands complete by simply invoking the archive callback function once.
Synchronous commands require some processing in addition to invoking a callback function.
The default implementation of synchronous commands has dependencies. Some commands use low-level commands internally.
The main inter-command dependencies are shown in the following table.

No. | Commands | Command or Archive Information to Use
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15
1 | (`FS_ARCHIVE_READ_FUNC`) |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
2 | (`FS_ARCHIVE_WRITE_FUNC`) |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
3 | ( FAT Information ) |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
4 | ( FNT Information ) |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
5 | `FS_COMMAND_ACTIVATE` |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
6 | `FS_COMMAND_IDLE` |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
7 | `FS_COMMAND_SEEKDIR` | Yes |  |  | Yes |  |  |  |  |  |  |  |  |  |  |
8 | `FS_COMMAND_READDIR` | Yes |  |  | Yes |  |  |  |  |  |  |  |  |  |  |
9 | `FS_COMMAND_OPENFILEDIRECT` |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
10 | `FS_COMMAND_OPENFILEFAST` | Yes |  | Yes |  |  |  |  |  | Yes |  |  |  |  |  |
11 | `FS_COMMAND_CLOSEFILE` |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
12 | `FS_COMMAND_FINDPATH` |  |  |  |  |  |  | Yes | Yes |  |  |  |  |  |  |
13 | `FS_COMMAND_GETPATH` |  |  |  |  |  |  | Yes | Yes |  |  |  |  |  |  |
14 | `FS_COMMAND_READFILE` | Yes |  |  |  |  |  |  |  |  |  |  |  |  |  |
15 | `FS_COMMAND_WRITEFILE` |  | Yes |  |  |  |  |  |  |  |  |  |  |  |  |

## See Also

`FSArchive`
`FS_ARCHIVE_PROC_FUNC`
`FS_SetArchiveProc`

## Revision History

2009/04/10 Replaced symbols used in the tables with standard notation.
2004/07/12 Corrected all command descriptions.
2004/06/30 Initial version.

CONFIDENTIAL