summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cpukit/sapi/include/confdefs.h14
-rw-r--r--doc/user/conf.t55
-rw-r--r--testsuites/psxtests/psximfs02/init.c4
3 files changed, 71 insertions, 2 deletions
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index 8115a85724..e29111638a 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -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 */
diff --git a/doc/user/conf.t b/doc/user/conf.t
index b19dbd9e82..b77250ff24 100644
--- a/doc/user/conf.t
+++ b/doc/user/conf.t
@@ -2749,6 +2749,61 @@ options will be defined as well
@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
@subsection Disable Change Owner Support of Root IMFS
diff --git a/testsuites/psxtests/psximfs02/init.c b/testsuites/psxtests/psximfs02/init.c
index d372a6f11b..2a55d08f38 100644
--- a/testsuites/psxtests/psximfs02/init.c
+++ b/testsuites/psxtests/psximfs02/init.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