diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 9e2e4347b..28703b510 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -389,5 +389,6 @@ * Moved all FAT related files from fs to fs/fat * Implemented mkfatfs(), a non-standard API to create a FAT filesystem on a block device (not yet tested). - * Added a test for mkfatfs() on a RAM disk in examples/mount + * Added a test for mkfatfs() on a RAM disk in examples/mount and verified + basic mkfatfs functionality for FAT12. diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index fc53f66ef..bd914f23b 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -1038,7 +1038,8 @@ nuttx-0.3.12 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> * Moved all FAT related files from fs to fs/fat * Implemented mkfatfs(), a non-standard API to create a FAT filesystem on a block device (not yet tested). - * Added a test for mkfatfs() on a RAM disk in examples/mount + * Added a test for mkfatfs() on a RAM disk in examples/mount and verified + basic mkfatfs functionality for FAT12. pascal-0.1.3 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> diff --git a/nuttx/Documentation/NuttxUserGuide.html b/nuttx/Documentation/NuttxUserGuide.html index f480187bc..a6e6ea90d 100644 --- a/nuttx/Documentation/NuttxUserGuide.html +++ b/nuttx/Documentation/NuttxUserGuide.html @@ -21,7 +21,7 @@ User's Manual
Gregory Nutt
-Last Update: July 20, 2008 +Last Update: August 10, 2008
Overview. NuttX includes an optional, scalable file system. @@ -5971,9 +5980,9 @@ interface of the same name. int statfs(const char *path, FAR struct statfs *buf); /* Prototyped but not implemented */ -
pipe
pipe
Function Prototype:
@@ -6007,7 +6016,7 @@ interface of the same name. -mkfifo
mkfifo
Function Prototype:
@@ -6054,22 +6063,25 @@ interface of the same name. -setenv
mkfatfs
Function Prototype:
-- #include+- int setenv(const char *name, const char *value, int overwrite); -
+#include+int mkfatfs(FAR const char *pathname, FAR struct fat_format_s *fmt); +
Description:
- The setenv()
function adds the variable name
to the environment with the
- specified value
if the variable name
does not exist. If the name
- does exist in the environment, then its value is changed to value
if overwrite
- is non-zero; if overwrite
is zero, then the value of name
is unaltered.
+ The mkfafs()
formats a FAT file system image on the block
+ device specified by pathname
+
Assumptions: The caller must assure that the block driver is not mounted and not in + use when this function is called. + The result of formatting a mounted device is indeterminate (but likely not good).
name
- The name of the variable to change.
+ pathname
+ The full path to the registered block driver in the file system.
value
- The new value of the variable.
- value
- Replace any existing value if non-zero.
+ fmt
+ A reference to an instance of a structure that provides caller-selectable
+ attributes of the created FAT file system.
+ +struct fat_format_s +{ + ubyte ff_nfats; /* Number of FATs */ + ubyte ff_fattype; /* FAT size: 0 (autoselect), 12, 16, or 32 */ + ubyte ff_clustshift; /* Log2 of sectors per cluster: 0-5, 0xff (autoselect) */ + ubyte ff_volumelabel[11]; /* Volume label */ + uint16 ff_backupboot; /* Sector number of the backup boot sector (0=use default)*/ + uint16 ff_rootdirentries; /* Number of root directory entries */ + uint16 ff_rsvdseccount; /* Reserved sectors */ + uint32 ff_hidsec; /* Count of hidden sectors preceding fat */ + uint32 ff_volumeid; /* FAT volume id */ + uint32 ff_nsectors; /* Number of sectors from device to use: 0: Use all */ +}; ++
- Zero on success.
+ Zero (OK
) on success;
+ -1 (ERROR
) on failure with errno
set appropriately:
+
EINVAL
-
+ NULL block driver string, bad number of FATS in fmt
,
+ bad FAT size in fmt
, bad cluster size in fmt
+ ENOENT
-
+ pathname
does not refer to anything in the filesystem.
+ ENOTBLK
-
+ pathname
does not refer to a block driver
+ EACCESS
-
+ block driver does not support write or geometry methods
+ + |
|
-+ |
+ |