[PATCH v2 29/44] config: Add <rtems/confdefs/bdbuf.h>

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Feb 21 10:52:41 UTC 2020


Remove all comments and copyrightable content from the moved content.
Use BSD-2-Clause license for new file.

Update #3053.
Update #3875.
---
 cpukit/headers.am                     |   1 +
 cpukit/include/rtems/confdefs.h       | 100 +--------------------
 cpukit/include/rtems/confdefs/bdbuf.h | 161 ++++++++++++++++++++++++++++++++++
 3 files changed, 164 insertions(+), 98 deletions(-)
 create mode 100644 cpukit/include/rtems/confdefs/bdbuf.h

diff --git a/cpukit/headers.am b/cpukit/headers.am
index 2cb59165bf..10014ee489 100644
--- a/cpukit/headers.am
+++ b/cpukit/headers.am
@@ -183,6 +183,7 @@ include_rtems_HEADERS += include/rtems/userenv.h
 include_rtems_HEADERS += include/rtems/version.h
 include_rtems_HEADERS += include/rtems/vmeintr.h
 include_rtems_HEADERS += include/rtems/watchdogdrv.h
+include_rtems_confdefs_HEADERS += include/rtems/confdefs/bdbuf.h
 include_rtems_confdefs_HEADERS += include/rtems/confdefs/bsp.h
 include_rtems_confdefs_HEADERS += include/rtems/confdefs/libio.h
 include_rtems_confdefs_HEADERS += include/rtems/confdefs/libpci.h
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index ba37f0abe7..15e921629b 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -50,6 +50,7 @@
 #include <rtems/posix/shm.h>
 #include <rtems/posix/timer.h>
 #include <rtems/confdefs/obsolete.h>
+#include <rtems/confdefs/bdbuf.h>
 #include <rtems/confdefs/libio.h>
 #include <rtems/confdefs/libpci.h>
 #include <rtems/confdefs/percpu.h>
@@ -463,103 +464,6 @@ extern "C" {
 #endif
 /**@}*/ /* end of Device Driver Table Configuration */
 
-/**
- * @defgroup ConfigurationLibBlock Configuration of LIBBLOCK
- *
- * @addtogroup Configuration
- *
- * This module contains parameters related to the LIBBLOCK buffering
- * and caching subsystem. It requires tasks to swap out data to be
- * written to non-volatile storage.
- */
-/**@{*/
-#ifdef CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
-  #include <rtems/bdbuf.h>
-  /*
-   * configure the bdbuf cache parameters
-   */
-  #ifndef CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS
-    #define CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS \
-                              RTEMS_BDBUF_MAX_READ_AHEAD_BLOCKS_DEFAULT
-  #endif
-  #ifndef CONFIGURE_BDBUF_MAX_WRITE_BLOCKS
-    #define CONFIGURE_BDBUF_MAX_WRITE_BLOCKS \
-                              RTEMS_BDBUF_MAX_WRITE_BLOCKS_DEFAULT
-  #endif
-  #ifndef CONFIGURE_SWAPOUT_TASK_PRIORITY
-    #define CONFIGURE_SWAPOUT_TASK_PRIORITY \
-                              RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT
-  #endif
-  #ifndef CONFIGURE_SWAPOUT_SWAP_PERIOD
-    #define CONFIGURE_SWAPOUT_SWAP_PERIOD \
-                              RTEMS_BDBUF_SWAPOUT_TASK_SWAP_PERIOD_DEFAULT
-  #endif
-  #ifndef CONFIGURE_SWAPOUT_BLOCK_HOLD
-    #define CONFIGURE_SWAPOUT_BLOCK_HOLD \
-                              RTEMS_BDBUF_SWAPOUT_TASK_BLOCK_HOLD_DEFAULT
-  #endif
-  #ifndef CONFIGURE_SWAPOUT_WORKER_TASKS
-    #define CONFIGURE_SWAPOUT_WORKER_TASKS \
-                              RTEMS_BDBUF_SWAPOUT_WORKER_TASKS_DEFAULT
-  #endif
-  #ifndef CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY
-    #define CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY \
-                              RTEMS_BDBUF_SWAPOUT_WORKER_TASK_PRIORITY_DEFAULT
-  #endif
-  #ifndef CONFIGURE_BDBUF_TASK_STACK_SIZE
-    #define CONFIGURE_BDBUF_TASK_STACK_SIZE \
-                              RTEMS_BDBUF_TASK_STACK_SIZE_DEFAULT
-  #endif
-  #ifndef CONFIGURE_BDBUF_CACHE_MEMORY_SIZE
-    #define CONFIGURE_BDBUF_CACHE_MEMORY_SIZE \
-                              RTEMS_BDBUF_CACHE_MEMORY_SIZE_DEFAULT
-  #endif
-  #ifndef CONFIGURE_BDBUF_BUFFER_MIN_SIZE
-    #define CONFIGURE_BDBUF_BUFFER_MIN_SIZE \
-                              RTEMS_BDBUF_BUFFER_MIN_SIZE_DEFAULT
-  #endif
-  #ifndef CONFIGURE_BDBUF_BUFFER_MAX_SIZE
-    #define CONFIGURE_BDBUF_BUFFER_MAX_SIZE \
-                              RTEMS_BDBUF_BUFFER_MAX_SIZE_DEFAULT
-  #endif
-  #ifndef CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY
-    #define CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY \
-                              RTEMS_BDBUF_READ_AHEAD_TASK_PRIORITY_DEFAULT
-  #endif
-  #ifdef CONFIGURE_INIT
-    const rtems_bdbuf_config rtems_bdbuf_configuration = {
-      CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS,
-      CONFIGURE_BDBUF_MAX_WRITE_BLOCKS,
-      CONFIGURE_SWAPOUT_TASK_PRIORITY,
-      CONFIGURE_SWAPOUT_SWAP_PERIOD,
-      CONFIGURE_SWAPOUT_BLOCK_HOLD,
-      CONFIGURE_SWAPOUT_WORKER_TASKS,
-      CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY,
-      CONFIGURE_BDBUF_TASK_STACK_SIZE,
-      CONFIGURE_BDBUF_CACHE_MEMORY_SIZE,
-      CONFIGURE_BDBUF_BUFFER_MIN_SIZE,
-      CONFIGURE_BDBUF_BUFFER_MAX_SIZE,
-      CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY
-    };
-  #endif
-
-  #define _CONFIGURE_LIBBLOCK_TASKS \
-    (1 + CONFIGURE_SWAPOUT_WORKER_TASKS + \
-    (CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS != 0))
-
-  #define _CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS \
-    (_CONFIGURE_LIBBLOCK_TASKS * \
-    (CONFIGURE_BDBUF_TASK_STACK_SIZE <= CONFIGURE_MINIMUM_TASK_STACK_SIZE ? \
-    0 : CONFIGURE_BDBUF_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE))
-#else
-  /** This specifies the number of libblock tasks. */
-  #define _CONFIGURE_LIBBLOCK_TASKS 0
-  /** This specifies the extra stack space configured for libblock tasks. */
-  #define _CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS 0
-  /** This specifies the number of Classic API semaphores needed by libblock. */
-#endif /* CONFIGURE_APPLICATION_NEEDS_LIBBLOCK */
-/**@}*/
-
 /**
  * @defgroup ConfigurationMultiprocessing Multiprocessing Configuration
  *
@@ -1243,7 +1147,7 @@ struct _reent *__getreent(void)
     _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS + \
     _CONFIGURE_TASKS_STACK + \
     _CONFIGURE_POSIX_THREADS_STACK + \
-    _CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS + \
+    _CONFIGURE_LIBBLOCK_TASKS_STACK_EXTRA + \
     CONFIGURE_EXTRA_TASK_STACKS + \
     _CONFIGURE_HEAP_HANDLER_OVERHEAD \
   )
diff --git a/cpukit/include/rtems/confdefs/bdbuf.h b/cpukit/include/rtems/confdefs/bdbuf.h
new file mode 100644
index 0000000000..6d873eadfa
--- /dev/null
+++ b/cpukit/include/rtems/confdefs/bdbuf.h
@@ -0,0 +1,161 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSApplicationConfiguration
+ *
+ * @brief Evaluate Block Device Cache Configuration Options
+ *
+ * It defines
+ *
+ * - _CONFIGURE_LIBBLOCK_TASKS and
+ *
+ * - _CONFIGURE_LIBBLOCK_TASKS_STACK_EXTRA
+ *
+ * for use by other configuration header files.
+ */
+
+#ifndef _RTEMS_CONFDEFS_BDBUF_H
+#define _RTEMS_CONFDEFS_BDBUF_H
+
+#ifndef __CONFIGURATION_TEMPLATE_h
+#error "Do not include this file directly, use <rtems/confdefs.h> instead"
+#endif
+
+#ifdef CONFIGURE_INIT
+
+#ifdef CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
+
+#include <rtems/confdefs/percpu.h>
+#include <rtems/bdbuf.h>
+
+#ifndef CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS
+  #define CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS \
+    RTEMS_BDBUF_MAX_READ_AHEAD_BLOCKS_DEFAULT
+#endif
+
+#ifndef CONFIGURE_BDBUF_MAX_WRITE_BLOCKS
+  #define CONFIGURE_BDBUF_MAX_WRITE_BLOCKS \
+    RTEMS_BDBUF_MAX_WRITE_BLOCKS_DEFAULT
+#endif
+
+#ifndef CONFIGURE_SWAPOUT_TASK_PRIORITY
+  #define CONFIGURE_SWAPOUT_TASK_PRIORITY \
+    RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT
+#endif
+
+#ifndef CONFIGURE_SWAPOUT_SWAP_PERIOD
+  #define CONFIGURE_SWAPOUT_SWAP_PERIOD \
+    RTEMS_BDBUF_SWAPOUT_TASK_SWAP_PERIOD_DEFAULT
+#endif
+
+#ifndef CONFIGURE_SWAPOUT_BLOCK_HOLD
+  #define CONFIGURE_SWAPOUT_BLOCK_HOLD \
+    RTEMS_BDBUF_SWAPOUT_TASK_BLOCK_HOLD_DEFAULT
+#endif
+
+#ifndef CONFIGURE_SWAPOUT_WORKER_TASKS
+  #define CONFIGURE_SWAPOUT_WORKER_TASKS \
+    RTEMS_BDBUF_SWAPOUT_WORKER_TASKS_DEFAULT
+#endif
+
+#ifndef CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY
+  #define CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY \
+    RTEMS_BDBUF_SWAPOUT_WORKER_TASK_PRIORITY_DEFAULT
+#endif
+
+#ifndef CONFIGURE_BDBUF_TASK_STACK_SIZE
+  #define CONFIGURE_BDBUF_TASK_STACK_SIZE \
+    RTEMS_BDBUF_TASK_STACK_SIZE_DEFAULT
+#endif
+
+#ifndef CONFIGURE_BDBUF_CACHE_MEMORY_SIZE
+  #define CONFIGURE_BDBUF_CACHE_MEMORY_SIZE \
+    RTEMS_BDBUF_CACHE_MEMORY_SIZE_DEFAULT
+#endif
+
+#ifndef CONFIGURE_BDBUF_BUFFER_MIN_SIZE
+  #define CONFIGURE_BDBUF_BUFFER_MIN_SIZE \
+    RTEMS_BDBUF_BUFFER_MIN_SIZE_DEFAULT
+#endif
+
+#ifndef CONFIGURE_BDBUF_BUFFER_MAX_SIZE
+  #define CONFIGURE_BDBUF_BUFFER_MAX_SIZE \
+    RTEMS_BDBUF_BUFFER_MAX_SIZE_DEFAULT
+#endif
+
+#ifndef CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY
+  #define CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY \
+    RTEMS_BDBUF_READ_AHEAD_TASK_PRIORITY_DEFAULT
+#endif
+
+#define _CONFIGURE_LIBBLOCK_TASKS \
+  ( 1 + CONFIGURE_SWAPOUT_WORKER_TASKS \
+    + ( CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS != 0 ) )
+
+#define _CONFIGURE_LIBBLOCK_TASKS_STACK_EXTRA \
+  ( _CONFIGURE_LIBBLOCK_TASKS \
+    * ( CONFIGURE_BDBUF_TASK_STACK_SIZE <= CONFIGURE_MINIMUM_TASK_STACK_SIZE ? \
+       0 : \
+       CONFIGURE_BDBUF_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE ) )
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+const rtems_bdbuf_config rtems_bdbuf_configuration = {
+  CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS,
+  CONFIGURE_BDBUF_MAX_WRITE_BLOCKS,
+  CONFIGURE_SWAPOUT_TASK_PRIORITY,
+  CONFIGURE_SWAPOUT_SWAP_PERIOD,
+  CONFIGURE_SWAPOUT_BLOCK_HOLD,
+  CONFIGURE_SWAPOUT_WORKER_TASKS,
+  CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY,
+  CONFIGURE_BDBUF_TASK_STACK_SIZE,
+  CONFIGURE_BDBUF_CACHE_MEMORY_SIZE,
+  CONFIGURE_BDBUF_BUFFER_MIN_SIZE,
+  CONFIGURE_BDBUF_BUFFER_MAX_SIZE,
+  CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#else /* !CONFIGURE_APPLICATION_NEEDS_LIBBLOCK */
+
+#define _CONFIGURE_LIBBLOCK_TASKS 0
+
+#define _CONFIGURE_LIBBLOCK_TASKS_STACK_EXTRA 0
+
+#endif /* CONFIGURE_APPLICATION_NEEDS_LIBBLOCK */
+
+#endif /* CONFIGURE_INIT */
+
+#endif /* _RTEMS_CONFDEFS_BDBUF_H */
-- 
2.16.4



More information about the devel mailing list