Skip to content

Commit

Permalink
syslog/channel: rename syslog_channel() to syslog_channel_register()
Browse files Browse the repository at this point in the history
Change syslog API naming more reasonable:

1. rename syslog_channel() to syslog_channel_register()
2. rename syslog_channel_remove() to syslog_channel_unregister()

Signed-off-by: chao an <[email protected]>
  • Loading branch information
anchao committed Sep 23, 2024
1 parent 58f25a3 commit ae84ea7
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 40 deletions.
12 changes: 6 additions & 6 deletions Documentation/components/drivers/special/syslog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,14 @@ defined in ``include/nuttx/syslog/syslog.h``:
};
The channel interface is instantiated by calling
:c:func:`syslog_channel()`.
:c:func:`syslog_channel_register()`.

.. c:function:: int syslog_channel(FAR const struct syslog_channel_s *channel);
.. c:function:: int syslog_channel_register(FAR const struct syslog_channel_s *channel);
Configure the SYSLOG function to use the provided
channel to generate SYSLOG output.
``syslog_channel()`` is a non-standard, internal OS interface and
``syslog_channel_register()`` is a non-standard, internal OS interface and
is not available to applications. It may be called numerous times
as necessary to change channel interfaces. By default, all system
log output goes to console (``/dev/console``).
Expand Down Expand Up @@ -363,7 +363,7 @@ serial console is used and ``up_putc()`` is supported.
device is used for a console -- such as a USB console or a Telnet
console. The SYSLOG channel is not redirected as ``stdout`` is;
the SYSLOG channel will stayed fixed (unless it is explicitly
changed via ``syslog_channel()``).
changed via ``syslog_channel_register()``).

References: ``drivers/syslog/syslog_consolechannel.c`` and
``drivers/syslog/syslog_device.c``
Expand Down Expand Up @@ -415,9 +415,9 @@ SYSLOG file channel:
at ``devpath`` as the SYSLOG channel.
This tiny function is simply a wrapper around
``syslog_dev_initialize()`` and ``syslog_channel()``. It calls
``syslog_dev_initialize()`` and ``syslog_channel_register()``. It calls
``syslog_dev_initialize()`` to configure the character file at
``devpath`` then calls ``syslog_channel()`` to use that device as
``devpath`` then calls ``syslog_channel_register()`` to use that device as
the SYSLOG output channel.
File SYSLOG channels differ from other SYSLOG channels in that
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/armv7-m/arm_itm_syslog.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ void itm_syslog_initialize(void)

/* Setup the SYSLOG channel */

syslog_channel(&g_itm_channel);
syslog_channel_register(&g_itm_channel);
}

#endif /* CONFIG_ARMV7M_ITMSYSLOG */
2 changes: 1 addition & 1 deletion arch/arm/src/armv8-m/arm_itm_syslog.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ void itm_syslog_initialize(void)

/* Setup the SYSLOG channel */

syslog_channel(&g_itm_channel);
syslog_channel_register(&g_itm_channel);
}

#endif /* CONFIG_ARMV8M_ITMSYSLOG */
14 changes: 8 additions & 6 deletions drivers/syslog/syslog.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,10 @@ void syslog_dev_uninitialize(FAR struct syslog_channel_s *channel);
* CONFIG_SYSLOG_DEVPATH as the SYSLOG channel.
*
* This tiny function is simply a wrapper around syslog_dev_initialize()
* and syslog_channel(). It calls syslog_dev_initialize() to configure
* the character device at CONFIG_SYSLOG_DEVPATH then calls
* syslog_channel() to use that device as the SYSLOG output channel.
* and syslog_channel_register(). It calls syslog_dev_initialize() to
* configure the character device at CONFIG_SYSLOG_DEVPATH then calls
* syslog_channel_register() to use that device as the SYSLOG output
* channel.
*
* NOTE interrupt level SYSLOG output will be lost in this case unless
* the interrupt buffer is used.
Expand All @@ -137,9 +138,10 @@ FAR struct syslog_channel_s *syslog_dev_channel(void);
* SYSLOG channel.
*
* This tiny function is simply a wrapper around syslog_dev_initialize()
* and syslog_channel(). It calls syslog_dev_initialize() to configure
* the character device at /dev/console then calls syslog_channel() to
* use that device as the SYSLOG output channel.
* and syslog_channel_register(). It calls syslog_dev_initialize() to
* configure the character device at /dev/console then calls
* syslog_channel_register() to use that device as the SYSLOG output
* channel.
*
* NOTE interrupt level SYSLOG output will be lost in the general case
* unless the interrupt buffer is used. As a special case: If the serial
Expand Down
6 changes: 3 additions & 3 deletions drivers/syslog/syslog_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ static ssize_t syslog_default_write(FAR struct syslog_channel_s *channel,
*
****************************************************************************/

int syslog_channel(FAR struct syslog_channel_s *channel)
int syslog_channel_register(FAR struct syslog_channel_s *channel)
{
#if (CONFIG_SYSLOG_MAX_CHANNELS != 1)
int i;
Expand Down Expand Up @@ -313,7 +313,7 @@ int syslog_channel(FAR struct syslog_channel_s *channel)
}

/****************************************************************************
* Name: syslog_channel_remove
* Name: syslog_channel_unregister
*
* Description:
* Removes an already configured SYSLOG channel from the list of used
Expand All @@ -328,7 +328,7 @@ int syslog_channel(FAR struct syslog_channel_s *channel)
*
****************************************************************************/

int syslog_channel_remove(FAR struct syslog_channel_s *channel)
int syslog_channel_unregister(FAR struct syslog_channel_s *channel)
{
int i;

Expand Down
9 changes: 5 additions & 4 deletions drivers/syslog/syslog_consolechannel.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@
* SYSLOG channel.
*
* This tiny function is simply a wrapper around syslog_dev_initialize()
* and syslog_channel(). It calls syslog_dev_initialize() to configure
* the character device at /dev/console then calls syslog_channel() to
* use that device as the SYSLOG output channel.
* and syslog_channel_register(). It calls syslog_dev_initialize() to
* configure the character device at /dev/console then calls
* syslog_channel_register() to use that device as the SYSLOG output
* channel.
*
* NOTE interrupt level SYSLOG output will be lost in the general case
* unless the interrupt buffer is used. As a special case: If the serial
Expand Down Expand Up @@ -86,7 +87,7 @@ FAR struct syslog_channel_s *syslog_console_channel(void)

/* Use the character driver as the SYSLOG channel */

if (syslog_channel(console_channel) != OK)
if (syslog_channel_register(console_channel) != OK)
{
syslog_dev_uninitialize(console_channel);
console_channel = NULL;
Expand Down
9 changes: 5 additions & 4 deletions drivers/syslog/syslog_devchannel.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@
* SYSLOG channel.
*
* This tiny function is simply a wrapper around syslog_dev_initialize()
* and syslog_channel(). It calls syslog_dev_initialize() to configure
* the character device at CONFIG_SYSLOG_DEVPATH then calls
* syslog_channel() to use that device as the SYSLOG output channel.
* and syslog_channel_register(). It calls syslog_dev_initialize() to
* configure the character device at CONFIG_SYSLOG_DEVPATH then calls
* syslog_channel_register() to use that device as the SYSLOG output
* channel.
*
* NOTE interrupt level SYSLOG output will be lost in this case unless
* the interrupt buffer is used.
Expand Down Expand Up @@ -83,7 +84,7 @@ FAR struct syslog_channel_s *syslog_dev_channel(void)

/* Use the character driver as the SYSLOG channel */

if (syslog_channel(dev_channel) != OK)
if (syslog_channel_register(dev_channel) != OK)
{
syslog_dev_uninitialize(dev_channel);
dev_channel = NULL;
Expand Down
9 changes: 5 additions & 4 deletions drivers/syslog/syslog_filechannel.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,10 @@ static void log_rotate(FAR const char *log_file)
* SYSLOG channel.
*
* This tiny function is simply a wrapper around syslog_dev_initialize()
* and syslog_channel(). It calls syslog_dev_initialize() to configure
* the character file at 'devpath then calls syslog_channel() to use that
* device as the SYSLOG output channel.
* and syslog_channel_register(). It calls syslog_dev_initialize() to
* configure the character file at 'devpath then calls
* syslog_channel_register() to use that device as the SYSLOG output
* channel.
*
* File SYSLOG channels differ from other SYSLOG channels in that they
* cannot be established until after fully booting and mounting the target
Expand Down Expand Up @@ -203,7 +204,7 @@ FAR struct syslog_channel_s *syslog_file_channel(FAR const char *devpath)
* screwed.
*/

if (syslog_channel(file_channel) != OK)
if (syslog_channel_register(file_channel) != OK)
{
syslog_dev_uninitialize(file_channel);
file_channel = NULL;
Expand Down
4 changes: 2 additions & 2 deletions drivers/syslog/syslog_initialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
* This function performs these basic operations:
*
* - Initialize the SYSLOG device
* - Call syslog_channel() to begin using that device.
* - Call syslog_channel_register() to begin using that device.
*
* If CONFIG_ARCH_SYSLOG is selected, then the architecture-specifica
* logic will provide its own SYSLOG device initialize which must include
* as a minimum a call to syslog_channel() to use the device.
* as a minimum a call to syslog_channel_register() to use the device.
*
* Input Parameters:
* None
Expand Down
19 changes: 10 additions & 9 deletions include/nuttx/syslog/syslog.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ extern "C"
****************************************************************************/

/****************************************************************************
* Name: syslog_channel
* Name: syslog_channel_register
*
* Description:
* Configure the SYSLOGging function to use the provided channel to
Expand All @@ -179,10 +179,10 @@ extern "C"
*
****************************************************************************/

int syslog_channel(FAR struct syslog_channel_s *channel);
int syslog_channel_register(FAR struct syslog_channel_s *channel);

/****************************************************************************
* Name: syslog_channel_remove
* Name: syslog_channel_unregister
*
* Description:
* Removes an already configured SYSLOG channel from the list of used
Expand All @@ -197,7 +197,7 @@ int syslog_channel(FAR struct syslog_channel_s *channel);
*
****************************************************************************/

int syslog_channel_remove(FAR struct syslog_channel_s *channel);
int syslog_channel_unregister(FAR struct syslog_channel_s *channel);

/****************************************************************************
* Name: syslog_initialize
Expand All @@ -211,11 +211,11 @@ int syslog_channel_remove(FAR struct syslog_channel_s *channel);
* This function performs these basic operations:
*
* - Initialize the SYSLOG device
* - Call syslog_channel() to begin using that device.
* - Call syslog_channel_register() to begin using that device.
*
* If CONFIG_ARCH_SYSLOG is selected, then the architecture-specifica
* logic will provide its own SYSLOG device initialize which must include
* as a minimum a call to syslog_channel() to use the device.
* as a minimum a call to syslog_channel_register() to use the device.
*
* Input Parameters:
* None
Expand All @@ -240,9 +240,10 @@ int syslog_initialize(void);
* SYSLOG channel.
*
* This tiny function is simply a wrapper around syslog_dev_initialize()
* and syslog_channel(). It calls syslog_dev_initialize() to configure
* the character file at 'devpath then calls syslog_channel() to use that
* device as the SYSLOG output channel.
* and syslog_channel_register(). It calls syslog_dev_initialize() to
* configure the character file at 'devpath then calls
* syslog_channel_register() to use that device as the SYSLOG output
* channel.
*
* File SYSLOG channels differ from other SYSLOG channels in that they
* cannot be established until after fully booting and mounting the target
Expand Down

0 comments on commit ae84ea7

Please sign in to comment.