Skip to content

Commit 4560f49

Browse files
eightyccdhalbert
andauthored
Update lib/oofatfs/ff.c
Co-authored-by: Dan Halbert <[email protected]>
1 parent 2e72ea9 commit 4560f49

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/oofatfs/ff.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5704,7 +5704,11 @@ FRESULT f_mkfs (
57045704
}
57055705
sz_fat = (n + ss - 1) / ss; /* FAT size [sector] */
57065706
sz_rsv = 1; /* Number of reserved sectors */
5707-
n_rootdir = (sz_vol <= 256)? 64 : n_rootdir; /* Shrink root dir for <= 128K device */
5707+
// CIRCUITPY-CHANGE: For fewer than 256 clusters (128kB filesystem),
5708+
// shrink the root directory size from 512 entries to 128 entries. Note that
5709+
// long filenames will use two entries. This change affects only the root directory,
5710+
// not subdirectories
5711+
n_rootdir = (sz_vol <= 256) ? 128 : n_rootdir;
57085712
sz_dir = (DWORD)n_rootdir * SZDIRE / ss; /* Rootdir size [sector] */
57095713
}
57105714
b_fat = b_vol + sz_rsv; /* FAT base */

0 commit comments

Comments
 (0)