console: Use IMFS_add_node() for simple console

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

Update #3053.
Update #3894.
This commit is contained in:
Sebastian Huber
2020-02-29 19:41:18 +01:00
parent fa44c3903a
commit 7e3b5c0ced

View File

@@ -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@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 );
}