libc: Move syslog_stream from nuttx/streams.h to drivers/syslog/syslog.h

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2021-12-14 01:33:49 +08:00 committed by Xiang Xiao
parent b869c1ce0e
commit 69468b700d
4 changed files with 61 additions and 59 deletions

View File

@ -26,9 +26,29 @@
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/streams.h>
#include <stdbool.h>
/****************************************************************************
* Public Types
****************************************************************************/
/* This is a special stream that does buffered character I/O. NOTE that is
* CONFIG_SYSLOG_BUFFER is not defined, it is the same as struct
* lib_outstream_s
*/
struct iob_s; /* Forward reference */
struct lib_syslogstream_s
{
struct lib_outstream_s public;
#ifdef CONFIG_SYSLOG_BUFFER
FAR struct iob_s *iob;
#endif
};
/****************************************************************************
* Public Data
****************************************************************************/
@ -278,6 +298,45 @@ ssize_t syslog_write(FAR const char *buffer, size_t buflen);
int syslog_force(int ch);
/****************************************************************************
* Name: syslogstream_create
*
* Description:
* Initializes a stream for use with the configured syslog interface.
* Only accessible from with the OS SYSLOG logic.
*
* Input Parameters:
* stream - User allocated, uninitialized instance of struct
* lib_syslogstream_s to be initialized.
*
* Returned Value:
* None (User allocated instance initialized).
*
****************************************************************************/
void syslogstream_create(FAR struct lib_syslogstream_s *stream);
/****************************************************************************
* Name: syslogstream_destroy
*
* Description:
* Free resources held by the syslog stream.
*
* Input Parameters:
* stream - User allocated, uninitialized instance of struct
* lib_syslogstream_s to be initialized.
*
* Returned Value:
* None (Resources freed).
*
****************************************************************************/
#ifdef CONFIG_SYSLOG_BUFFER
void syslogstream_destroy(FAR struct lib_syslogstream_s *stream);
#else
# define syslogstream_destroy(s)
#endif
#undef EXTERN
#ifdef __cplusplus
}

View File

@ -24,12 +24,9 @@
#include <nuttx/config.h>
#include <stdio.h>
#include <unistd.h>
#include <assert.h>
#include <errno.h>
#include <nuttx/streams.h>
#include <nuttx/mm/iob.h>
#include <nuttx/syslog/syslog.h>

View File

@ -32,8 +32,8 @@
#include <nuttx/init.h>
#include <nuttx/arch.h>
#include <nuttx/clock.h>
#include <nuttx/streams.h>
#include <nuttx/syslog/syslog.h>
#include "syslog.h"
/****************************************************************************
* Private Data

View File

@ -173,21 +173,6 @@ struct lib_rawsostream_s
int fd;
};
/* This is a special stream that does buffered character I/O. NOTE that is
* CONFIG_SYSLOG_BUFFER is not defined, it is the same as struct
* lib_outstream_s
*/
struct iob_s; /* Forward reference */
struct lib_syslogstream_s
{
struct lib_outstream_s public;
#ifdef CONFIG_SYSLOG_BUFFER
FAR struct iob_s *iob;
#endif
};
/****************************************************************************
* Public Data
****************************************************************************/
@ -344,45 +329,6 @@ void lib_zeroinstream(FAR struct lib_instream_s *zeroinstream);
void lib_nullinstream(FAR struct lib_instream_s *nullinstream);
void lib_nulloutstream(FAR struct lib_outstream_s *nulloutstream);
/****************************************************************************
* Name: syslogstream_create
*
* Description:
* Initializes a stream for use with the configured syslog interface.
* Only accessible from with the OS SYSLOG logic.
*
* Input Parameters:
* stream - User allocated, uninitialized instance of struct
* lib_syslogstream_s to be initialized.
*
* Returned Value:
* None (User allocated instance initialized).
*
****************************************************************************/
void syslogstream_create(FAR struct lib_syslogstream_s *stream);
/****************************************************************************
* Name: syslogstream_destroy
*
* Description:
* Free resources held by the syslog stream.
*
* Input Parameters:
* stream - User allocated, uninitialized instance of struct
* lib_syslogstream_s to be initialized.
*
* Returned Value:
* None (Resources freed).
*
****************************************************************************/
#ifdef CONFIG_SYSLOG_BUFFER
void syslogstream_destroy(FAR struct lib_syslogstream_s *stream);
#else
# define syslogstream_destroy(s)
#endif
/****************************************************************************
* Name: lib_noflush
*