[rtems commit] console: Use IMFS_add_node() for simple console

Sebastian Huber sebh at rtems.org
Wed Mar 4 08:46:26 UTC 2020


Module:    rtems
Branch:    master
Commit:    7e3b5c0ced72ea6ffc79986d26bd9184c61888fa
Changeset: http://git.rtems.org/rtems/commit/?id=7e3b5c0ced72ea6ffc79986d26bd9184c61888fa

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Sat Feb 29 19:41:18 2020 +0100

console: Use IMFS_add_node() for simple console

Change license to BSD-2-Clause according to file history.

Update #3053.
Update #3894.

---

 cpukit/libcsupport/src/consolesimple.c | 55 +++++++++++++++++++++++-----------
 1 file changed, 38 insertions(+), 17 deletions(-)

diff --git a/cpukit/libcsupport/src/consolesimple.c b/cpukit/libcsupport/src/consolesimple.c
index 94aa40c..4316fa3 100644
--- a/cpukit/libcsupport/src/consolesimple.c
+++ b/cpukit/libcsupport/src/consolesimple.c
@@ -1,17 +1,34 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
 /*
- * Copyright (c) 2017 embedded brains GmbH.  All rights reserved.
+ * Copyright (C) 2017, 2020 embedded brains GmbH (http://www.embedded-brains.de)
  *
- *  embedded brains GmbH
- *  Dornierstr. 4
- *  82178 Puchheim
- *  Germany
- *  <rtems at 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.
  *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
+ * 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.
  */
 
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <rtems/console.h>
 #include <rtems/bspIo.h>
 #include <rtems/imfs.h>
@@ -56,18 +73,22 @@ static const rtems_filesystem_file_handlers_r _Console_simple_Handlers = {
 };
 
 static const IMFS_node_control
-_Console_simple_Node_control = IMFS_GENERIC_INITIALIZER(
+_Console_simple_Node_control = IMFS_NODE_CONTROL_INITIALIZER(
   &_Console_simple_Handlers,
   IMFS_node_initialize_default,
-  IMFS_node_destroy_default
+  IMFS_do_nothing_destroy
+);
+
+static const char _Console_simple_Name[] = "console";
+
+static IMFS_jnode_t _Console_simple_Node = IMFS_NODE_INITIALIZER(
+  &_Console_simple_Node_control,
+  _Console_simple_Name,
+  sizeof( _Console_simple_Name ) - 1,
+  S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO
 );
 
 void _Console_simple_Initialize( void )
 {
-  IMFS_make_generic_node(
-    CONSOLE_DEVICE_NAME,
-    S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO,
-    &_Console_simple_Node_control,
-    NULL
-  );
+  IMFS_add_node( "/dev", &_Console_simple_Node, NULL );
 }



More information about the vc mailing list