diff mbox

[U-Boot,V2,06/10] fat: ffconf.h changes for U-Boot port

Message ID 1439304945-7968-7-git-send-email-swarren@wwwdotorg.org
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Stephen Warren Aug. 11, 2015, 2:55 p.m. UTC
Turn on _FS_NORTC: This means we don't have to implement get_fattime()
which simplifies life for now.

Automatically set _FS_READONLY based on CONFIG_FAT_WRITE. This requires
including <config.h> since we reference CONFIG_*.

Set _USE_LFN to enable long filename handling; an essential feature.

Set _FS_RPATH so that paths components "." and ".." are correctly parsed
and handled. This enables paths such as "/extlinux/../foo" to work.

Set _USE_LABEL so that volume labels can be read.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
---
 fs/fat/ffconf.h | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Comments

Tom Rini Aug. 14, 2015, 6:47 p.m. UTC | #1
On Tue, Aug 11, 2015 at 08:55:41AM -0600, Stephen Warren wrote:
> Turn on _FS_NORTC: This means we don't have to implement get_fattime()
> which simplifies life for now.
> 
> Automatically set _FS_READONLY based on CONFIG_FAT_WRITE. This requires
> including <config.h> since we reference CONFIG_*.
> 
> Set _USE_LFN to enable long filename handling; an essential feature.
> 
> Set _FS_RPATH so that paths components "." and ".." are correctly parsed
> and handled. This enables paths such as "/extlinux/../foo" to work.
> 
> Set _USE_LABEL so that volume labels can be read.

Hmm, is there some way to wrap volume label support in Kconfig?  I'm
sure this is useful in some cases, but maybe something that boards that
are already on the cusp of their size limit would want off?
Stephen Warren Aug. 15, 2015, 3:40 a.m. UTC | #2
On 08/14/2015 12:47 PM, Tom Rini wrote:
> On Tue, Aug 11, 2015 at 08:55:41AM -0600, Stephen Warren wrote:
>> Turn on _FS_NORTC: This means we don't have to implement
>> get_fattime() which simplifies life for now.
>> 
>> Automatically set _FS_READONLY based on CONFIG_FAT_WRITE. This
>> requires including <config.h> since we reference CONFIG_*.
>> 
>> Set _USE_LFN to enable long filename handling; an essential
>> feature.
>> 
>> Set _FS_RPATH so that paths components "." and ".." are correctly
>> parsed and handled. This enables paths such as "/extlinux/../foo"
>> to work.
>> 
>> Set _USE_LABEL so that volume labels can be read.
> 
> Hmm, is there some way to wrap volume label support in Kconfig?
> I'm sure this is useful in some cases, but maybe something that
> boards that are already on the cusp of their size limit would want
> off?

It's certainly possible; ffconf.h's definition of _FS_READONLY is
already driven by CONFIG_FAT_WRITE in this series.

I'm not sure if it's worth it though; on the RPi, turning off volume
label support only saves ~0.5K of .text, 0 .data, and 8 bytes .bss. If
so, I can certainly throw in another patch to allow it to be configured.
Tom Rini Aug. 15, 2015, 1:07 p.m. UTC | #3
On Fri, Aug 14, 2015 at 09:40:48PM -0600, Stephen Warren wrote:
> On 08/14/2015 12:47 PM, Tom Rini wrote:
> > On Tue, Aug 11, 2015 at 08:55:41AM -0600, Stephen Warren wrote:
> >> Turn on _FS_NORTC: This means we don't have to implement
> >> get_fattime() which simplifies life for now.
> >> 
> >> Automatically set _FS_READONLY based on CONFIG_FAT_WRITE. This
> >> requires including <config.h> since we reference CONFIG_*.
> >> 
> >> Set _USE_LFN to enable long filename handling; an essential
> >> feature.
> >> 
> >> Set _FS_RPATH so that paths components "." and ".." are correctly
> >> parsed and handled. This enables paths such as "/extlinux/../foo"
> >> to work.
> >> 
> >> Set _USE_LABEL so that volume labels can be read.
> > 
> > Hmm, is there some way to wrap volume label support in Kconfig?
> > I'm sure this is useful in some cases, but maybe something that
> > boards that are already on the cusp of their size limit would want
> > off?
> 
> It's certainly possible; ffconf.h's definition of _FS_READONLY is
> already driven by CONFIG_FAT_WRITE in this series.
> 
> I'm not sure if it's worth it though; on the RPi, turning off volume
> label support only saves ~0.5K of .text, 0 .data, and 8 bytes .bss. If
> so, I can certainly throw in another patch to allow it to be configured.

Yeah, OK, that's not a big enough savings to bother with I think.  On
the boards where we're seeing a bigger size growth can you investigate a
little?  Thanks!
Stephen Warren Aug. 19, 2015, 4:01 a.m. UTC | #4
On 08/15/2015 07:07 AM, Tom Rini wrote:
> On Fri, Aug 14, 2015 at 09:40:48PM -0600, Stephen Warren wrote:
>> On 08/14/2015 12:47 PM, Tom Rini wrote:
>>> On Tue, Aug 11, 2015 at 08:55:41AM -0600, Stephen Warren
>>> wrote:
>>>> Turn on _FS_NORTC: This means we don't have to implement 
>>>> get_fattime() which simplifies life for now.
>>>> 
>>>> Automatically set _FS_READONLY based on CONFIG_FAT_WRITE.
>>>> This requires including <config.h> since we reference
>>>> CONFIG_*.
>>>> 
>>>> Set _USE_LFN to enable long filename handling; an essential 
>>>> feature.
>>>> 
>>>> Set _FS_RPATH so that paths components "." and ".." are
>>>> correctly parsed and handled. This enables paths such as
>>>> "/extlinux/../foo" to work.
>>>> 
>>>> Set _USE_LABEL so that volume labels can be read.
>>> 
>>> Hmm, is there some way to wrap volume label support in
>>> Kconfig? I'm sure this is useful in some cases, but maybe
>>> something that boards that are already on the cusp of their
>>> size limit would want off?
>> 
>> It's certainly possible; ffconf.h's definition of _FS_READONLY
>> is already driven by CONFIG_FAT_WRITE in this series.
>> 
>> I'm not sure if it's worth it though; on the RPi, turning off
>> volume label support only saves ~0.5K of .text, 0 .data, and 8
>> bytes .bss. If so, I can certainly throw in another patch to
>> allow it to be configured.
> 
> Yeah, OK, that's not a big enough savings to bother with I think.
> On the boards where we're seeing a bigger size growth can you
> investigate a little?  Thanks!

I haven't built a lot of boards, but I think that large size increase
may have been limited to sandbox. For some reason, its config.mk
doesn't contain:

PLATFORM_RELFLAGS += -ffunction-sections -fvisibility=hidden

If I add that to arch/sandbox/config.mk, then I see a much smaller
size increase when switching to the new FAT implementation.

There are obviously a few functions that aren't used in ff.c, but
aren't ifdef'd out.
diff mbox

Patch

diff --git a/fs/fat/ffconf.h b/fs/fat/ffconf.h
index 7ac4f4443d9c..9f7952a1f8ea 100644
--- a/fs/fat/ffconf.h
+++ b/fs/fat/ffconf.h
@@ -1,3 +1,5 @@ 
+#include <config.h>
+
 /*---------------------------------------------------------------------------/
 /  FatFs - FAT file system module configuration file  R0.11 (C)ChaN, 2015
 /---------------------------------------------------------------------------*/
@@ -16,7 +18,11 @@ 
 /  data transfer. */
 
 
+#ifdef CONFIG_FAT_WRITE
 #define _FS_READONLY	0
+#else
+#define _FS_READONLY	1
+#endif
 /* This option switches read-only configuration. (0:Read/Write or 1:Read-only)
 /  Read-only configuration removes writing API functions, f_write(), f_sync(),
 /  f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree()
@@ -55,7 +61,7 @@ 
 /* This option switches fast seek feature. (0:Disable or 1:Enable) */
 
 
-#define _USE_LABEL		0
+#define _USE_LABEL		1
 /* This option switches volume label functions, f_getlabel() and f_setlabel().
 /  (0:Disable or 1:Enable) */
 
@@ -93,7 +99,7 @@ 
 */
 
 
-#define	_USE_LFN	0
+#define	_USE_LFN	1
 #define	_MAX_LFN	255
 /* The _USE_LFN option switches the LFN feature.
 /
@@ -127,7 +133,7 @@ 
 /  When _LFN_UNICODE is 0, this option has no effect. */
 
 
-#define _FS_RPATH	0
+#define _FS_RPATH	1
 /* This option configures relative path feature.
 /
 /   0: Disable relative path feature and remove related functions.
@@ -195,7 +201,7 @@ 
 / System Configurations
 /---------------------------------------------------------------------------*/
 
-#define _FS_NORTC	0
+#define _FS_NORTC	1
 #define _NORTC_MON	2
 #define _NORTC_MDAY	1
 #define _NORTC_YEAR	2015