forked from Imagelibrary/rtems
CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK was undocumented and not error checked
closes #2431.
This commit is contained in:
@@ -3820,5 +3820,19 @@ const rtems_libio_helper rtems_fs_init_helper =
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* IMFS block size for in memory files (memfiles) must be a power of
|
||||
* two between 16 and 512 inclusive.
|
||||
*/
|
||||
#if ((CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 16) && \
|
||||
(CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 32) && \
|
||||
(CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 64) && \
|
||||
(CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 128) && \
|
||||
(CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 256) && \
|
||||
(CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 512))
|
||||
#error "IMFS Memfile block size must be a power of 2 between 16 and 512"
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -2748,6 +2748,61 @@ options will be defined as well
|
||||
@item @code{CONFIGURE_IMFS_DISABLE_UNMOUNT}.
|
||||
@end itemize
|
||||
|
||||
@c
|
||||
@c === CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK ===
|
||||
@c
|
||||
@subsection Specify Block Size for IMFS
|
||||
|
||||
@findex CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK
|
||||
|
||||
@table @b
|
||||
@item CONSTANT:
|
||||
@code{CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK}
|
||||
|
||||
@item DATA TYPE:
|
||||
Boolean feature macro.
|
||||
|
||||
@item RANGE:
|
||||
Valid values for this configuration parameter are a power of two (2)
|
||||
between 16 and 512 inclusive. In other words, valid values are 16,
|
||||
32, 64, 128, 256,and 512.
|
||||
|
||||
@item DEFAULT VALUE:
|
||||
The default IMFS block size is 128 bytes.
|
||||
|
||||
@end table
|
||||
|
||||
@subheading DESCRIPTION:
|
||||
This configuration parameter specifies the block size for in-memory files
|
||||
managed by the IMFS. The configured block size has two impacts. The first
|
||||
is the average amount of unused memory in the last block of each file. For
|
||||
example, when the block size is 512, on average one-half of the last block
|
||||
of each file will remain unused and the memory is wasted. In contrast,
|
||||
when the block size is 16, the average unused memory per file is only
|
||||
8 bytes. However, it requires more allocations for the same size file
|
||||
and thus more overhead per block for the dynamic memory management.
|
||||
|
||||
Second, the block size has an impact on the maximum size file that can
|
||||
be stored in the IMFS. With smaller block size, the maximum file size
|
||||
is correspondingly smaller. The following shows the maximum file size
|
||||
possible based on the configured block size:
|
||||
|
||||
@itemize @bullet
|
||||
@item when the block size is 16 bytes, the maximum file size is 1,328
|
||||
bytes.
|
||||
@item when the block size is 32 bytes, the maximum file size is 18,656
|
||||
bytes.
|
||||
@item when the block size is 64 bytes, the maximum file size is 279,488
|
||||
bytes.
|
||||
@item when the block size is 128 bytes, the maximum file size is
|
||||
4,329,344 bytes.
|
||||
@item when the block size is 256 bytes, the maximum file size is
|
||||
68,173,568 bytes.
|
||||
@item when the block size is 512 bytes, the maximum file size is
|
||||
1,082,195,456 bytes.
|
||||
@end itemize
|
||||
|
||||
|
||||
@c
|
||||
@c === CONFIGURE_IMFS_DISABLE_CHOWN ===
|
||||
@c
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-2014.
|
||||
* COPYRIGHT (c) 1989-2015.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -211,7 +211,7 @@ rtems_task Init(
|
||||
#define CONFIGURE_FILESYSTEM_IMFS
|
||||
|
||||
#define CONFIGURE_MAXIMUM_TASKS 1
|
||||
#define CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK 15
|
||||
#define CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK 16
|
||||
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4
|
||||
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
|
||||
|
||||
|
||||
Reference in New Issue
Block a user