forked from Imagelibrary/rtems
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:
@@ -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
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* Dornierstr. 4
|
* modification, are permitted provided that the following conditions
|
||||||
* 82178 Puchheim
|
* are met:
|
||||||
* Germany
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* <rtems@embedded-brains.de>
|
* 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
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
* found in the file LICENSE in this distribution or at
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* http://www.rtems.org/license/LICENSE.
|
* 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/console.h>
|
||||||
#include <rtems/bspIo.h>
|
#include <rtems/bspIo.h>
|
||||||
#include <rtems/imfs.h>
|
#include <rtems/imfs.h>
|
||||||
@@ -56,18 +73,22 @@ static const rtems_filesystem_file_handlers_r _Console_simple_Handlers = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const IMFS_node_control
|
static const IMFS_node_control
|
||||||
_Console_simple_Node_control = IMFS_GENERIC_INITIALIZER(
|
_Console_simple_Node_control = IMFS_NODE_CONTROL_INITIALIZER(
|
||||||
&_Console_simple_Handlers,
|
&_Console_simple_Handlers,
|
||||||
IMFS_node_initialize_default,
|
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 )
|
void _Console_simple_Initialize( void )
|
||||||
{
|
{
|
||||||
IMFS_make_generic_node(
|
IMFS_add_node( "/dev", &_Console_simple_Node, NULL );
|
||||||
CONSOLE_DEVICE_NAME,
|
|
||||||
S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO,
|
|
||||||
&_Console_simple_Node_control,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user