fs/fs: remove unnecessary FS_REFCOUNT config
Previously, this config was added to ensure that the size of the struct file remained unchanged, thereby preventing the Flash memory of resource-constrained MCUs from being unnecessarily increased. However, we have now refactored the relationship between struct fd and struct file, reducing their memory footprint in both Flash and RAM. Consequently, this config can be removed. Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
1e787ea280
commit
3bc3092e6a
6 changed files with 0 additions and 38 deletions
|
|
@ -5,7 +5,6 @@
|
|||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_FS_REFCOUNT is not set
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="olimex-stm32-p407"
|
||||
CONFIG_ARCH_BOARD_OLIMEX_STM32P407=y
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
# modifications.
|
||||
#
|
||||
# CONFIG_ARCH_FPU is not set
|
||||
# CONFIG_FS_REFCOUNT is not set
|
||||
# CONFIG_NXFONTS_DISABLE_16BPP is not set
|
||||
# CONFIG_NXTK_DEFAULT_BORDERCOLORS is not set
|
||||
# CONFIG_NXWM_NXTERM is not set
|
||||
|
|
|
|||
13
fs/Kconfig
13
fs/Kconfig
|
|
@ -127,19 +127,6 @@ config FS_HEAPBUF_SECTION
|
|||
Allocated fs heap from the specified section. If not
|
||||
specified, it will alloc from kernel heap.
|
||||
|
||||
config FS_REFCOUNT
|
||||
bool "File reference count"
|
||||
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"
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ static FAR struct file *files_fget_by_index(FAR struct filelist *list,
|
|||
filep = &list->fl_files[l1][l2];
|
||||
spin_unlock_irqrestore_notrace(&list->fl_lock, flags);
|
||||
|
||||
#ifdef CONFIG_FS_REFCOUNT
|
||||
if (filep->f_inode != NULL)
|
||||
{
|
||||
/* When the reference count is zero but the inode has not yet been
|
||||
|
|
@ -100,13 +99,6 @@ static FAR struct file *files_fget_by_index(FAR struct filelist *list,
|
|||
*new = true;
|
||||
}
|
||||
|
||||
#else
|
||||
if (filep->f_inode == NULL && new == NULL)
|
||||
{
|
||||
filep = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
return filep;
|
||||
}
|
||||
|
||||
|
|
@ -586,9 +578,7 @@ int file_allocate_from_tcb(FAR struct tcb_s *tcb, FAR struct inode *inode,
|
|||
filep->f_pos = pos;
|
||||
filep->f_inode = inode;
|
||||
filep->f_priv = priv;
|
||||
#ifdef CONFIG_FS_REFCOUNT
|
||||
atomic_set(&filep->f_refs, 1);
|
||||
#endif
|
||||
#ifdef CONFIG_FDSAN
|
||||
filep->f_tag_fdsan = 0;
|
||||
#endif
|
||||
|
|
@ -812,7 +802,6 @@ int fs_getfilep(int fd, FAR struct file **filep)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_FS_REFCOUNT
|
||||
void fs_reffilep(FAR struct file *filep)
|
||||
{
|
||||
/* This interface is used to increase the reference count of filep */
|
||||
|
|
@ -852,7 +841,6 @@ int fs_putfilep(FAR struct file *filep)
|
|||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nx_dup2_from_tcb
|
||||
|
|
@ -928,7 +916,6 @@ int nx_close_from_tcb(FAR struct tcb_s *tcb, int fd)
|
|||
return -EBADF;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_FS_REFCOUNT
|
||||
|
||||
/* files_fget will increase the reference count, there call fs_putfilep
|
||||
* reduce reference count.
|
||||
|
|
@ -939,9 +926,6 @@ int nx_close_from_tcb(FAR struct tcb_s *tcb, int fd)
|
|||
/* Undo the last reference count from file_allocate_from_tcb */
|
||||
|
||||
return fs_putfilep(filep);
|
||||
#else
|
||||
return file_close(filep);
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
config FS_RAMMAP
|
||||
bool "File mapping emulation"
|
||||
default n
|
||||
depends on FS_REFCOUNT
|
||||
---help---
|
||||
NuttX operates in a flat open address space and is focused on MCUs that do
|
||||
support Memory Management Units (MMUs). Therefore, NuttX generally does not
|
||||
|
|
|
|||
|
|
@ -460,9 +460,7 @@ typedef struct cookie_io_functions_t
|
|||
struct file
|
||||
{
|
||||
int f_oflags; /* Open mode flags */
|
||||
#ifdef CONFIG_FS_REFCOUNT
|
||||
atomic_t f_refs; /* Reference count */
|
||||
#endif
|
||||
off_t f_pos; /* File position */
|
||||
FAR struct inode *f_inode; /* Driver or file system interface */
|
||||
FAR void *f_priv; /* Per file driver private data */
|
||||
|
|
@ -1221,11 +1219,7 @@ void fs_reffilep(FAR struct file *filep);
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_FS_REFCOUNT
|
||||
int fs_putfilep(FAR struct file *filep);
|
||||
#else
|
||||
# define fs_putfilep(f)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: file_close
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue