From 4560f49279e17fea97c9c8915965f9bf576a83de Mon Sep 17 00:00:00 2001 From: eightycc Date: Tue, 7 Nov 2023 13:51:32 -0800 Subject: [PATCH] Update lib/oofatfs/ff.c Co-authored-by: Dan Halbert --- lib/oofatfs/ff.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/oofatfs/ff.c b/lib/oofatfs/ff.c index ee63e4984d..bc301f3ed4 100644 --- a/lib/oofatfs/ff.c +++ b/lib/oofatfs/ff.c @@ -5704,7 +5704,11 @@ FRESULT f_mkfs ( } sz_fat = (n + ss - 1) / ss; /* FAT size [sector] */ sz_rsv = 1; /* Number of reserved sectors */ - n_rootdir = (sz_vol <= 256)? 64 : n_rootdir; /* Shrink root dir for <= 128K device */ + // CIRCUITPY-CHANGE: For fewer than 256 clusters (128kB filesystem), + // shrink the root directory size from 512 entries to 128 entries. Note that + // long filenames will use two entries. This change affects only the root directory, + // not subdirectories + n_rootdir = (sz_vol <= 256) ? 128 : n_rootdir; sz_dir = (DWORD)n_rootdir * SZDIRE / ss; /* Rootdir size [sector] */ } b_fat = b_vol + sz_rsv; /* FAT base */