Skip to content

Commit 20ea607

Browse files
stream: Rename syslogstream to syslograwstream
to prepare a new stream implementation of syslog Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Signed-off-by: chao an <anchao@xiaomi.com>
1 parent f75adac commit 20ea607

File tree

5 files changed

+49
-48
lines changed

5 files changed

+49
-48
lines changed

drivers/note/notesnap_driver.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,8 @@ void notesnap_dump_with_stream(FAR struct lib_outstream_s *stream)
434434

435435
void notesnap_dump(void)
436436
{
437-
struct lib_syslogstream_s stream;
438-
lib_syslogstream_open(&stream);
437+
struct lib_syslograwstream_s stream;
438+
lib_syslograwstream_open(&stream);
439439
notesnap_dump_with_stream(&stream.public);
440-
lib_syslogstream_close(stream);
440+
lib_syslograwstream_close(stream);
441441
}

drivers/syslog/vsyslog.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static FAR const char * const g_priority_str[] =
8080

8181
int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap)
8282
{
83-
struct lib_syslogstream_s stream;
83+
struct lib_syslograwstream_s stream;
8484
int ret;
8585
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_SYSLOG_PROCESS_NAME)
8686
FAR struct tcb_s *tcb = nxsched_get_tcb(nxsched_gettid());
@@ -100,7 +100,7 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap)
100100
* do the work.
101101
*/
102102

103-
lib_syslogstream_open(&stream);
103+
lib_syslograwstream_open(&stream);
104104

105105
#ifdef CONFIG_SYSLOG_TIMESTAMP
106106
ts.tv_sec = 0;
@@ -263,6 +263,6 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap)
263263

264264
/* Flush and destroy the syslog stream buffer */
265265

266-
lib_syslogstream_close(&stream);
266+
lib_syslograwstream_close(&stream);
267267
return ret;
268268
}

include/nuttx/streams.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ struct lib_bufferedoutstream_s
232232

233233
struct iob_s; /* Forward reference */
234234

235-
struct lib_syslogstream_s
235+
struct lib_syslograwstream_s
236236
{
237237
struct lib_outstream_s public;
238238
#ifdef CONFIG_SYSLOG_BUFFER
@@ -459,42 +459,42 @@ void lib_nullinstream(FAR struct lib_instream_s *nullinstream);
459459
void lib_nulloutstream(FAR struct lib_outstream_s *nulloutstream);
460460

461461
/****************************************************************************
462-
* Name: lib_syslogstream_open
462+
* Name: lib_syslograwstream_open
463463
*
464464
* Description:
465465
* Initializes a stream for use with the configured syslog interface.
466466
* Only accessible from with the OS SYSLOG logic.
467467
*
468468
* Input Parameters:
469469
* stream - User allocated, uninitialized instance of struct
470-
* lib_syslogstream_s to be initialized.
470+
* lib_syslograwstream_s to be initialized.
471471
*
472472
* Returned Value:
473473
* None (User allocated instance initialized).
474474
*
475475
****************************************************************************/
476476

477-
void lib_syslogstream_open(FAR struct lib_syslogstream_s *stream);
477+
void lib_syslograwstream_open(FAR struct lib_syslograwstream_s *stream);
478478

479479
/****************************************************************************
480-
* Name: lib_syslogstream_close
480+
* Name: lib_syslograwstream_close
481481
*
482482
* Description:
483483
* Free resources held by the syslog stream.
484484
*
485485
* Input Parameters:
486486
* stream - User allocated, uninitialized instance of struct
487-
* lib_syslogstream_s to be initialized.
487+
* lib_syslograwstream_s to be initialized.
488488
*
489489
* Returned Value:
490490
* None (Resources freed).
491491
*
492492
****************************************************************************/
493493

494494
#ifdef CONFIG_SYSLOG_BUFFER
495-
void lib_syslogstream_close(FAR struct lib_syslogstream_s *stream);
495+
void lib_syslograwstream_close(FAR struct lib_syslograwstream_s *stream);
496496
#else
497-
# define lib_syslogstream_close(s)
497+
# define lib_syslograwstream_close(s)
498498
#endif
499499

500500
/****************************************************************************

libs/libc/stream/Make.defs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ CSRCS += lib_memsostream.c lib_lowoutstream.c lib_rawinstream.c
2626
CSRCS += lib_rawoutstream.c lib_rawsistream.c lib_rawsostream.c
2727
CSRCS += lib_zeroinstream.c lib_nullinstream.c lib_nulloutstream.c
2828
CSRCS += lib_mtdoutstream.c lib_libnoflush.c lib_libsnoflush.c
29-
CSRCS += lib_syslogstream.c lib_bufferedoutstream.c
29+
CSRCS += lib_syslograwstream.c lib_bufferedoutstream.c
3030

3131
# The remaining sources files depend upon C streams
3232

libs/libc/stream/lib_syslogstream.c renamed to libs/libc/stream/lib_syslograwstream.c

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/****************************************************************************
2-
* libs/libc/stream/lib_syslogstream.c
2+
* libs/libc/stream/lib_syslograwstream.c
33
*
44
* Licensed to the Apache Software Foundation (ASF) under one or more
55
* contributor license agreements. See the NOTICE file distributed with
@@ -36,12 +36,12 @@
3636

3737
#ifdef CONFIG_SYSLOG_BUFFER
3838
/****************************************************************************
39-
* Name: syslogstream_flush
39+
* Name: syslograwstream_flush
4040
****************************************************************************/
4141

42-
static int syslogstream_flush(FAR struct lib_outstream_s *ostream)
42+
static int syslograwstream_flush(FAR struct lib_outstream_s *ostream)
4343
{
44-
FAR struct lib_syslogstream_s *stream = (FAR void *)ostream;
44+
FAR struct lib_syslograwstream_s *stream = (FAR void *)ostream;
4545
int ret = OK;
4646

4747
DEBUGASSERT(stream != NULL);
@@ -72,11 +72,11 @@ static int syslogstream_flush(FAR struct lib_outstream_s *ostream)
7272
}
7373

7474
/****************************************************************************
75-
* Name: syslogstream_addchar
75+
* Name: syslograwstream_addchar
7676
****************************************************************************/
7777

78-
static void syslogstream_addchar(FAR struct lib_syslogstream_s *stream,
79-
int ch)
78+
static void syslograwstream_addchar(FAR struct lib_syslograwstream_s *stream,
79+
int ch)
8080
{
8181
/* Add the incoming character to the buffer */
8282

@@ -93,16 +93,17 @@ static void syslogstream_addchar(FAR struct lib_syslogstream_s *stream,
9393
{
9494
/* Yes.. then flush the buffer */
9595

96-
syslogstream_flush(&stream->public);
96+
syslograwstream_flush(&stream->public);
9797
}
9898
}
9999

100100
/****************************************************************************
101-
* Name: syslogstream_addstring
101+
* Name: syslograwstream_addstring
102102
****************************************************************************/
103103

104-
static int syslogstream_addstring(FAR struct lib_syslogstream_s *stream,
105-
FAR const char *buff, int len)
104+
static int
105+
syslograwstream_addstring(FAR struct lib_syslograwstream_s *stream,
106+
FAR const char *buff, int len)
106107
{
107108
int ret = 0;
108109

@@ -120,7 +121,7 @@ static int syslogstream_addstring(FAR struct lib_syslogstream_s *stream,
120121
{
121122
/* Yes.. then flush the buffer */
122123

123-
syslogstream_flush(&stream->public);
124+
syslograwstream_flush(&stream->public);
124125
}
125126
}
126127
while (ret < len);
@@ -133,13 +134,13 @@ static int syslogstream_addstring(FAR struct lib_syslogstream_s *stream,
133134
#endif
134135

135136
/****************************************************************************
136-
* Name: syslogstream_putc
137+
* Name: syslograwstream_putc
137138
****************************************************************************/
138139

139-
static void syslogstream_putc(FAR struct lib_outstream_s *this, int ch)
140+
static void syslograwstream_putc(FAR struct lib_outstream_s *this, int ch)
140141
{
141-
FAR struct lib_syslogstream_s *stream =
142-
(FAR struct lib_syslogstream_s *)this;
142+
FAR struct lib_syslograwstream_s *stream =
143+
(FAR struct lib_syslograwstream_s *)this;
143144

144145
DEBUGASSERT(stream != NULL);
145146
stream->last_ch = ch;
@@ -155,7 +156,7 @@ static void syslogstream_putc(FAR struct lib_outstream_s *this, int ch)
155156
{
156157
/* Add the incoming character to the buffer */
157158

158-
syslogstream_addchar(stream, ch);
159+
syslograwstream_addchar(stream, ch);
159160
}
160161
else
161162
# endif
@@ -189,11 +190,11 @@ static void syslogstream_putc(FAR struct lib_outstream_s *this, int ch)
189190
}
190191
}
191192

192-
static int syslogstream_puts(FAR struct lib_outstream_s *this,
193-
FAR const void *buff, int len)
193+
static int syslograwstream_puts(FAR struct lib_outstream_s *this,
194+
FAR const void *buff, int len)
194195
{
195-
FAR struct lib_syslogstream_s *stream =
196-
(FAR struct lib_syslogstream_s *)this;
196+
FAR struct lib_syslograwstream_s *stream =
197+
(FAR struct lib_syslograwstream_s *)this;
197198
int ret;
198199

199200
DEBUGASSERT(stream != NULL);
@@ -212,7 +213,7 @@ static int syslogstream_puts(FAR struct lib_outstream_s *this,
212213
{
213214
/* Add the incoming string to the buffer */
214215

215-
ret = syslogstream_addstring(stream, buff, len);
216+
ret = syslograwstream_addstring(stream, buff, len);
216217
}
217218
else
218219
#endif
@@ -250,33 +251,33 @@ static int syslogstream_puts(FAR struct lib_outstream_s *this,
250251
****************************************************************************/
251252

252253
/****************************************************************************
253-
* Name: lib_syslogstream_open
254+
* Name: lib_syslograwstream_open
254255
*
255256
* Description:
256257
* Initializes a stream for use with the configured syslog interface.
257258
* Only accessible from with the OS SYSLOG logic.
258259
*
259260
* Input Parameters:
260261
* stream - User allocated, uninitialized instance of struct
261-
* lib_syslogstream_s to be initialized.
262+
* lib_syslograwstream_s to be initialized.
262263
*
263264
* Returned Value:
264265
* None (User allocated instance initialized).
265266
*
266267
****************************************************************************/
267268

268-
void lib_syslogstream_open(FAR struct lib_syslogstream_s *stream)
269+
void lib_syslograwstream_open(FAR struct lib_syslograwstream_s *stream)
269270
{
270271
DEBUGASSERT(stream != NULL);
271272

272273
/* Initialize the common fields */
273274

274-
stream->public.putc = syslogstream_putc;
275-
stream->public.puts = syslogstream_puts;
275+
stream->public.putc = syslograwstream_putc;
276+
stream->public.puts = syslograwstream_puts;
276277
stream->public.nput = 0;
277278

278279
#ifdef CONFIG_SYSLOG_BUFFER
279-
stream->public.flush = syslogstream_flush;
280+
stream->public.flush = syslograwstream_flush;
280281

281282
/* Allocate an IOB */
282283

@@ -298,22 +299,22 @@ void lib_syslogstream_open(FAR struct lib_syslogstream_s *stream)
298299
}
299300

300301
/****************************************************************************
301-
* Name: lib_syslogstream_close
302+
* Name: lib_syslograwstream_close
302303
*
303304
* Description:
304305
* Free resources held by the syslog stream.
305306
*
306307
* Input Parameters:
307308
* stream - User allocated, uninitialized instance of struct
308-
* lib_syslogstream_s to be initialized.
309+
* lib_syslograwstream_s to be initialized.
309310
*
310311
* Returned Value:
311312
* None (Resources freed).
312313
*
313314
****************************************************************************/
314315

315316
#ifdef CONFIG_SYSLOG_BUFFER
316-
void lib_syslogstream_close(FAR struct lib_syslogstream_s *stream)
317+
void lib_syslograwstream_close(FAR struct lib_syslograwstream_s *stream)
317318
{
318319
DEBUGASSERT(stream != NULL);
319320

@@ -324,15 +325,15 @@ void lib_syslogstream_close(FAR struct lib_syslogstream_s *stream)
324325
{
325326
/* Flush the output buffered in the IOB */
326327

327-
syslogstream_flush(&stream->public);
328+
syslograwstream_flush(&stream->public);
328329

329330
/* Free the IOB */
330331

331332
iob_free(stream->iob);
332333
stream->iob = NULL;
333334
}
334335
# else
335-
syslogstream_flush(&stream->public);
336+
syslograwstream_flush(&stream->public);
336337
# endif
337338
}
338339
#endif

0 commit comments

Comments
 (0)