Skip to content

Commit a153dc6

Browse files
committed
fatfs: Changed documentation of format to emphasize byte clusters
1 parent f927996 commit a153dc6

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

features/filesystem/fat/FATFileSystem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ int FATFileSystem::unmount()
308308

309309
/* See http://elm-chan.org/fsw/ff/en/mkfs.html for details of f_mkfs() and
310310
* associated arguments. */
311-
int FATFileSystem::format(BlockDevice *bd, int allocation_unit) {
311+
int FATFileSystem::format(BlockDevice *bd, bd_size_t cluster_size) {
312312
FATFileSystem fs;
313313
int err = fs.mount(bd, false);
314314
if (err) {
@@ -317,7 +317,7 @@ int FATFileSystem::format(BlockDevice *bd, int allocation_unit) {
317317

318318
// Logical drive number, Partitioning rule, Allocation unit size (bytes per cluster)
319319
fs.lock();
320-
FRESULT res = f_mkfs(fs._fsid, 1, allocation_unit);
320+
FRESULT res = f_mkfs(fs._fsid, 1, cluster_size);
321321
fs.unlock();
322322
if (res != FR_OK) {
323323
return fat_error_remap(res);

features/filesystem/fat/FATFileSystem.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@ class FATFileSystem : public FileSystem {
4949
* The block device to format should be mounted when this function is called.
5050
*
5151
* @param bd
52-
* This is the block device that will be formated.
53-
*
54-
* @param allocation_unit
55-
* This is the number of bytes per cluster size. The valid value is N
56-
* times the sector size. N is a power of 2 from 1 to 128 for FAT
57-
* volume and upto 16MiB for exFAT volume. If zero is given,
58-
* the default allocation unit size is selected by the underlying
59-
* filesystem, which depends on the volume size.
52+
* This is the block device that will be formatted.
53+
*
54+
* @param cluster_size
55+
* This is the number of bytes per cluster. A larger cluster size will decrease
56+
* the overhead of the FAT table, but also increase the minimum file size. The
57+
* cluster_size must be a multiple of the underlying device's allocation unit
58+
* and is currently limited to a max of 32,768 bytes. If zero, a cluster size
59+
* will be determined from the device's allocation unit. Defaults to zero.
6060
*
6161
* @return 0 on success, negative error code on failure
6262
*/
63-
static int format(BlockDevice *bd, int allocation_unit = 0);
63+
static int format(BlockDevice *bd, bd_size_t cluster_size = 0);
6464

6565
/** Mounts a filesystem to a block device
6666
*

0 commit comments

Comments
 (0)