1 /*---------------------------------------------------------------------------*
2   Project:     FS: File system utilization layer for application
3   File:        fs.h
4   Description: This file defines FS interface.
5 
6   Copyright (C) 2010-2011 Nintendo.  All rights reserved.
7 
8   These coded instructions, statements, and computer programs contain
9   proprietary information of Nintendo of America Inc. and/or Nintendo
10   Company Ltd., and are protected by Federal copyright law.  They may
11   not be disclosed to third parties or copied or duplicated in any form,
12   in whole or in part, without the prior written consent of Nintendo.
13 
14   *---------------------------------------------------------------------------*/
15 #ifndef __FS_H__
16 #define __FS_H__
17 
18 #include <cafe.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 /*---------------------------------------------------------------------------*
25  *
26  *    Constants defined for this file
27  *    -- #Defines's --
28  *
29  *---------------------------------------------------------------------------*/
30 
31 #define FS_MAX_CLIENTS                  63
32 #define FS_MAX_MOUNTPOINTS              48
33 
34 #define FS_CLIENT_BUFFER_SIZE           (5888)
35 #define FS_CMD_BLOCK_SIZE               (2688)
36 
37 /* FS data buffer alignment */
38 #define FS_IO_BUFFER_ALIGN              64
39 
40 /* Permission mode flag */
41 #define FS_MODE_IRGRP                   0x000040 /* read bit for owner's group */
42 #define FS_MODE_IWGRP                   0x000020 /* write bit for owner's group */
43 #define FS_MODE_IROTH                   0x000004 /* read bit for others */
44 #define FS_MODE_IWOTH                   0x000002 /* write bit for others */
45 #define FS_MODE_IRWG                    (FS_MODE_IRGRP | FS_MODE_IWGRP) /* read/write bits for owner's group */
46 #define FS_MODE_IRWO                    (FS_MODE_IROTH | FS_MODE_IWOTH) /* read/write bits for others */
47 
48 
49 /* Default mount paths */
50 #define FS_CONTENT_DIR                  "/vol/content"
51 #define FS_SAVE_DIR                     "/vol/save"
52 
53 /* path to device files directory */
54 #define FS_DEVICEFILES_ROOT             "/dev"
55 #define FS_DEVICEFILES_ROOT_NAMESIZE    4
56 
57 /* max length of path under mount point
58  * should be the least value among all file systems */
59 #define FS_MAX_LOCALPATH_SIZE      511
60 #define FS_MAX_LOCALPATH_SIZE_PAD  1
61 
62 /* max length of mount point path */
63 #define FS_MAX_MOUNTPATH_SIZE      128
64 #define FS_MAX_MOUNTPATH_SIZE_PAD  0
65 
66 /* max length of full path (mount path + FS-local path) */
67 #define FS_MAX_FULLPATH_SIZE       (FS_MAX_LOCALPATH_SIZE + FS_MAX_MOUNTPATH_SIZE)
68 #define FS_MAX_FULLPATH_SIZE_PAD   (FS_MAX_LOCALPATH_SIZE_PAD + FS_MAX_MOUNTPATH_SIZE_PAD)
69 
70 /* max length of path strings that user passes in arguments
71  * should be the least value among all file systems */
72 #define FS_MAX_ARGPATH_SIZE        FS_MAX_FULLPATH_SIZE
73 #define FS_MAX_ARGPATH_SIZE_PAD    FS_MAX_FULLPATH_SIZE_PAD
74 
75 /* max length of file/dir name
76  * should be the least value among all file systems */
77 #define FS_MAX_ENTNAME_SIZE        256
78 #define FS_MAX_ENTNAME_SIZE_PAD    0
79 
80 /* mode string in open file command parameters */
81 #define FS_MAX_MODE_SIZE           16
82 #define FS_MAX_MODE_SIZE_PAD       0
83 
84 
85 /* directory entry stat flag */
86 #define FS_STAT_ATTRIBUTES_SIZE             (48)        /* size of FS-specific attributes field */
87 #define FS_STAT_FLAG_IS_DIRECTORY           0x80000000  /* entry is directory */
88 #define FS_STAT_FLAG_IS_QUOTA               0x40000000  /* entry is quota */
89 #define FS_STAT_FLAG_SPRT_QUOTA_SIZE        0x20000000  /* FS supports .quota_size field */
90 #define FS_STAT_FLAG_SPRT_ENTID             0x10000000  /* FS supports .ent_id field */
91 #define FS_STAT_FLAG_SPRT_CTIME             0x08000000  /* FS supports .ctime field */
92 #define FS_STAT_FLAG_SPRT_MTIME             0x04000000  /* FS supports .mtime field */
93 #define FS_STAT_FLAG_SPRT_ATTRIBUTES        0x02000000  /* FS supports .attributes field */
94 #define FS_STAT_FLAG_SPRT_FILE_ALLOC_SIZE   0x01000000  /* FS supports .alloc_size field */
95 #define FS_STAT_FLAG_IS_RAW_FILE            0x00800000  /* entry is not encrypted */
96 #define FS_STAT_FLAG_SPRT_DIR_SIZE          0x00100000  /* FS supports .size field for directory
97                                                          * this field does not have meaning for file */
98 #define FS_STAT_FLAG_IS_UNSUPPORTED_CHAR    0x00080000  /* entry name contains unsupported character */
99 
100 /* invalid handle value for FSOpenFile/FSOpenDir */
101 #define FS_INVALID_HANDLE_VALUE             -1
102 
103 /* Command priority for FSPriority */
104 #define FS_PRIORITY_DEFAULT                 16
105 #define FS_PRIORITY_HIGHEST                  0
106 #define FS_PRIORITY_LOWEST                  31
107 
108 
109 /*---------------------------------------------------------------------------*
110  *
111  *    Data types defined for this file
112  *    -- Struct's, Typedef's, Enum's --
113  *
114  *---------------------------------------------------------------------------*/
115 
116 /* Common primitives */
117 typedef s32                 FSError;
118 typedef s32                 FSStatus;
119 typedef s32                 FSDirHandle;
120 typedef s32                 FSFileHandle;
121 typedef u32                 FSSize;
122 typedef u64                 FSBSize;
123 typedef u32                 FSCount;
124 typedef u32                 FSFlag;
125 typedef u32                 FSPermission;
126 typedef u32                 FSRetFlag;
127 typedef u32                 FSMode;
128 typedef u32                 FSFilePosition;
129 typedef u64                 FSTime;
130 typedef u32                 FSEntryNum;
131 typedef u32                 FSUserId;
132 typedef u32                 FSGroupId;
133 
134 typedef FSBSize             FSFreeSpaceSize;
135 typedef FSBSize             FSDirSize;
136 
137 typedef s32                 FSPriority;
138 
139 
140 /* FS Client context buffer */
141 typedef struct
142 {
143     u8 buffer[FS_CLIENT_BUFFER_SIZE];
144 } FSClient;
145 
146 /* FS command block buffer */
147 typedef struct
148 {
149     u8 buffer[FS_CMD_BLOCK_SIZE];
150 } FSCmdBlock;
151 
152 
153 /* Volume state */
154 typedef enum
155 {
156     FS_VOLSTATE_INITIAL = 0, /* Internal use only */
157 
158     /* Ready */
159     FS_VOLSTATE_READY,
160 
161     /*
162      * Media is not attached.
163      * State machine waits for re-insert if it is remountable.
164      * If not, app should unmount the volume by itself.
165      */
166     FS_VOLSTATE_NO_MEDIA,        // There is no media
167 
168     /*
169      * Something is wrong with media.
170      * State machine waits for detach.
171      */
172     FS_VOLSTATE_INVALID_MEDIA,   // Unsupported media or state (cd-rom, reversed media)
173     FS_VOLSTATE_DIRTY_MEDIA,     // Dirty / deformed media
174     FS_VOLSTATE_WRONG_MEDIA,     // Media format is correct. but media is not the expected one.
175     FS_VOLSTATE_MEDIA_ERROR,     // The other media error
176     FS_VOLSTATE_DATA_CORRUPTED,  // Detected data corruption
177     FS_VOLSTATE_WRITE_PROTECTED, // Write protected media
178 
179     /* Fatal */
180     FS_VOLSTATE_JOURNAL_FULL,    // Journaling area is full. flushing data is needed.
181     FS_VOLSTATE_FATAL,
182 
183     FS_VOLSTATE_INVALID
184 } FSVolumeState;
185 
186 
187 typedef enum
188 {
189     FS_SOURCETYPE_EXTERNAL = 0, // Manual mounted external device
190     FS_SOURCETYPE_HFIO,         // Host file IO
191     FS_SOURCETYPE_MAX
192 } FSSourceType;
193 
194 
195 typedef struct
196 {
197     FSSourceType          type;
198     char                  path[FS_MAX_ARGPATH_SIZE];
199 } FSMountSource;
200 
201 PACKED_STRUCT_BEGIN
202 
203 
204 
205 /* File/Dir status */
206 typedef struct
207 {
208     FSFlag      flag;           /* flag bitmap */
209 
210     FSMode      permission;     /* access permissions */
211 
212     FSUserId    owner_id;       /* owner title id */
213 
214     FSGroupId   group_id;       /* owner group id */
215 
216     FSSize      size;           /* file size in bytes.
217                                    valid when entry is file. */
218     FSSize      alloc_size;     /* allocated file size in bytes.
219                                    valid when entry is file and FS_STAT_FLAG_SPRT_FILE_ALLOC_SIZE in flag is set */
220     FSBSize     quota_size;     /* total size of quota/partition to which the entry belongs
221                                    valid when FS_STAT_FLAG_SPRT_DIR_SIZE in flag is set */
222     u32         ent_id;         /* entry ID. valid when FS_STAT_FLAG_SPRT_ENTID in flag is set */
223 
224     FSTime      ctime;          /* last created time
225                                    valid when FS_STAT_FLAG_SPRT_CTIME in flag is set */
226     FSTime      mtime;          /* last modified time
227                                    valid when FS_STAT_FLAG_SPRT_MTIME in flag is set */
228 
229     u8          attributes[FS_STAT_ATTRIBUTES_SIZE];
230                                 /* FS-specific attribute field
231                                    valid when FS_STAT_FLAG_SPRT_ATTRIBUTES in flag is set */
232 } PACKED_STRUCT_ATTRIBUTE FSStat;
233 
234 /* Directory entry */
235 typedef struct
236 {
237     FSStat      stat;
238     char        name[FS_MAX_ENTNAME_SIZE + FS_MAX_ENTNAME_SIZE_PAD];
239 } PACKED_STRUCT_ATTRIBUTE FSDirEntry;
240 
241 PACKED_STRUCT_END
242 
243 
244 /* Callback prototype for asynchronous command */
245 typedef void (*FSAsyncCallback)(
246                     FSClient        *client,
247                     FSCmdBlock      *block,
248                     FSStatus        result,
249                     void            *context
250                     );
251 
252 
253 typedef struct
254 {
255     FSAsyncCallback        userCallback;
256     void                   *userContext;
257     OSMessageQueue*        ioMsgQueue;
258 } FSAsyncParams;
259 
260 
261 /* Callback prototype for error notification */
262 typedef void (*FSStateChangeCallback)(
263                     FSClient       *client,
264                     FSVolumeState  state,
265                     void           *context
266                     );
267 
268 
269 typedef struct
270 {
271     FSStateChangeCallback  userCallback;
272     void                   *userContext;
273     OSMessageQueue         *ioMsgQueue;
274 } FSStateChangeParams;
275 
276 
277 
278 PACKED_STRUCT_BEGIN
279 
280 typedef struct
281 {
282     void*               data; // FSAsyncResult or FSStateNoticeInfo
283     u32                 reserved;
284     u32                 reserved2;
285     OSFunctionType      type; // OSFunctionType must be the 4th member,
286                               // for compatibility with OSDeviceMessage.
287 } PACKED_STRUCT_ATTRIBUTE FSMessage;
288 
289 typedef struct
290 {
291     FSAsyncParams       userParams;
292     FSMessage           ioMsg;
293 
294     FSClient            *client;
295     FSCmdBlock          *block;
296     FSStatus            status;
297 } PACKED_STRUCT_ATTRIBUTE FSAsyncResult;
298 
299 typedef struct
300 {
301     FSStateChangeParams userParams;
302     FSMessage           ioMsg;
303 
304     FSClient            *client;
305     FSVolumeState       state;
306 } PACKED_STRUCT_ATTRIBUTE FSStateNoticeInfo;
307 
308 PACKED_STRUCT_END
309 
310 
311 /*---------------------------------------------------------------------------*
312  *
313  *    -- Returned Error Codes --
314  *
315  *---------------------------------------------------------------------------*/
316 
317 /* common error */
318 #define FS_STATUS_OK                    0
319 
320 #define FS_STATUS_ERROR_BASE            (0)
321 
322 #define FS_STATUS_CANCELED              (FS_STATUS_ERROR_BASE-1)    /* Command cancelled */
323 #define FS_STATUS_END                   (FS_STATUS_ERROR_BASE-2)    /* Indicates end of file / directory entry */
324 #define FS_STATUS_MAX                   (FS_STATUS_ERROR_BASE-3)    /* Reached to max number of file / directory / client handles / mount points */
325 #define FS_STATUS_ALREADY_OPEN          (FS_STATUS_ERROR_BASE-4)    /* Target is already opened or locked by another transaction */
326 #define FS_STATUS_EXISTS                (FS_STATUS_ERROR_BASE-5)    /* Target path already exists or not empty */
327 #define FS_STATUS_NOT_FOUND             (FS_STATUS_ERROR_BASE-6)    /* Target path is not found */
328 #define FS_STATUS_NOT_FILE              (FS_STATUS_ERROR_BASE-7)    /* Specified path is directory or quota instead of a file. */
329 #define FS_STATUS_NOT_DIR               (FS_STATUS_ERROR_BASE-8)    /* Specified path is file instead of a directory or a quota. */
330 #define FS_STATUS_ACCESS_ERROR          (FS_STATUS_ERROR_BASE-9)    /* Attempted to access file with bad file mode */
331 #define FS_STATUS_PERMISSION_ERROR      (FS_STATUS_ERROR_BASE-10)   /* Did not have permission to complete operation */
332 #define FS_STATUS_FILE_TOO_BIG          (FS_STATUS_ERROR_BASE-11)   /* Request would push the file over the size limit (not the quota limit). */
333 #define FS_STATUS_STORAGE_FULL          (FS_STATUS_ERROR_BASE-12)   /* Request would cause one of the ancestor directories to exceed its quota
334                                                                        / Or no free space left in storage */
335 #define FS_STATUS_JOURNAL_FULL          (FS_STATUS_ERROR_BASE-13)   /* Transaction journal is full, need to flush */
336 #define FS_STATUS_UNSUPPORTED_CMD       (FS_STATUS_ERROR_BASE-14)   /* Operation is not supported by file system */
337 
338 /* for only manual mount device */
339 #define FS_STATUS_MEDIA_NOT_READY       (FS_STATUS_ERROR_BASE-15)   /* Medium is not ready */
340 #define FS_STATUS_INVALID_MEDIA         (FS_STATUS_ERROR_BASE-16)   /* Medium is invalid */
341 #define FS_STATUS_MEDIA_ERROR           (FS_STATUS_ERROR_BASE-17)   /* Medium is in some bad condition */
342 #define FS_STATUS_DATA_CORRUPTED        (FS_STATUS_ERROR_BASE-18)   /* Data is corrupted */
343 #define FS_STATUS_WRITE_PROTECTED       (FS_STATUS_ERROR_BASE-19)   /* Medium is write protected */
344 
345 /* common fatal error */
346 #define FS_STATUS_FATAL_ERROR           (FS_STATUS_ERROR_BASE-1024) /* Internal resources ran short */
347 
348 /* Old definition; For build compatibility */
349 #define FS_STATUS_CANCELLED             FS_STATUS_CANCELED
350 
351 /* Error handling flag */
352 #define FS_RET_MAX                      0x0001
353 #define FS_RET_ALREADY_OPEN             0x0002
354 #define FS_RET_EXISTS                   0x0004
355 #define FS_RET_NOT_FOUND                0x0008
356 #define FS_RET_NOT_FILE                 0x0010
357 #define FS_RET_NOT_DIR                  0x0020
358 #define FS_RET_ACCESS_ERROR             0x0040
359 #define FS_RET_PERMISSION_ERROR         0x0080
360 #define FS_RET_FILE_TOO_BIG             0x0100
361 #define FS_RET_STORAGE_FULL             0x0200
362 #define FS_RET_UNSUPPORTED_CMD          0x0400
363 #define FS_RET_JOURNAL_FULL             0x0800
364 
365 /* FS_STATUS_OK, FS_STATUS_END, FS_STATUS_CANCELED and positive value can be returned always. */
366 #define FS_RET_NO_ERROR                 0x0000
367 
368 #define FS_RET_ALL_ERROR                (u32)(-1)
369 
370 
371 
372 
373 /* FSError */
374 #define FS_ERROR_OK                       0
375 
376 #define FS_ERROR_BASE                     (-196608)
377 /* FS service is not initialized */
378 #define FS_ERROR_NOT_INIT                 (FS_ERROR_BASE-1)     // -196609
379 /* File system or device was too busy */
380 #define FS_ERROR_BUSY                     (FS_ERROR_BASE-2)     // -196610
381 /* Command canceled */
382 #define FS_ERROR_CANCELED                 (FS_ERROR_BASE-3)     // -196611
383 /* Indicates the end of a directory */
384 #define FS_ERROR_END_OF_DIRECTORY         (FS_ERROR_BASE-4)     // -196612
385 /* Indicates the end of a file */
386 #define FS_ERROR_END_OF_FILE              (FS_ERROR_BASE-5)     // -196613
387 
388 /* Reached the max number of mount points */
389 #define FS_ERROR_MAX_MOUNTPOINTS          (FS_ERROR_BASE-16)    // -196624
390 /* Reached the max number of volumes */
391 #define FS_ERROR_MAX_VOLUMES              (FS_ERROR_BASE-17)    // -196625
392 /* Reached the max number of clients */
393 #define FS_ERROR_MAX_CLIENTS              (FS_ERROR_BASE-18)    // -196626
394 /* Reached the max number of file handles */
395 #define FS_ERROR_MAX_FILES                (FS_ERROR_BASE-19)    // -196627
396 /* Reached the max number of dir handles */
397 #define FS_ERROR_MAX_DIRS                 (FS_ERROR_BASE-20)    // -196628
398 /* Target is already opened or locked by another transaction */
399 #define FS_ERROR_ALREADY_OPEN             (FS_ERROR_BASE-21)    // -196629
400 /* Target path already exists */
401 #define FS_ERROR_ALREADY_EXISTS           (FS_ERROR_BASE-22)    // -196630
402 /* Target path is not found */
403 #define FS_ERROR_NOT_FOUND                (FS_ERROR_BASE-23)    // -196631
404 /* Target path is not empty */
405 #define FS_ERROR_NOT_EMPTY                (FS_ERROR_BASE-24)    // -196632
406 /* Attempted to access file with bad file mode */
407 #define FS_ERROR_ACCESS_ERROR             (FS_ERROR_BASE-25)    // -196633
408 /* Did not have permission to complete operation */
409 #define FS_ERROR_PERMISSION_ERROR         (FS_ERROR_BASE-26)    // -196634
410 /* Cannot complete transaction due to corrupted data block */
411 #define FS_ERROR_DATA_CORRUPTED           (FS_ERROR_BASE-27)    // -196635
412 /* Request would cause one of the ancestor directories to exceed its quota
413  * Or no free space left in storage */
414 #define FS_ERROR_STORAGE_FULL             (FS_ERROR_BASE-28)    // -196636
415 /* Transaction journal is full, need to flush */
416 #define FS_ERROR_JOURNAL_FULL             (FS_ERROR_BASE-29)    // -196637
417 
418 /* Operation is not available now */
419 #define FS_ERROR_UNAVAILABLE_CMD          (FS_ERROR_BASE-31)    // -196639
420 /* Operation is not supported by FS */
421 #define FS_ERROR_UNSUPPORTED_CMD          (FS_ERROR_BASE-32)    // -196640
422 /* Specified parameter is invalid */
423 #define FS_ERROR_INVALID_PARAM            (FS_ERROR_BASE-33)    // -196641
424 /* Specified path is invalid */
425 #define FS_ERROR_INVALID_PATH             (FS_ERROR_BASE-34)    // -196642
426 /* Specified buffer is invalid */
427 #define FS_ERROR_INVALID_BUFFER           (FS_ERROR_BASE-35)    // -196643
428 /* Specified alignment is invalid */
429 #define FS_ERROR_INVALID_ALIGNMENT        (FS_ERROR_BASE-36)    // -196644
430 /* Specified client handle is invalid */
431 #define FS_ERROR_INVALID_CLIENT_HANDLE    (FS_ERROR_BASE-37)    // -196645
432 /* Specified file handle is invalid */
433 #define FS_ERROR_INVALID_FILE_HANDLE      (FS_ERROR_BASE-38)    // -196646
434 /* Specified dir handle is invalid */
435 #define FS_ERROR_INVALID_DIR_HANDLE       (FS_ERROR_BASE-39)    // -196647
436 /* Specified path is a directory instead of a file. */
437 #define FS_ERROR_NOT_FILE                 (FS_ERROR_BASE-40)    // -196648
438 /* Specified path is a file instead of a directory. */
439 #define FS_ERROR_NOT_DIR                  (FS_ERROR_BASE-41)    // -196649
440 /* Request would push the file over the size limit (not the quota limit). */
441 #define FS_ERROR_FILE_TOO_BIG             (FS_ERROR_BASE-42)    // -196650
442 /* Attempted to access out of accessible area */
443 #define FS_ERROR_OUT_OF_RANGE             (FS_ERROR_BASE-43)    // -196651
444 /* Internal resources ran short */
445 #define FS_ERROR_OUT_OF_RESOURCES         (FS_ERROR_BASE-44)    // -196652
446 
447 /* Medium is not ready to use, user has to put medium correctly */
448 #define FS_ERROR_MEDIA_NOT_READY          (FS_ERROR_BASE-64)    // -196672
449 /* Medium is in some bad condition */
450 #define FS_ERROR_MEDIA_ERROR              (FS_ERROR_BASE-65)    // -196673
451 /* Medium is write protected */
452 #define FS_ERROR_WRITE_PROTECTED          (FS_ERROR_BASE-66)    // -196674
453 /* Medium is invalid */
454 #define FS_ERROR_INVALID_MEDIA            (FS_ERROR_BASE-67)    // -196675
455 
456 #define FS_ERROR_FATAL                    (FS_ERROR_BASE-1024)  // -197632
457 
458 
459 /*---------------------------------------------------------------------------*
460  *
461  *    -- Interface Function Prototypes --
462  *
463  *---------------------------------------------------------------------------*/
464 
465 /*---------------------------------------------------------------------------*
466   Name:         FSInit
467 
468   Description:  Initialize FS library.
469 
470   Arguments:    None.
471 
472   Returns:      None.
473  *---------------------------------------------------------------------------*/
474 void                FSInit( void );
475 
476 /*---------------------------------------------------------------------------*
477   Name:         FSShutdown
478 
479   Description:  Shutdown FS library.
480 
481   Arguments:    None.
482 
483   Returns:      None.
484  *---------------------------------------------------------------------------*/
485 void                FSShutdown( void );
486 
487 /*---------------------------------------------------------------------------*
488   Name:         FSAddClient
489 
490   Description:  Register a new client.
491 
492   Arguments:    client          Pointer to client buffer.
493 
494   Returns:      Result code :
495                   FS_STATUS_OK
496                   FS_STATUS_MAX
497  *---------------------------------------------------------------------------*/
498 FSStatus            FSAddClient(
499                         FSClient                *client,
500                         FSRetFlag               errHandling
501                         );
502 
503 
504 /*---------------------------------------------------------------------------*
505   Name:         FSDelClient
506 
507   Description:  Unregister a client.
508 
509   Arguments:    client          Pointer to client
510 
511   Returns:      Result code :
512                   FS_STATUS_OK
513  *---------------------------------------------------------------------------*/
514 FSStatus            FSDelClient(
515                         FSClient                *client,
516                         FSRetFlag               errHandling
517                         );
518 
519 
520 /*---------------------------------------------------------------------------*
521   Name:         FSGetClientNum
522 
523   Description:  Get number of client.
524 
525   Arguments:    None.
526 
527   Returns:      Number of registered clients.
528                 Non-negative value (>= 0)
529  *---------------------------------------------------------------------------*/
530 u32                 FSGetClientNum( void );
531 
532 
533 /*---------------------------------------------------------------------------*
534   Name:         FSInitCmdBlock
535 
536   Description:  Initialize command block.
537                 If command priority is set, it will be reset to the default value.
538 
539   Arguments:    block           Command block
540 
541   Returns:      None.
542  *---------------------------------------------------------------------------*/
543 void                FSInitCmdBlock( FSCmdBlock *block );
544 
545 
546 /*---------------------------------------------------------------------------*
547   Name:         FSCancelCommand
548 
549   Description:  Cancel specified command block which is still waiting.
550                 This cannot cancel already on going command.
551 
552   Arguments:    client          Pointer to client buffer
553                 block           Command block
554 
555   Returns:      None.
556 
557  *---------------------------------------------------------------------------*/
558 void                FSCancelCommand(
559                         FSClient                *client,
560                         FSCmdBlock              *block
561                         );
562 
563 /*---------------------------------------------------------------------------*
564   Name:         FSCancelAllCommands
565 
566   Description:  Cancel all waiting command blocks for specified client
567                 handle.
568                 This cannot cancel already ongoing command.
569 
570   Arguments:    client          Pointer to client buffer
571 
572   Returns:      None.
573 
574  *---------------------------------------------------------------------------*/
575 void                FSCancelAllCommands(
576                         FSClient                *client
577                         );
578 
579 
580 /*---------------------------------------------------------------------------*
581   Name:         FSSetUserData
582 
583   Description:  Set user data value to command block
584 
585   Arguments:    block           Command block
586                 userData        User data value
587 
588   Returns:      None.
589  *---------------------------------------------------------------------------*/
590 void                FSSetUserData(
591                         FSCmdBlock              *block,
592                         void                    *userData
593                         );
594 
595 
596 /*---------------------------------------------------------------------------*
597   Name:         FSGetUserData
598 
599   Description:  Get user data value from command block
600 
601   Arguments:    block           Command block
602 
603   Returns:      User data value
604                 If command block struct pointer is invalid, return NULL.
605  *---------------------------------------------------------------------------*/
606 void*               FSGetUserData(
607                         FSCmdBlock              *block
608                         );
609 
610 
611 /*---------------------------------------------------------------------------*
612   Name:         FSGetCurrentCmdBlock
613 
614   Description:  Get current command block being processed.
615 
616   Arguments:    client          Pointer to client buffer
617 
618   Returns:      Pointer to command block.
619                 NULL if no command is in flight, or specified client is invalid.
620  *---------------------------------------------------------------------------*/
621 FSCmdBlock*         FSGetCurrentCmdBlock(
622                         FSClient *client
623                         );
624 
625 
626 /*---------------------------------------------------------------------------*
627   Name:         FSGetVolumeState
628 
629   Description:  Get current state of specified volume.
630 
631   Arguments:    client          Pointer to client buffer
632 
633   Returns:      Volume status (FS_VOLSTATE_*)
634                 If client struct pointer is invalid, return FS_VOLSTATE_INVALID.
635  *---------------------------------------------------------------------------*/
636 FSVolumeState       FSGetVolumeState(
637                         FSClient                *client
638                     );
639 
640 
641 /*---------------------------------------------------------------------------*
642   Name:         FSSetStateChangeNotification
643 
644   Description:  Set notification parameters when media or fatal error is occurred
645                 and volume state is changed.
646 
647   Arguments:    ch              Client handle
648                 changeParams    Pointer to registered error notifications
649                                 You can unset notification by setting NULL here
650 
651   Returns:      None.
652  *---------------------------------------------------------------------------*/
653 void                FSSetStateChangeNotification(
654                         FSClient                *client,
655                         FSStateChangeParams     *changeParams
656                     );
657 
658 
659 /*---------------------------------------------------------------------------
660   Name:        FSGetAsyncResult
661 
662   Description: Get a pointer to FSAsyncResult including the FSMessage.
663                This function is used after the message notification is returned.
664 
665   Arguments:   ioMsg    Pointer to an FSMessage
666 
667   Returns:     pointer to an FSAsyncResult
668   *---------------------------------------------------------------------------*/
669 FSAsyncResult*      FSGetAsyncResult(FSMessage* ioMsg);
670 
671 
672 /*---------------------------------------------------------------------------
673   Name:        FSGetStateChangeInfo
674 
675   Description: Get a pointer to FSStateNoticeInfo included in the FSMessage.
676                This function is used after the message notification is returned.
677 
678   Arguments:   ioMsg    Pointer to an FSMessage
679 
680   Returns:     pointer to an FSStateNoticeInfo
681   *---------------------------------------------------------------------------*/
682 FSStateNoticeInfo*  FSGetStateChangeInfo(FSMessage* ioMsg);
683 
684 
685 /*---------------------------------------------------------------------------*
686   Name:         FSGetMountSource(Async)
687 
688   Description:  Find and get mount source list.
689                 This function is for manual mounted external devices,
690                 hfio volume and so on.
691 
692   Arguments:    client          Pointer to client buffer
693                 block           Command block
694                 type            Source type
695                 source          Pointer to mountable source
696 
697   Returns:      Result code :
698                   FS_STATUS_OK
699                   FS_STATUS_END
700                   FS_STATUS_MAX
701                   FS_STATUS_CANCELED
702 
703                   (Async API: Immediate return values)
704                   FS_STATUS_OK
705                   FS_STATUS_FATAL_ERROR
706  *---------------------------------------------------------------------------*/
707 FSStatus            FSGetMountSource(
708                         FSClient                *client,
709                         FSCmdBlock              *block,
710                         FSSourceType            type,
711                         FSMountSource           *source,
712                         FSRetFlag               errHandling
713                         );
714 FSStatus            FSGetMountSourceAsync(
715                         FSClient                *client,
716                         FSCmdBlock              *block,
717                         FSSourceType            type,
718                         FSMountSource           *source,
719                         FSRetFlag               errHandling,
720                         const FSAsyncParams     *asyncParams
721                         );
722 
723 
724 /*---------------------------------------------------------------------------*
725   Name:         FSGetMountSourceNext(Async)
726 
727   Description:  Find and get next mount source list.
728                 This function is for manual mounted external devices,
729                 hfio volume and so on.
730 
731   Arguments:    client          Pointer to client buffer
732                 block           Command block
733                 source          Pointer to mountable source
734 
735   Returns:      Result code :
736                   FS_STATUS_OK
737                   FS_STATUS_END
738                   FS_STATUS_MAX
739                   FS_STATUS_CANCELED
740 
741                   (Async API: Immediate return values)
742                   FS_STATUS_OK
743                   FS_STATUS_FATAL_ERROR
744  *---------------------------------------------------------------------------*/
745 FSStatus            FSGetMountSourceNext(
746                         FSClient                *client,
747                         FSCmdBlock              *block,
748                         FSMountSource           *source,
749                         FSRetFlag               errHandling
750                         );
751 FSStatus            FSGetMountSourceNextAsync(
752                         FSClient                *client,
753                         FSCmdBlock              *block,
754                         FSMountSource           *source,
755                         FSRetFlag               errHandling,
756                         const FSAsyncParams     *asyncParams
757                         );
758 
759 
760 /*---------------------------------------------------------------------------*
761   Name:         FSMount(Async)
762 
763   Description:  Mount device or source path and return mount point path.
764                 This function is for manual mounted external devices,
765                 hfio volume and so on.
766                 No need to call for device stored application and save data since they are pre-mounted.
767 
768   Arguments:    client          Pointer to client buffer
769                 block           Command block
770                 source          Mountable source structure.
771                 target          Buffer for target mount point path.
772                 bytes           Length of target buffer.
773                                 This must be greater than or equal to
774                                 FS_MAX_MOUNTPATH_SIZE.
775 
776 
777   Returns:      Result code :
778                   FS_STATUS_OK
779                   FS_STATUS_CANCELED
780                   FS_STATUS_NOT_FOUND
781                   FS_STATUS_EXISTS
782                   FS_STATUS_MEDIA_ERROR
783 
784                   (Async API: Immediate return values)
785                   FS_STATUS_OK
786                   FS_STATUS_FATAL_ERROR
787  *---------------------------------------------------------------------------*/
788 FSStatus            FSMount(
789                         FSClient                *client,
790                         FSCmdBlock              *block,
791                         FSMountSource           *source,
792                         char                    *target,
793                         u32                     bytes,
794                         FSRetFlag               errHandling
795                         );
796 FSStatus            FSMountAsync(
797                         FSClient                *client,
798                         FSCmdBlock              *block,
799                         FSMountSource           *source,
800                         char                    *target,
801                         u32                     bytes,
802                         FSRetFlag               errHandling,
803                         const FSAsyncParams     *asyncParams
804                         );
805 
806 /*---------------------------------------------------------------------------*
807   Name:         FSUnmount(Async)
808 
809   Description:  Unmount volume to specified mount point path.
810                 Actual device to mount is abstracted.
811                 This function is for manual mounted external devices,
812                 hfio volume and so on.
813                 No need to call for device stored application and save data since they are pre-mounted.
814 
815   Arguments:    client          Pointer to client buffer
816                 block           Command block
817                 target          Target mount point path.
818 
819   Returns:      Result code :
820                   FS_STATUS_OK
821                   FS_STATUS_CANCELED
822                   FS_STATUS_NOT_FOUND
823                   FS_STATUS_MEDIA_ERROR
824 
825                   (Async API: Immediate return values)
826                   FS_STATUS_OK
827                   FS_STATUS_FATAL_ERROR
828  *---------------------------------------------------------------------------*/
829 FSStatus            FSUnmount(
830                         FSClient                *client,
831                         FSCmdBlock              *block,
832                         const char              *target,
833                         FSRetFlag               errHandling
834                         );
835 FSStatus            FSUnmountAsync(
836                         FSClient                *client,
837                         FSCmdBlock              *block,
838                         const char              *target,
839                         FSRetFlag               errHandling,
840                         const FSAsyncParams     *asyncParams
841                         );
842 
843 /*---------------------------------------------------------------------------*
844   Name:         FSChangeDir(Async)
845 
846   Description:  Change directory
847 
848   Arguments:    client          Pointer to client buffer
849                 block           Command block
850                 path            Directory path.
851                                 Length must be less than FS_MAX_ARGPATH_SIZE.
852 
853   Returns:      Result code :
854                   FS_STATUS_OK
855                   FS_STATUS_CANCELED
856 
857                   (Async API: Immediate return values)
858                   FS_STATUS_OK
859                   FS_STATUS_FATAL_ERROR
860  *---------------------------------------------------------------------------*/
861 FSStatus            FSChangeDir(
862                         FSClient                *client,
863                         FSCmdBlock              *block,
864                         const char              *path,
865                         FSRetFlag               errHandling
866                         );
867 FSStatus            FSChangeDirAsync(
868                         FSClient                *client,
869                         FSCmdBlock              *block,
870                         const char              *path,
871                         FSRetFlag               errHandling,
872                         const FSAsyncParams     *asyncParams
873                         );
874 
875 /*---------------------------------------------------------------------------*
876   Name:         FSOpenFile(Async)
877 
878   Description:  Open file
879 
880   Arguments:    client          Pointer to client buffer
881                 block           Command block
882                 path            File path.
883                                 Length must be less than FS_MAX_ARGPATH_SIZE.
884                 mode            Access mode
885                 fileHandle     Pointer to the handle of file stream
886 
887   Returns:      Result code :
888                   FS_STATUS_OK
889                   FS_STATUS_CANCELED
890                   FS_STATUS_ALREADY_OPEN
891                   FS_STATUS_NOT_FOUND
892                   FS_STATUS_NOT_FILE
893                   FS_STATUS_MAX
894                   FS_STATUS_ACCESS_ERROR
895                   FS_STATUS_PERMISSION_ERROR
896                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
897 
898                   (Async API: Immediate return values)
899                   FS_STATUS_OK
900                   FS_STATUS_FATAL_ERROR
901  *---------------------------------------------------------------------------*/
902 FSStatus            FSOpenFile(
903                         FSClient                *client,
904                         FSCmdBlock              *block,
905                         const char              *path,
906                         const char              *mode,
907                         FSFileHandle            *fileHandle,
908                         FSRetFlag               errHandling
909                         );
910 FSStatus            FSOpenFileAsync(
911                         FSClient                *client,
912                         FSCmdBlock              *block,
913                         const char              *path,
914                         const char              *mode,
915                         FSFileHandle            *fileHandle,
916                         FSRetFlag               errHandling,
917                         const FSAsyncParams     *asyncParams
918                         );
919 
920 
921 /*---------------------------------------------------------------------------*
922   Name:         FSCloseFile(Async)
923 
924   Description:  Close file
925 
926   Arguments:    client          Pointer to client buffer
927                 block           Command block
928                 fileHandle      Handle of file stream
929 
930   Returns:      Result code :
931                   FS_STATUS_OK
932                   FS_STATUS_CANCELED
933                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
934 
935                   (Async API: Immediate return values)
936                   FS_STATUS_OK
937                   FS_STATUS_FATAL_ERROR
938  *---------------------------------------------------------------------------*/
939 FSStatus            FSCloseFile(
940                         FSClient                *client,
941                         FSCmdBlock              *block,
942                         FSFileHandle            fileHandle,
943                         FSRetFlag               errHandling
944                         );
945 FSStatus            FSCloseFileAsync(
946                         FSClient                *client,
947                         FSCmdBlock              *block,
948                         FSFileHandle            fileHandle,
949                         FSRetFlag               errHandling,
950                         const FSAsyncParams     *asyncParams
951                         );
952 
953 /*---------------------------------------------------------------------------*
954   Name:         FSReadFile(Async)
955 
956   Description:  Read file
957 
958   Arguments:    client          Pointer to client buffer
959                 block           Command block
960                 dest            Pointer to data array to read into
961                 size            Size of one array member [bytes]
962                 count           Number of array members to read
963                 fileHandle      Handle of file stream
964 
965   Returns:      Result code :
966                   Non-negative value (>= 0) Number of elements read.
967                   FS_STATUS_CANCELED
968                   FS_STATUS_ACCESS_ERROR
969                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
970 
971                   (Async API: Immediate return values)
972                   FS_STATUS_OK
973                   FS_STATUS_FATAL_ERROR
974  *---------------------------------------------------------------------------*/
975 FSStatus            FSReadFile(
976                         FSClient                *client,
977                         FSCmdBlock              *block,
978                         void                    *dest,
979                         FSSize                  size,
980                         FSCount                 count,
981                         FSFileHandle            fileHandle,
982                         FSFlag                  flag,
983                         FSRetFlag               errHandling
984                         );
985 FSStatus            FSReadFileAsync(
986                         FSClient                *client,
987                         FSCmdBlock              *block,
988                         void                    *dest,
989                         FSSize                  size,
990                         FSCount                 count,
991                         FSFileHandle            fileHandle,
992                         FSFlag                  flag,
993                         FSRetFlag               errHandling,
994                         const FSAsyncParams     *asyncParams
995                         );
996 
997 /*---------------------------------------------------------------------------*
998   Name:         FSWriteFile(Async)
999 
1000   Description:  Write file
1001 
1002   Arguments:    client          Pointer to client buffer
1003                 block           Command block
1004                 source          Pointer to data array to write into
1005                 size            Size of one array member [bytes]
1006                 count           Number of array members to read
1007                 fileHandle      Handle of file stream
1008 
1009   Returns:      Result code :
1010                   Non-negative value (>= 0) Number of elements written.
1011                   FS_STATUS_CANCELED
1012                   FS_STATUS_ACCESS_ERROR
1013                   FS_STATUS_FILE_TOO_BIG
1014                   FS_STATUS_STORAGE_FULL
1015                   FS_STATUS_JOURNAL_FULL
1016                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1017 
1018                   (Async API: Immediate return values)
1019                   FS_STATUS_OK
1020                   FS_STATUS_FATAL_ERROR
1021  *---------------------------------------------------------------------------*/
1022 FSStatus            FSWriteFile(
1023                         FSClient                *client,
1024                         FSCmdBlock              *block,
1025                         const void              *source,
1026                         FSSize                  size,
1027                         FSCount                 count,
1028                         FSFileHandle            fileHandle,
1029                         FSFlag                  flag,
1030                         FSRetFlag               errHandling
1031                         );
1032 FSStatus            FSWriteFileAsync(
1033                         FSClient                *client,
1034                         FSCmdBlock              *block,
1035                         const void              *source,
1036                         FSSize                  size,
1037                         FSCount                 count,
1038                         FSFileHandle            fileHandle,
1039                         FSFlag                  flag,
1040                         FSRetFlag               errHandling,
1041                         const FSAsyncParams     *asyncParams
1042                         );
1043 
1044 /*---------------------------------------------------------------------------*
1045   Name:         FSReadFileWithPos(Async)
1046 
1047   Description:  Read file
1048 
1049   Arguments:    client          Pointer to client buffer
1050                 block           Command block
1051                 dest            Pointer to data array to read into
1052                 size            Size of one array member [bytes]
1053                 count           Number of array members to read
1054                 fpos            Stating file position
1055                 fileHandle      Handle of file stream
1056 
1057   Returns:      Result code :
1058                   Non-negative value (>= 0) Number of elements read.
1059                   FS_STATUS_CANCELED
1060                   FS_STATUS_ACCESS_ERROR
1061                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1062 
1063                   (Async API: Immediate return values)
1064                   FS_STATUS_OK
1065                   FS_STATUS_FATAL_ERROR
1066  *---------------------------------------------------------------------------*/
1067 FSStatus            FSReadFileWithPos(
1068                         FSClient                *client,
1069                         FSCmdBlock              *block,
1070                         void                    *dest,
1071                         FSSize                  size,
1072                         FSCount                 count,
1073                         FSFilePosition          fpos,
1074                         FSFileHandle            fileHandle,
1075                         FSFlag                  flag,
1076                         FSRetFlag               errHandling
1077                         );
1078 FSStatus            FSReadFileWithPosAsync(
1079                         FSClient                *client,
1080                         FSCmdBlock              *block,
1081                         void                    *dest,
1082                         FSSize                  size,
1083                         FSCount                 count,
1084                         FSFilePosition          fpos,
1085                         FSFileHandle            fileHandle,
1086                         FSFlag                  flag,
1087                         FSRetFlag               errHandling,
1088                         const FSAsyncParams     *asyncParams
1089                         );
1090 
1091 /*---------------------------------------------------------------------------*
1092   Name:         FSWriteFileWithPos(Async)
1093 
1094   Description:  Write file
1095 
1096   Arguments:    client          Pointer to client buffer
1097                 block           Command block
1098                 source          Pointer to data array to write into
1099                 size            Size of one array member [bytes]
1100                 count           Number of array members to read
1101                 fpos            Stating file position
1102                 fileHandle      Handle of file stream
1103 
1104   Returns:      Result code :
1105                   Non-negative value (>= 0) Number of elements written.
1106                   FS_STATUS_CANCELED
1107                   FS_STATUS_ACCESS_ERROR
1108                   FS_STATUS_FILE_TOO_BIG
1109                   FS_STATUS_STORAGE_FULL
1110                   FS_STATUS_JOURNAL_FULL
1111                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1112 
1113                   (Async API: Immediate return values)
1114                   FS_STATUS_OK
1115                   FS_STATUS_FATAL_ERROR
1116  *---------------------------------------------------------------------------*/
1117 FSStatus            FSWriteFileWithPos(
1118                         FSClient                *client,
1119                         FSCmdBlock              *block,
1120                         const void              *source,
1121                         FSSize                  size,
1122                         FSCount                 count,
1123                         FSFilePosition          fpos,
1124                         FSFileHandle            fileHandle,
1125                         FSFlag                  flag,
1126                         FSRetFlag               errHandling
1127                         );
1128 FSStatus            FSWriteFileWithPosAsync(
1129                         FSClient                *client,
1130                         FSCmdBlock              *block,
1131                         const void              *source,
1132                         FSSize                  size,
1133                         FSCount                 count,
1134                         FSFilePosition          fpos,
1135                         FSFileHandle            fileHandle,
1136                         FSFlag                  flag,
1137                         FSRetFlag               errHandling,
1138                         const FSAsyncParams     *asyncParams
1139                         );
1140 
1141 /*---------------------------------------------------------------------------*
1142   Name:         FSAppendFile(Async)
1143 
1144   Description:  Append file
1145 
1146   Arguments:    client          Pointer to client buffer
1147                 block           Command block
1148                 size            Size of one array member [bytes]
1149                 count           Number of array members to append
1150                 fileHandle      Handle of file stream
1151 
1152   Returns:      Result code :
1153                   Non-negative value (>= 0) Number of elements appended.
1154                   FS_STATUS_CANCELED
1155                   FS_STATUS_ACCESS_ERROR
1156                   FS_STATUS_FILE_TOO_BIG
1157                   FS_STATUS_STORAGE_FULL
1158                   FS_STATUS_JOURNAL_FULL
1159                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1160 
1161                   (Async API: Immediate return values)
1162                   FS_STATUS_OK
1163                   FS_STATUS_FATAL_ERROR
1164  *---------------------------------------------------------------------------*/
1165 FSStatus            FSAppendFile(
1166                         FSClient                *client,
1167                         FSCmdBlock              *block,
1168                         FSSize                  size,
1169                         FSCount                 count,
1170                         FSFileHandle            fileHandle,
1171                         FSRetFlag               errHandling
1172                         );
1173 FSStatus            FSAppendFileAsync(
1174                         FSClient                *client,
1175                         FSCmdBlock              *block,
1176                         FSSize                  size,
1177                         FSCount                 count,
1178                         FSFileHandle            fileHandle,
1179                         FSRetFlag               errHandling,
1180                         const FSAsyncParams     *asyncParams
1181                         );
1182 
1183 /*---------------------------------------------------------------------------*
1184   Name:         FSTruncateFile(Async)
1185 
1186   Description:  Truncate file at file position
1187 
1188   Arguments:    client          Pointer to client buffer
1189                 block           Command block
1190                 fileHandle      Handle of file stream
1191 
1192   Returns:      Result code :
1193                   FS_STATUS_OK
1194                   FS_STATUS_CANCELED
1195                   FS_STATUS_ACCESS_ERROR
1196                   FS_STATUS_FILE_TOO_BIG
1197                   FS_STATUS_STORAGE_FULL
1198                   FS_STATUS_JOURNAL_FULL
1199                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1200 
1201                   (Async API: Immediate return values)
1202                   FS_STATUS_OK
1203                   FS_STATUS_FATAL_ERROR
1204  *---------------------------------------------------------------------------*/
1205 FSStatus            FSTruncateFile(
1206                         FSClient                *client,
1207                         FSCmdBlock              *block,
1208                         FSFileHandle            fileHandle,
1209                         FSRetFlag               errHandling
1210                         );
1211 FSStatus            FSTruncateFileAsync(
1212                         FSClient                *client,
1213                         FSCmdBlock              *block,
1214                         FSFileHandle            fileHandle,
1215                         FSRetFlag               errHandling,
1216                         const FSAsyncParams     *asyncParams
1217                         );
1218 
1219 /*---------------------------------------------------------------------------*
1220   Name:         FSFlushFile(Async)
1221 
1222   Description:  Flush file
1223                 It is for only for file system supporting file caching feature.
1224                 The other file systems are return FS_STATUS_OK.
1225 
1226   Arguments:    client          Pointer to client buffer
1227                 block           Command block
1228                 fileHandle      Handle of file stream
1229 
1230   Returns:      Result code :
1231                   FS_STATUS_OK
1232                   FS_STATUS_CANCELED
1233                   FS_STATUS_ACCESS_ERROR
1234                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1235 
1236                   (Async API: Immediate return values)
1237                   FS_STATUS_OK
1238                   FS_STATUS_FATAL_ERROR
1239  *---------------------------------------------------------------------------*/
1240 FSStatus            FSFlushFile(
1241                         FSClient                *client,
1242                         FSCmdBlock              *block,
1243                         FSFileHandle            fileHandle,
1244                         FSRetFlag               errHandling
1245                         );
1246 FSStatus            FSFlushFileAsync(
1247                         FSClient                *client,
1248                         FSCmdBlock              *block,
1249                         FSFileHandle            fileHandle,
1250                         FSRetFlag               errHandling,
1251                         const FSAsyncParams     *asyncParams
1252                         );
1253 
1254 /*---------------------------------------------------------------------------*
1255   Name:         FSGetPosFile(Async)
1256 
1257   Description:  Get file position
1258 
1259   Arguments:    client          Pointer to client buffer
1260                 block           Command block
1261                 fileHandle      Handle of file stream
1262                 returnedFpos    Pointer to file position
1263 
1264   Returns:      Result code :
1265                   FS_STATUS_OK
1266                   FS_STATUS_CANCELED
1267                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1268 
1269                   (Async API: Immediate return values)
1270                   FS_STATUS_OK
1271                   FS_STATUS_FATAL_ERROR
1272  *---------------------------------------------------------------------------*/
1273 FSStatus            FSGetPosFile(
1274                         FSClient                *client,
1275                         FSCmdBlock              *block,
1276                         FSFileHandle            fileHandle,
1277                         FSFilePosition          *returnedFpos,
1278                         FSRetFlag               errHandling
1279                         );
1280 FSStatus            FSGetPosFileAsync(
1281                         FSClient                *client,
1282                         FSCmdBlock              *block,
1283                         FSFileHandle            fileHandle,
1284                         FSFilePosition          *returnedFpos,
1285                         FSRetFlag               errHandling,
1286                         const FSAsyncParams     *asyncParams
1287                         );
1288 
1289 /*---------------------------------------------------------------------------*
1290   Name:         FSSetPosFile(Async)
1291 
1292   Description:  Set file position
1293 
1294   Arguments:    client          Pointer to client buffer
1295                 block           Command block
1296                 fileHandle      Handle of file stream
1297                 fpos            file position
1298 
1299   Returns:      Result code :
1300                   FS_STATUS_OK
1301                   FS_STATUS_CANCELED
1302                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1303 
1304                   (Async API: Immediate return values)
1305                   FS_STATUS_OK
1306                   FS_STATUS_FATAL_ERROR
1307  *---------------------------------------------------------------------------*/
1308 FSStatus           FSSetPosFile(
1309                         FSClient                *client,
1310                         FSCmdBlock              *block,
1311                         FSFileHandle            fileHandle,
1312                         FSFilePosition          fpos,
1313                         FSRetFlag               errHandling
1314                         );
1315 FSStatus           FSSetPosFileAsync(
1316                         FSClient                *client,
1317                         FSCmdBlock              *block,
1318                         FSFileHandle            fileHandle,
1319                         FSFilePosition          fpos,
1320                         FSRetFlag               errHandling,
1321                         const FSAsyncParams     *asyncParams
1322                         );
1323 
1324 /*---------------------------------------------------------------------------*
1325   Name:         FSGetStatFile(Async)
1326 
1327   Description:  Get file status
1328 
1329   Arguments:    client          Pointer to client buffer
1330                 block           Command block
1331                 fileHandle      Handle of file stream
1332                 returnedStat    Pointer to file status
1333 
1334   Returns:      Result code :
1335                   FS_STATUS_OK
1336                   FS_STATUS_CANCELED
1337                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1338 
1339                   (Async API: Immediate return values)
1340                   FS_STATUS_OK
1341                   FS_STATUS_FATAL_ERROR
1342  *---------------------------------------------------------------------------*/
1343 FSStatus            FSGetStatFile(
1344                         FSClient                *client,
1345                         FSCmdBlock              *block,
1346                         FSFileHandle            fileHandle,
1347                         FSStat                  *returnedStat,
1348                         FSRetFlag               errHandling
1349                         );
1350 FSStatus            FSGetStatFileAsync(
1351                         FSClient                *client,
1352                         FSCmdBlock              *block,
1353                         FSFileHandle            fileHandle,
1354                         FSStat                  *returnedStat,
1355                         FSRetFlag               errHandling,
1356                         const FSAsyncParams     *asyncParams
1357                         );
1358 
1359 /*---------------------------------------------------------------------------*
1360   Name:         FSIsEof(Async)
1361 
1362   Description:  Check if the current file position is at the end of file (EOF).
1363 
1364   Arguments:    client          Pointer to client buffer
1365                 block           Command block
1366                 fileHandle      Handle of file stream
1367 
1368   Returns:      Result code :
1369                   FS_STATUS_OK
1370                   FS_STATUS_CANCELED
1371                   FS_STATUS_END
1372                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1373 
1374                   (Async API: Immediate return values)
1375                   FS_STATUS_OK
1376                   FS_STATUS_FATAL_ERROR
1377  *---------------------------------------------------------------------------*/
1378 FSStatus            FSIsEof(
1379                         FSClient                *client,
1380                         FSCmdBlock              *block,
1381                         FSFileHandle            fileHandle,
1382                         FSRetFlag               errHandling
1383                         );
1384 FSStatus            FSIsEofAsync(
1385                         FSClient                *client,
1386                         FSCmdBlock              *block,
1387                         FSFileHandle            fileHandle,
1388                         FSRetFlag               errHandling,
1389                         const FSAsyncParams     *asyncParams
1390                         );
1391 
1392 
1393 /*---------------------------------------------------------------------------*
1394   Name:         FSOpenDir(Async)
1395 
1396   Description:  Open directory and creates directory stream
1397 
1398   Arguments:    client          Pointer to client buffer
1399                 block           Command block
1400                 path            Directory path.
1401                                 Length must be less than FS_MAX_ARGPATH_SIZE.
1402                 dirHandle       Pointer to the handle of directory stream
1403 
1404   Returns:      Result code :
1405                   FS_STATUS_OK
1406                   FS_STATUS_CANCELED
1407                   FS_STATUS_NOT_FOUND
1408                   FS_STATUS_NOT_DIR
1409                   FS_STATUS_MAX_HANDLES
1410                   FS_STATUS_PERMISSION_ERROR
1411                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1412 
1413                   (Async API: Immediate return values)
1414                   FS_STATUS_OK
1415                   FS_STATUS_FATAL_ERROR
1416  *---------------------------------------------------------------------------*/
1417 FSStatus            FSOpenDir(
1418                         FSClient                *client,
1419                         FSCmdBlock              *block,
1420                         const char              *path,
1421                         FSDirHandle             *dirHandle,
1422                         FSRetFlag               errHandling
1423                         );
1424 FSStatus            FSOpenDirAsync(
1425                         FSClient                *client,
1426                         FSCmdBlock              *block,
1427                         const char              *path,
1428                         FSDirHandle             *dirHandle,
1429                         FSRetFlag               errHandling,
1430                         const FSAsyncParams     *asyncParams
1431                         );
1432 
1433 /*---------------------------------------------------------------------------*
1434   Name:         FSCloseDir(Async)
1435 
1436   Description:  Close directory
1437 
1438   Arguments:    client          Pointer to client buffer
1439                 block           Command block
1440                 dirHandle       Handle of directory stream
1441 
1442   Returns:      Result code :
1443                   FS_STATUS_OK
1444                   FS_STATUS_CANCELED
1445                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1446 
1447                   (Async API: Immediate return values)
1448                   FS_STATUS_OK
1449                   FS_STATUS_FATAL_ERROR
1450  *---------------------------------------------------------------------------*/
1451 FSStatus            FSCloseDir(
1452                         FSClient                *client,
1453                         FSCmdBlock              *block,
1454                         FSDirHandle             dirHandle,
1455                         FSRetFlag               errHandling
1456                         );
1457 FSStatus            FSCloseDirAsync(
1458                         FSClient                *client,
1459                         FSCmdBlock              *block,
1460                         FSDirHandle             dirHandle,
1461                         FSRetFlag               errHandling,
1462                         const FSAsyncParams     *asyncParams
1463                         );
1464 
1465 /*---------------------------------------------------------------------------*
1466   Name:         FSReadDir(Async)
1467 
1468   Description:  Read directory entry name and status
1469 
1470   Arguments:    client          Pointer to client buffer
1471                 block           Command block
1472                 dirHandle       Handle of directory stream
1473                 returndDirEntry information of entry
1474 
1475   Returns:      Result code :
1476                   FS_STATUS_OK
1477                   FS_STATUS_CANCELED
1478                   FS_STATUS_END
1479                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1480 
1481                   (Async API: Immediate return values)
1482                   FS_STATUS_OK
1483                   FS_STATUS_FATAL_ERROR
1484  *---------------------------------------------------------------------------*/
1485 FSStatus            FSReadDir(
1486                         FSClient                *client,
1487                         FSCmdBlock              *block,
1488                         FSDirHandle             dirHandle,
1489                         FSDirEntry              *returnedDirEntry,
1490                         FSRetFlag               errHandling
1491                         );
1492 FSStatus            FSReadDirAsync(
1493                         FSClient                *client,
1494                         FSCmdBlock              *block,
1495                         FSDirHandle             dirHandle,
1496                         FSDirEntry              *returnedDirEntry,
1497                         FSRetFlag               errHandling,
1498                         const FSAsyncParams     *asyncParams
1499                         );
1500 
1501 /*---------------------------------------------------------------------------*
1502   Name:         FSRewindDir(Async)
1503 
1504   Description:  Rewind directory stream
1505 
1506   Arguments:    client          Pointer to client buffer
1507                 block           Command block
1508                 dirHandle       Handle of directory stream
1509 
1510   Returns:      Result code :
1511                   FS_STATUS_OK
1512                   FS_STATUS_CANCELED
1513                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1514 
1515                   (Async API: Immediate return values)
1516                   FS_STATUS_OK
1517                   FS_STATUS_FATAL_ERROR
1518  *---------------------------------------------------------------------------*/
1519 FSStatus            FSRewindDir(
1520                         FSClient                *client,
1521                         FSCmdBlock              *block,
1522                         FSDirHandle             dirHandle,
1523                         FSRetFlag               errHandling
1524                         );
1525 FSStatus            FSRewindDirAsync(
1526                         FSClient                *client,
1527                         FSCmdBlock              *block,
1528                         FSDirHandle             dirHandle,
1529                         FSRetFlag               errHandling,
1530                         const FSAsyncParams     *asyncParams
1531                         );
1532 
1533 /*---------------------------------------------------------------------------*
1534   Name:         FSGetCwd(Async)
1535 
1536   Description:  Get current work directory path.
1537 
1538   Arguments:    client          Pointer to client buffer
1539                 block           Command block
1540                 returnedPath    Pointer to path buffer
1541                 bytes           Length of path buffer.
1542                                 This must be greater than or equal to
1543                                 FS_MAX_FULLPATH_SIZE.
1544 
1545   Returns:      Result code :
1546                   FS_STATUS_OK
1547                   FS_STATUS_CANCELED
1548 
1549                   (Async API: Immediate return values)
1550                   FS_STATUS_OK
1551                   FS_STATUS_FATAL_ERROR
1552  *---------------------------------------------------------------------------*/
1553 FSStatus            FSGetCwd(
1554                         FSClient                *client,
1555                         FSCmdBlock              *block,
1556                         char                    *returnedPath,
1557                         u32                     bytes,
1558                         FSRetFlag               errHandling
1559                         );
1560 FSStatus            FSGetCwdAsync(
1561                         FSClient                *client,
1562                         FSCmdBlock              *block,
1563                         char                    *returnedPath,
1564                         u32                     bytes,
1565                         FSRetFlag               errHandling,
1566                         const FSAsyncParams     *asyncParams
1567                         );
1568 
1569 /*---------------------------------------------------------------------------*
1570   Name:         FSMakeDir(Async)
1571 
1572   Description:  Create directory.
1573 
1574   Arguments:    client          Pointer to client buffer
1575                 block           Command block
1576                 path            Directory path to create.
1577 
1578   Returns:      Result code :
1579                   FS_STATUS_OK
1580                   FS_STATUS_CANCELED
1581                   FS_STATUS_EXISTS
1582                   FS_STATUS_NOT_FOUND
1583                   FS_STATUS_PERMISSION_ERROR
1584                   FS_STATUS_UNSUPPORTED_CMD
1585                   FS_STATUS_STORAGE_FULL
1586                   FS_STATUS_JOURNAL_FULL
1587                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1588 
1589                   (Async API: Immediate return values)
1590                   FS_STATUS_OK
1591                   FS_STATUS_FATAL_ERROR
1592  *---------------------------------------------------------------------------*/
1593 FSStatus            FSMakeDir(
1594                         FSClient                *client,
1595                         FSCmdBlock              *block,
1596                         const char              *path,
1597                         FSRetFlag               errHandling
1598                         );
1599 FSStatus            FSMakeDirAsync(
1600                         FSClient                *client,
1601                         FSCmdBlock              *block,
1602                         const char              *path,
1603                         FSRetFlag               errHandling,
1604                         const FSAsyncParams     *asyncParams
1605                         );
1606 
1607 /*---------------------------------------------------------------------------*
1608   Name:         FSRemove(Async)
1609 
1610   Description:  Remove entry.
1611 
1612   Arguments:    client          Pointer to client buffer
1613                 block           Command block
1614                 path            Directory path to open.
1615 
1616   Returns:      Result code :
1617                   FS_STATUS_OK
1618                   FS_STATUS_CANCELED
1619                   FS_STATUS_NOT_FOUND
1620                   FS_STATUS_PERMISSION_ERROR
1621                   FS_STATUS_ALREADY_OPEN
1622                   FS_STATUS_UNSUPPORTED_CMD
1623                   FS_STATUS_STORAGE_FULL
1624                   FS_STATUS_JOURNAL_FULL
1625                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1626 
1627                   (Async API: Immediate return values)
1628                   FS_STATUS_OK
1629                   FS_STATUS_FATAL_ERROR
1630  *---------------------------------------------------------------------------*/
1631 FSStatus            FSRemove(
1632                         FSClient                *client,
1633                         FSCmdBlock              *block,
1634                         const char              *path,
1635                         FSRetFlag               errHandling
1636                         );
1637 FSStatus            FSRemoveAsync(
1638                         FSClient                *client,
1639                         FSCmdBlock              *block,
1640                         const char              *path,
1641                         FSRetFlag               errHandling,
1642                         const FSAsyncParams     *asyncParams
1643                         );
1644 
1645 /*---------------------------------------------------------------------------*
1646   Name:         FSRename(Async)
1647 
1648   Description:  Rename entry.
1649 
1650   Arguments:    client          Pointer to client buffer
1651                 block           Command block
1652                 oldPath         Old entry path.
1653                 newPath         New entry path.
1654 
1655   Returns:      Result code :
1656                   FS_STATUS_OK
1657                   FS_STATUS_CANCELED
1658                   FS_STATUS_NOT_FOUND
1659                   FS_STATUS_PERMISSION_ERROR
1660                   FS_STATUS_ALREADY_EXISTS
1661                   FS_STATUS_ALREADY_OPEN
1662                   FS_STATUS_UNSUPPORTED_CMD
1663                   FS_STATUS_STORAGE_FULL
1664                   FS_STATUS_JOURNAL_FULL
1665                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1666 
1667                   (Async API: Immediate return values)
1668                   FS_STATUS_OK
1669                   FS_STATUS_FATAL_ERROR
1670  *---------------------------------------------------------------------------*/
1671 FSStatus            FSRename(
1672                         FSClient                *client,
1673                         FSCmdBlock              *block,
1674                         const char              *oldPath,
1675                         const char              *newPath,
1676                         FSRetFlag               errHandling
1677                         );
1678 FSStatus            FSRenameAsync(
1679                         FSClient                *client,
1680                         FSCmdBlock              *block,
1681                         const char              *oldPath,
1682                         const char              *newPath,
1683                         FSRetFlag               errHandling,
1684                         const FSAsyncParams     *asyncParams
1685                         );
1686 
1687 /*---------------------------------------------------------------------------*
1688   Name:         FSMakeQuota(Async)
1689 
1690   Description:  Create quota.
1691 
1692   Arguments:    client          Pointer to client buffer
1693                 block           Command block
1694                 path            Directory path to create.
1695                 mode            Access mode
1696 
1697   Returns:      Result code :
1698                   FS_STATUS_OK
1699                   FS_STATUS_CANCELED
1700                   FS_STATUS_EXISTS
1701                   FS_STATUS_NOT_FOUND
1702                   FS_STATUS_PERMISSION_ERROR
1703                   FS_STATUS_UNSUPPORTED_CMD
1704                   FS_STATUS_STORAGE_FULL
1705                   FS_STATUS_JOURNAL_FULL
1706                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1707 
1708                   (Async API: Immediate return values)
1709                   FS_STATUS_OK
1710                   FS_STATUS_FATAL_ERROR
1711  *---------------------------------------------------------------------------*/
1712 FSStatus            FSMakeQuota(
1713                         FSClient                *client,
1714                         FSCmdBlock              *block,
1715                         const char              *path,
1716                         FSMode                  mode,
1717                         FSBSize                 size,
1718                         FSRetFlag               errHandling
1719                         );
1720 FSStatus            FSMakeQuotaAsync(
1721                         FSClient                *client,
1722                         FSCmdBlock              *block,
1723                         const char              *path,
1724                         FSMode                  mode,
1725                         FSBSize                 size,
1726                         FSRetFlag               errHandling,
1727                         const FSAsyncParams     *asyncParams
1728                         );
1729 
1730 /*---------------------------------------------------------------------------*
1731   Name:         FSRemoveQuota(Async)
1732 
1733   Description:  Create quota.
1734 
1735   Arguments:    client          Pointer to client buffer
1736                 block           Command block
1737                 path            Directory path to create.
1738 
1739   Returns:      Result code :
1740                   FS_STATUS_OK
1741                   FS_STATUS_CANCELED
1742                   FS_STATUS_NOT_FOUND
1743                   FS_STATUS_PERMISSION_ERROR
1744                   FS_STATUS_ALREADY_OPEN
1745                   FS_STATUS_UNSUPPORTED_CMD
1746                   FS_STATUS_STORAGE_FULL
1747                   FS_STATUS_JOURNAL_FULL
1748                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1749 
1750                   (Async API: Immediate return values)
1751                   FS_STATUS_OK
1752                   FS_STATUS_FATAL_ERROR
1753  *---------------------------------------------------------------------------*/
1754 FSStatus            FSRemoveQuota(
1755                         FSClient                *client,
1756                         FSCmdBlock              *block,
1757                         const char              *path,
1758                         FSRetFlag               errHandling
1759                         );
1760 FSStatus            FSRemoveQuotaAsync(
1761                         FSClient                *client,
1762                         FSCmdBlock              *block,
1763                         const char              *path,
1764                         FSRetFlag               errHandling,
1765                         const FSAsyncParams     *asyncParams
1766                         );
1767 
1768 
1769 /*---------------------------------------------------------------------------*
1770   Name:         FSFlushQuota(Async)
1771 
1772   Description:  Flush quota
1773                 It is for only for file system supporting journaling feature.
1774                 The other file systems are return FS_STATUS_OK.
1775 
1776   Arguments:    client          Pointer to client buffer
1777                 block           Command block
1778                 path            Flushed quota path
1779 
1780   Returns:      Result code :
1781                   FS_STATUS_OK
1782                   FS_STATUS_CANCELED
1783                   FS_STATUS_NOT_FOUND
1784                   FS_STATUS_UNSUPPORTED_CMD
1785                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1786 
1787                   (Async API: Immediate return values)
1788                   FS_STATUS_OK
1789                   FS_STATUS_FATAL_ERROR
1790  *---------------------------------------------------------------------------*/
1791 FSStatus            FSFlushQuota(
1792                         FSClient                *client,
1793                         FSCmdBlock              *block,
1794                         const char              *path,
1795                         FSRetFlag               errHandling
1796                         );
1797 FSStatus            FSFlushQuotaAsync(
1798                         FSClient                *client,
1799                         FSCmdBlock              *block,
1800                         const char              *path,
1801                         FSRetFlag               errHandling,
1802                         const FSAsyncParams     *asyncParams
1803                         );
1804 
1805 /*---------------------------------------------------------------------------*
1806   Name:         FSRollbackQuota(Async)
1807 
1808   Description:  Rollback quota
1809                 It is for only for file system supporting journaling feature.
1810                 The other file systems are return FS_STATUS_UNSUPPORTED_CMD.
1811 
1812   Arguments:    client          Pointer to client buffer
1813                 block           Command block
1814                 path            Rollback quota path
1815 
1816   Returns:      Result code :
1817                   FS_STATUS_OK
1818                   FS_STATUS_CANCELED
1819                   FS_STATUS_NOT_FOUND
1820                   FS_STATUS_ALREADY_OPEN
1821                   FS_STATUS_UNSUPPORTED_CMD
1822                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1823 
1824                   (Async API: Immediate return values)
1825                   FS_STATUS_OK
1826                   FS_STATUS_FATAL_ERROR
1827  *---------------------------------------------------------------------------*/
1828 FSStatus            FSRollbackQuota(
1829                         FSClient                *client,
1830                         FSCmdBlock              *block,
1831                         const char              *path,
1832                         FSRetFlag               errHandling
1833                         );
1834 FSStatus            FSRollbackQuotaAsync(
1835                         FSClient                *client,
1836                         FSCmdBlock              *block,
1837                         const char              *path,
1838                         FSRetFlag               errHandling,
1839                         const FSAsyncParams     *asyncParams
1840                         );
1841 
1842 /*---------------------------------------------------------------------------*
1843   Name:         FSGetStat(Async)
1844 
1845   Description:  Get entry status
1846 
1847   Arguments:    client          Pointer to client buffer
1848                 block           Command block
1849                 path            Entry path
1850                 returnedStat    Entry status
1851 
1852   Returns:      Result code :
1853                   FS_STATUS_OK
1854                   FS_STATUS_CANCELED
1855                   FS_STATUS_NOT_FOUND
1856                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1857                   FS_STATUS_FATAL_ERROR
1858 
1859                   (Async API: Immediate return values)
1860                   FS_STATUS_OK
1861                   FS_STATUS_FATAL_ERROR
1862  *---------------------------------------------------------------------------*/
1863 FSStatus            FSGetStat(
1864                         FSClient                *client,
1865                         FSCmdBlock              *block,
1866                         const char              *path,
1867                         FSStat                  *returnedStat,
1868                         FSRetFlag               errHandling
1869                         );
1870 FSStatus            FSGetStatAsync(
1871                         FSClient                *client,
1872                         FSCmdBlock              *block,
1873                         const char              *path,
1874                         FSStat                  *returnedStat,
1875                         FSRetFlag               errHandling,
1876                         const FSAsyncParams     *asyncParams
1877                         );
1878 
1879 /*---------------------------------------------------------------------------*
1880   Name:         FSGetFreeSpaceSize(Async)
1881 
1882   Description:  Get free space size in quota
1883 
1884   Arguments:    client           Pointer to client buffer
1885                 block            Command block
1886                 path             Entry path
1887                 returnedFreeSize Pointer to free size in quota
1888 
1889   Returns:      Result code :
1890                   FS_STATUS_OK
1891                   FS_STATUS_CANCELED
1892                   FS_STATUS_NOT_FOUND
1893                   FS_STATUS_PERMISSION_ERROR
1894                   FS_STATUS_MEDIA_ERROR (For only manual mounted device)
1895 
1896                   (Async API: Immediate return values)
1897                   FS_STATUS_OK
1898                   FS_STATUS_FATAL_ERROR
1899  *---------------------------------------------------------------------------*/
1900 FSStatus            FSGetFreeSpaceSize(
1901                         FSClient                *client,
1902                         FSCmdBlock              *block,
1903                         const char              *path,
1904                         FSFreeSpaceSize         *returnedFreeSize,
1905                         FSRetFlag               errHandling
1906                         );
1907 FSStatus            FSGetFreeSpaceSizeAsync(
1908                         FSClient                *client,
1909                         FSCmdBlock              *block,
1910                         const char              *path,
1911                         FSFreeSpaceSize         *returnedFreeSize,
1912                         FSRetFlag               errHandling,
1913                         const FSAsyncParams     *asyncParams
1914                         );
1915 
1916 
1917 
1918 /*---------------------------------------------------------------------------*
1919   Name:         FSGetLastErrorCodeForViewer
1920 
1921   Description:  Calculate error code from last error and device type.
1922                 This error code is used for error code viewer.
1923 
1924   Arguments:    client          Pointer to client buffer
1925 
1926   Returns:      Signed 32-bit error code for error viewer.
1927  *---------------------------------------------------------------------------*/
1928 s32                 FSGetLastErrorCodeForViewer(
1929                         FSClient                *client
1930                         );
1931 
1932 /*---------------------------------------------------------------------------*
1933   Name:         FSGetErrorCodeForViewer
1934 
1935   Description:  Calculate error code from last error and device type.
1936                 This error code is used for error code viewer.
1937 
1938   Arguments:    client          Pointer to client buffer
1939                 block           Pointer to command block
1940 
1941   Returns:      Signed 32-bit error code for error viewer.
1942  *---------------------------------------------------------------------------*/
1943 s32                 FSGetErrorCodeForViewer(
1944                         FSClient                *client,
1945                         FSCmdBlock              *block
1946                         );
1947 
1948 
1949 /*---------------------------------------------------------------------------*
1950   Name:         FSTimeToCalendarTime
1951 
1952   Description:  Convert FSTime to OSCalendarTime
1953 
1954   Arguments:    time             FSTime to be converted
1955                 td               Pointer to OSCalendarTime struct
1956 
1957   Returns:      None.
1958  *---------------------------------------------------------------------------*/
1959 void                FSTimeToCalendarTime(
1960                         FSTime          time,
1961                         OSCalendarTime  *td
1962                         );
1963 
1964 /*---------------------------------------------------------------------------*
1965   Name:         FSSetCmdPriority
1966 
1967   Description:  Set priority for specified command block.
1968                 Command block must be in free state.
1969 
1970   Arguments:    block       Command block to set priority.
1971                 priority    New priority of the command. 0 is the highest priority, 31 is the lowest.
1972                             Default is 16.
1973 
1974   Returns:      FS_STATUS_OK            Successfully set new priority to the command block.
1975                 FS_STATUS_FATAL_ERROR   block is invalid address or already in use,
1976                                         or priority is out of supported range.
1977  *---------------------------------------------------------------------------*/
1978 FSStatus            FSSetCmdPriority(
1979                         FSCmdBlock              *block,
1980                         FSPriority              priority
1981                         );
1982 
1983 /*---------------------------------------------------------------------------*
1984   Name:         FSGetCmdPriority
1985 
1986   Description:  Get current priority for specified command block.
1987 
1988   Arguments:    block       Command block to get priority.
1989 
1990   Returns:      Non-negative value (>= 0) Priority of the command.
1991                 FS_STATUS_FATAL_ERROR     block is invalid address.
1992  *---------------------------------------------------------------------------*/
1993 FSPriority          FSGetCmdPriority(
1994                         FSCmdBlock              *block
1995                         );
1996 
1997 
1998 /*
1999  * for only development
2000  */
2001 
2002 
2003 
2004 /*---------------------------------------------------------------------------*
2005   Name:         FSGetLastError(Async)
2006 
2007   Description:  Get detailed information of last error from client handle.
2008 
2009   Arguments:    client           Pointer to client buffer
2010 
2011   Returns:      error value.
2012  *---------------------------------------------------------------------------*/
2013 FSError             FSGetLastError(
2014                         FSClient                *client
2015                         );
2016 
2017 /*---------------------------------------------------------------------------*
2018   Name:         FSSetEmulatedError
2019 
2020   Description:  Set up error code emulation for specified client.
2021                 Next command queued to this client will fail with specified error code.
2022 
2023   Arguments:    client  Client to set emulated error
2024                 error   Error code to emulate.
2025                         Specifying FS_ERROR_OK cancels the emulation.
2026                         Otherwise error must be negative.
2027                         Emulating FS_ERROR_MEDIA_NOT_READY is not supported.
2028 
2029   Returns:      FS_STATUS_OK            Successfully set emulated error code.
2030  *---------------------------------------------------------------------------*/
2031 FSStatus            FSSetEmulatedError(
2032                         FSClient                *client,
2033                         FSError                 error
2034                         );
2035 
2036 /*---------------------------------------------------------------------------*
2037   Name:         FSGetEmulatedError
2038 
2039   Description:  Get emulated error code set for specified client.
2040 
2041   Arguments:    client  Client to get emulated error
2042 
2043   Returns:      Negative value : Error code to emulate.
2044                 FS_ERROR_OK    : No emulation is set.
2045                 Positive value : Failed to get emulated error code.
2046                                  1: client is invalid address.
2047  *---------------------------------------------------------------------------*/
2048 FSError             FSGetEmulatedError(
2049                         FSClient                *client
2050                         );
2051 
2052 #ifdef __cplusplus
2053 }
2054 #endif
2055 
2056 #endif // __FS_H__
2057