fatfs: Changed documentation of format to emphasize byte clusters

pull/4843/head
Christopher Haster 2017-08-15 13:58:01 -05:00
parent f927996275
commit a153dc625c
2 changed files with 10 additions and 10 deletions

View File

@ -308,7 +308,7 @@ int FATFileSystem::unmount()
/* See http://elm-chan.org/fsw/ff/en/mkfs.html for details of f_mkfs() and /* See http://elm-chan.org/fsw/ff/en/mkfs.html for details of f_mkfs() and
* associated arguments. */ * associated arguments. */
int FATFileSystem::format(BlockDevice *bd, int allocation_unit) { int FATFileSystem::format(BlockDevice *bd, bd_size_t cluster_size) {
FATFileSystem fs; FATFileSystem fs;
int err = fs.mount(bd, false); int err = fs.mount(bd, false);
if (err) { if (err) {
@ -317,7 +317,7 @@ int FATFileSystem::format(BlockDevice *bd, int allocation_unit) {
// Logical drive number, Partitioning rule, Allocation unit size (bytes per cluster) // Logical drive number, Partitioning rule, Allocation unit size (bytes per cluster)
fs.lock(); fs.lock();
FRESULT res = f_mkfs(fs._fsid, 1, allocation_unit); FRESULT res = f_mkfs(fs._fsid, 1, cluster_size);
fs.unlock(); fs.unlock();
if (res != FR_OK) { if (res != FR_OK) {
return fat_error_remap(res); return fat_error_remap(res);

View File

@ -49,18 +49,18 @@ public:
* The block device to format should be mounted when this function is called. * The block device to format should be mounted when this function is called.
* *
* @param bd * @param bd
* This is the block device that will be formated. * This is the block device that will be formatted.
* *
* @param allocation_unit * @param cluster_size
* This is the number of bytes per cluster size. The valid value is N * This is the number of bytes per cluster. A larger cluster size will decrease
* times the sector size. N is a power of 2 from 1 to 128 for FAT * the overhead of the FAT table, but also increase the minimum file size. The
* volume and upto 16MiB for exFAT volume. If zero is given, * cluster_size must be a multiple of the underlying device's allocation unit
* the default allocation unit size is selected by the underlying * and is currently limited to a max of 32,768 bytes. If zero, a cluster size
* filesystem, which depends on the volume size. * will be determined from the device's allocation unit. Defaults to zero.
* *
* @return 0 on success, negative error code on failure * @return 0 on success, negative error code on failure
*/ */
static int format(BlockDevice *bd, int allocation_unit = 0); static int format(BlockDevice *bd, bd_size_t cluster_size = 0);
/** Mounts a filesystem to a block device /** Mounts a filesystem to a block device
* *