Skip to content

Commit f4bed24

Browse files
jackson-cooperdstgloorious
authored andcommitted
[zep fromtree] LIB: Add tfm_vprintf_unpriv
Add the implementation of vprintf for unprivileged logging. This function follows the same signature as the standard library vprintf. Change-Id: I512e1835c0c93e72be46f06508c1b66d67587dbf Signed-off-by: Jackson Cooper-Driver <jackson.cooper-driver@arm.com> (cherry picked from commit 4d5ce0e)
1 parent 26ddbc3 commit f4bed24

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* SPDX-FileCopyrightText: Copyright The TrustedFirmware-M Contributors
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
*
6+
*/
7+
8+
#ifndef __TFM_VPRINTF_UNPRIV_H__
9+
#define __TFM_VPRINTF_UNPRIV_H__
10+
11+
#include <stdarg.h>
12+
13+
void tfm_vprintf_unpriv(const char *fmt, va_list args);
14+
15+
#endif /* __TFM_VPRINTF_UNPRIV_H__ */

lib/tfm_log_unpriv/src/tfm_log_unpriv.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,22 @@ static void output_string_to_buf(void *priv, const char *str, uint32_t len)
4646
data->buf_pos += len;
4747
}
4848

49-
void tfm_log_unpriv(const char *fmt, ...)
49+
void tfm_vprintf_unpriv(const char *fmt, va_list args)
5050
{
51-
va_list args;
5251
struct tfm_log_unpriv_data data;
5352

5453
data.buf_pos = 0;
5554

56-
va_start(args, fmt);
5755
tfm_vprintf(output_string_to_buf, &data, fmt, args);
58-
va_end(args);
5956

6057
output_buf(data.buf, data.buf_pos);
6158
}
59+
60+
void tfm_log_unpriv(const char *fmt, ...)
61+
{
62+
va_list args;
63+
64+
va_start(args, fmt);
65+
tfm_vprintf_unpriv(fmt, args);
66+
va_end(args);
67+
}

0 commit comments

Comments
 (0)