ramlog: Remove g_ramlog_syslog_channel since it's same as g_default_channel

And remove syslog_init_e because all initialization is later now and we don't
distinguish the initialition phase anymore after ramlog don't need special
initialize.
This commit is contained in:
Xiang Xiao 2020-02-18 16:40:59 +08:00 committed by Gregory Nutt
parent dcaaf2d912
commit 51a2171c71
20 changed files with 26 additions and 219 deletions

View File

@ -6668,9 +6668,9 @@ int syslog_channel(FAR const struct syslog_channel_s *channel);
<ul><pre>
#include &lt;nuttx/syslog/syslog.h&gt;
#ifndef CONFIG_ARCH_SYSLOG
int syslog_initialize(enum syslog_init_e phase);
int syslog_initialize(void);
#else
# define syslog_initialize(phase)
# define syslog_initialize()
#endif
</ul></pre>
<p><b>Description:</b>
@ -6693,13 +6693,6 @@ int syslog_initialize(enum syslog_init_e phase);
If <code>CONFIG_ARCH_SYSLOG</code> is selected, then the architecture-specific logic will provide its own SYSLOG device initialize which must include as a minimum a call to <code>syslog_channel()</code> to use the device.
</li>
</ul>
<p><b>Input Parameters:</b>
<ul>
<li>
<p>
<code>phase</code>: One of {<code>SYSLOG_INIT_EARLY</code>, <code>SYSLOG_INIT_LATE</code>}
</li>
</ul>
<p><b>Returned Value:</b>
Zero (<code>OK</code>) is returned on success; a negated <code>errno</code> value is returned on any failure.
</p>
@ -6707,19 +6700,8 @@ int syslog_initialize(enum syslog_init_e phase);
Different types of SYSLOG devices have different OS initialization
requirements. Some are available immediately at reset, some are available
after some basic OS initialization, and some only after OS is fully
initialized. In order to satisfy these different initialization
requirements, <code>syslog_initialize()</code> is called twice from the boot-up logic:
initialized.
</p>
<ul>
<li>
<p>
<code>syslog_initialize()</code> is called from the architecture-specific <code>up_initialize()</code> function as some as basic hardware resources have been initialized: Timers, interrupts, etc. In this case, <code>syslog_initialize()</code> is called with the argument <code>SYSLOG_INIT_EARLY</code>.
</li>
<li>
<p>
<code>syslog_initialize()</code> is called again from <code>nx_start()</code> when the full OS initialization has completed, just before the application main entry point is spawned. In this case, <code>syslog_initialize()</code> is called with the argument <code>SYSLOG_INIT_LATE</code>.
</li>
</ul>
<p>
There are other types of SYSLOG channel devices that may require even further initialization. For example, the file SYSLOG channel (described below) cannot be initialized until the necessary file systems have been mounted.
</p>

View File

@ -49,7 +49,6 @@
#include <nuttx/net/loopback.h>
#include <nuttx/net/tun.h>
#include <nuttx/net/telnet.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/syslog/syslog_console.h>
#include <nuttx/serial/pty.h>
#include <nuttx/crypto/crypto.h>
@ -201,13 +200,6 @@ void up_initialize(void)
ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
* can be initialized early in the initialization sequence because they
* depend on only minimal OS initialization.
*/
syslog_initialize(SYSLOG_INIT_EARLY);
#if defined(CONFIG_CRYPTO)
/* Initialize the HW crypto and /dev/crypto */

View File

@ -48,7 +48,6 @@
#include <nuttx/net/loopback.h>
#include <nuttx/net/tun.h>
#include <nuttx/net/telnet.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/syslog/syslog_console.h>
#include <nuttx/serial/pty.h>
#include <nuttx/crypto/crypto.h>
@ -230,13 +229,6 @@ void up_initialize(void)
ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
* can be initialized early in the initialization sequence because they
* depend on only minimal OS initialization.
*/
syslog_initialize(SYSLOG_INIT_EARLY);
#if defined(CONFIG_CRYPTO)
/* Initialize the HW crypto and /dev/crypto */

View File

@ -49,7 +49,6 @@
#include <nuttx/net/loopback.h>
#include <nuttx/net/tun.h>
#include <nuttx/net/telnet.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/syslog/syslog_console.h>
#include <nuttx/serial/pty.h>
#include <nuttx/crypto/crypto.h>
@ -163,13 +162,6 @@ void up_initialize(void)
ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
* can be initialized early in the initialization sequence because they
* depend on only minimal OS initialization.
*/
syslog_initialize(SYSLOG_INIT_EARLY);
#if defined(CONFIG_CRYPTO)
/* Initialize the HW crypto and /dev/crypto */

View File

@ -49,7 +49,6 @@
#include <nuttx/net/loopback.h>
#include <nuttx/net/tun.h>
#include <nuttx/net/telnet.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/syslog/syslog_console.h>
#include <nuttx/serial/pty.h>
#include <nuttx/crypto/crypto.h>
@ -165,13 +164,6 @@ void up_initialize(void)
ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
* can be initialized early in the initialization sequence because they
* depend on only minimal OS initialization.
*/
syslog_initialize(SYSLOG_INIT_EARLY);
#if defined(CONFIG_CRYPTO)
/* Initialize the HW crypto and /dev/crypto */

View File

@ -49,7 +49,6 @@
#include <nuttx/net/loopback.h>
#include <nuttx/net/tun.h>
#include <nuttx/net/telnet.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/syslog/syslog_console.h>
#include <nuttx/serial/pty.h>
#include <nuttx/crypto/crypto.h>
@ -256,13 +255,6 @@ void up_initialize(void)
ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
* can be initialized early in the initialization sequence because they
* depend on only minimal OS initialization.
*/
syslog_initialize(SYSLOG_INIT_EARLY);
/* Print OpenRISC CPU information */
or1k_print_cpuinfo();

View File

@ -49,7 +49,6 @@
#include <nuttx/net/loopback.h>
#include <nuttx/net/tun.h>
#include <nuttx/net/telnet.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/syslog/syslog_console.h>
#include <nuttx/serial/pty.h>
#include <nuttx/crypto/crypto.h>
@ -149,13 +148,6 @@ void up_initialize(void)
ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
* can be initialized early in the initialization sequence because they
* depend on only minimal OS initialization.
*/
syslog_initialize(SYSLOG_INIT_EARLY);
#if defined(CONFIG_CRYPTO)
/* Initialize the HW crypto and /dev/crypto */

View File

@ -44,7 +44,6 @@
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <nuttx/serial/pty.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/drivers/drivers.h>
#include <arch/board/board.h>
@ -147,12 +146,5 @@ void up_initialize(void)
ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
* can be initialized early in the initialization sequence because they
* depend on only minimal OS initialization.
*/
syslog_initialize(SYSLOG_INIT_EARLY);
board_autoled_on(LED_IRQSENABLED);
}

View File

@ -50,7 +50,6 @@
#include <nuttx/net/tun.h>
#include <nuttx/net/telnet.h>
#include <nuttx/mtd/mtd.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/syslog/syslog_console.h>
#include <nuttx/serial/pty.h>
#include <nuttx/crypto/crypto.h>
@ -240,13 +239,6 @@ void up_initialize(void)
ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
* can be initialized early in the initialization sequence because they
* depend on only minimal OS initialization.
*/
syslog_initialize(SYSLOG_INIT_EARLY);
#if defined(CONFIG_CRYPTO)
/* Initialize the HW crypto and /dev/crypto */

View File

@ -49,7 +49,6 @@
#include <nuttx/net/loopback.h>
#include <nuttx/net/tun.h>
#include <nuttx/net/telnet.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/syslog/syslog_console.h>
#include <nuttx/serial/pty.h>
#include <nuttx/crypto/crypto.h>
@ -165,13 +164,6 @@ void up_initialize(void)
ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
* can be initialized early in the initialization sequence because they
* depend on only minimal OS initialization.
*/
syslog_initialize(SYSLOG_INIT_EARLY);
#if defined(CONFIG_CRYPTO)
/* Initialize the HW crypto and /dev/crypto */

View File

@ -49,7 +49,6 @@
#include <nuttx/net/loopback.h>
#include <nuttx/net/tun.h>
#include <nuttx/net/telnet.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/syslog/syslog_console.h>
#include <nuttx/serial/pty.h>
#include <nuttx/crypto/crypto.h>
@ -173,13 +172,6 @@ void up_initialize(void)
ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
* can be initialized early in the initialization sequence because they
* depend on only minimal OS initialization.
*/
syslog_initialize(SYSLOG_INIT_EARLY);
#if defined(CONFIG_CRYPTO)
/* Initialize the HW crypto and /dev/crypto */

View File

@ -49,7 +49,6 @@
#include <nuttx/net/loopback.h>
#include <nuttx/net/tun.h>
#include <nuttx/net/telnet.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/syslog/syslog_console.h>
#include <nuttx/serial/pty.h>
#include <nuttx/crypto/crypto.h>
@ -165,13 +164,6 @@ void up_initialize(void)
ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
* can be initialized early in the initialization sequence because they
* depend on only minimal OS initialization.
*/
syslog_initialize(SYSLOG_INIT_EARLY);
#if defined(CONFIG_CRYPTO)
/* Initialize the HW crypto and /dev/crypto */

View File

@ -50,7 +50,6 @@
#include <nuttx/net/loopback.h>
#include <nuttx/net/telnet.h>
#include <nuttx/net/tun.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/syslog/syslog_console.h>
#include <nuttx/serial/pty.h>
#include <nuttx/crypto/crypto.h>
@ -164,13 +163,6 @@ void up_initialize(void)
ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
* can be initialized early in the initialization sequence because they
* depend on minimal OS initialization.
*/
syslog_initialize(SYSLOG_INIT_EARLY);
#if defined(CONFIG_CRYPTO)
/* Initialize the HW crypto and /dev/crypto */

View File

@ -189,9 +189,9 @@ SYSLOG Channels
Prototype:
#ifndef CONFIG_ARCH_SYSLOG
int syslog_initialize(enum syslog_init_e phase);
int syslog_initialize(void);
#else
# define syslog_initialize(phase)
# define syslog_initialize()
#endif
Description:
@ -209,10 +209,6 @@ SYSLOG Channels
logic will provide its own SYSLOG device initialize which must include
as a minimum a call to syslog_channel() to use the device.
Input Parameters:
* phase - One of {SYSLOG_INIT_EARLY, SYSLOG_INIT_LATE}
Returned Value:
Zero (OK) is returned on success; a negated errno value is returned on
any failure.
@ -220,17 +216,7 @@ SYSLOG Channels
Different types of SYSLOG devices have different OS initialization
requirements. Some are available immediately at reset, some are available
after some basic OS initialization, and some only after OS is fully
initialized. In order to satisfy these different initialization
requirements, syslog_initialize() is called twice from the boot-up logic:
* syslog_initialize() is called from the architecture-specific
up_initialize() function as some as basic hardware resources have been
initialized: Timers, interrupts, etc. In this case,
syslog_initialize() is called with the argument SYSLOG_INIT_EARLY.
* syslog_initialize() is called again from nx_start() when the full OS
initialization has completed, just before the application main entry
point is spawned. In this case, syslog_initialize() is called with
the argument SYSLOG_INIT_LATE.
initialized.
There are other types of SYSLOG channel devices that may require even
further initialization. For example, the file SYSLOG channel (described

View File

@ -93,12 +93,6 @@ struct ramlog_dev_s
* Private Function Prototypes
****************************************************************************/
/* Syslog channel methods */
#ifdef CONFIG_RAMLOG_SYSLOG
static int ramlog_flush(void);
#endif
/* Helper functions */
#ifndef CONFIG_RAMLOG_NONBLOCKING
@ -117,19 +111,6 @@ static ssize_t ramlog_write(FAR struct file *filep, FAR const char *buffer,
static int ramlog_poll(FAR struct file *filep, FAR struct pollfd *fds,
bool setup);
/****************************************************************************
* Private Data
****************************************************************************/
#ifdef CONFIG_RAMLOG_SYSLOG
static const struct syslog_channel_s g_ramlog_syslog_channel =
{
ramlog_putc,
ramlog_putc,
ramlog_flush
};
#endif
/****************************************************************************
* Private Data
****************************************************************************/
@ -180,17 +161,6 @@ static struct ramlog_dev_s g_sysdev =
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: ramlog_flush
****************************************************************************/
#ifdef CONFIG_RAMLOG_SYSLOG
static int ramlog_flush(void)
{
return OK;
}
#endif
/****************************************************************************
* Name: ramlog_readnotify
****************************************************************************/
@ -720,7 +690,7 @@ int ramlog_register(FAR const char *devpath, FAR char *buffer, size_t buflen)
}
/****************************************************************************
* Name: ramlog_syslog_channel
* Name: ramlog_syslog_register
*
* Description:
* Use a pre-allocated RAM logging device and register it at the path
@ -729,21 +699,11 @@ int ramlog_register(FAR const char *devpath, FAR char *buffer, size_t buflen)
****************************************************************************/
#ifdef CONFIG_RAMLOG_SYSLOG
int ramlog_syslog_channel(void)
void ramlog_syslog_register(void)
{
int ret;
/* Register the syslog character driver */
ret = register_driver(CONFIG_SYSLOG_DEVPATH, &g_ramlogfops, 0666, &g_sysdev);
if (ret < 0)
{
return ret;
}
/* Use the RAMLOG as the SYSLOG channel */
return syslog_channel(&g_ramlog_syslog_channel);
register_driver(CONFIG_SYSLOG_DEVPATH, &g_ramlogfops, 0666, &g_sysdev);
}
#endif

View File

@ -178,8 +178,7 @@ int syslog_file_channel(FAR const char *devpath)
{
/* We should still be able to back-up and re-initialized everything */
syslog_initialize(SYSLOG_INIT_EARLY);
syslog_initialize(SYSLOG_INIT_LATE);
syslog_channel(saved_channel);
goto errout_with_lock;
}

View File

@ -71,7 +71,7 @@
* as a minimum a call to syslog_channel() to use the device.
*
* Input Parameters:
* phase - One of {SYSLOG_INIT_EARLY, SYSLOG_INIT_LATE}
* None
*
* Returned Value:
* Zero (OK) is returned on success; a negated errno value is returned on
@ -79,41 +79,26 @@
*
****************************************************************************/
int syslog_initialize(enum syslog_init_e phase)
int syslog_initialize(void)
{
int ret = OK;
#if defined(CONFIG_SYSLOG_CHAR)
if (phase == SYSLOG_INIT_LATE)
{
/* Enable use of a character device as the SYSLOG device */
ret = syslog_dev_channel();
}
#elif defined(CONFIG_RAMLOG_SYSLOG)
if (phase == SYSLOG_INIT_EARLY)
{
/* Use the RAMLOG as the SYSLOG device */
ret = ramlog_syslog_channel();
}
/* Enable use of a character device as the SYSLOG device */
ret = syslog_dev_channel();
#elif defined(CONFIG_SYSLOG_CONSOLE)
if (phase == SYSLOG_INIT_LATE)
{
/* Use the console device as the SYSLOG device */
/* Use the console device as the SYSLOG device */
ret = syslog_console_channel();
}
ret = syslog_console_channel();
#endif
#ifdef CONFIG_RAMLOG_SYSLOG
ramlog_syslog_register();
#endif
#ifdef CONFIG_SYSLOG_CHARDEV
if (phase == SYSLOG_INIT_EARLY)
{
syslog_register();
}
syslog_register();
#endif
return ret;

View File

@ -130,7 +130,7 @@ extern "C"
int ramlog_register(FAR const char *devpath, FAR char *buffer, size_t buflen);
/****************************************************************************
* Name: ramlog_syslog_channel
* Name: ramlog_syslog_register
*
* Description:
* Create the RAM logging device and register it at the specified path.
@ -139,7 +139,7 @@ int ramlog_register(FAR const char *devpath, FAR char *buffer, size_t buflen);
****************************************************************************/
#ifdef CONFIG_RAMLOG_SYSLOG
int ramlog_syslog_channel(void);
void ramlog_syslog_register(void);
#endif
/****************************************************************************

View File

@ -97,15 +97,6 @@
* Public Types
****************************************************************************/
/* Initialization phases */
enum syslog_init_e
{
SYSLOG_INIT_RESET = 0, /* Power on SYSLOG initialization phase */
SYSLOG_INIT_EARLY, /* Early initialization in up_initialize() */
SYSLOG_INIT_LATE /* Late initialization in nx_start(). */
};
/* This structure provides the interface to a SYSLOG device */
typedef CODE ssize_t (*syslog_write_t)(FAR const char *buf, size_t buflen);
@ -181,7 +172,7 @@ int syslog_channel(FAR const struct syslog_channel_s *channel);
* as a minimum a call to syslog_channel() to use the device.
*
* Input Parameters:
* phase - One of {SYSLOG_INIT_EARLY, SYSLOG_INIT_LATE}
* None
*
* Returned Value:
* Zero (OK) is returned on success; a negated errno value is returned on
@ -190,9 +181,9 @@ int syslog_channel(FAR const struct syslog_channel_s *channel);
****************************************************************************/
#ifndef CONFIG_ARCH_SYSLOG
int syslog_initialize(enum syslog_init_e phase);
int syslog_initialize(void);
#else
# define syslog_initialize(phase)
# define syslog_initialize()
#endif
/****************************************************************************

View File

@ -801,7 +801,7 @@ void nx_start(void)
* depend on having IDLE task file structures setup.
*/
syslog_initialize(SYSLOG_INIT_LATE);
syslog_initialize();
#ifdef CONFIG_SMP
/* Start all CPUs *********************************************************/