This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit b46edd1252fcf7595d03dbe082cf59894f87ff1e
Author: chao an <[email protected]>
AuthorDate: Wed Sep 18 09:13:18 2024 +0800

    fs/reference_count: set default reference count option depends on 
DISABLE_PTHREAD
    
    Most of developers will not have the scenarios of open/close file 
descriptors in multi-threads,
    The default option will incur additional code size overhead for such 
devices.
    this PR will preserve the behavior before PR#13296 was introduced, and 
ensure that the default code size is not affected.
    
    Note that this option will ensure the safety of access to the file
    system from multi-tasks (Task A blocking rw(fd), then Task B close(fd)),
    the disadvantage is that it will increase the amount of code-size,
    there is no need to enable this option if the application could ensure
    he file operations are safe.
    
    Signed-off-by: chao an <[email protected]>
---
 fs/Kconfig | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/Kconfig b/fs/Kconfig
index 545435818d..3b1af8b404 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -129,11 +129,17 @@ config FS_HEAPBUF_SECTION
 
 config FS_REFCOUNT
        bool "File reference count"
-       default !DEFAULT_SMALL
+       default !DISABLE_PTHREAD
        ---help---
                Enable will Records the number of filep references. The file is
                actually closed when the count reaches 0
 
+               Note that this option will ensure the safety of access to the 
file
+               system from multi-tasks (thread A blocking rw(fd), then thread 
B close(fd)),
+               the disadvantage is that it will increase the amount of 
code-size,
+               there is no need to enable this option if the application could 
ensure
+               he file operations are safe.
+
 source "fs/vfs/Kconfig"
 source "fs/aio/Kconfig"
 source "fs/semaphore/Kconfig"

Reply via email to