xref: /OK3568_Linux_fs/kernel/drivers/gpu/arm/midgard/tests/include/kutf/kutf_utils.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  *
3  * (C) COPYRIGHT 2014, 2017 ARM Limited. All rights reserved.
4  *
5  * This program is free software and is provided to you under the terms of the
6  * GNU General Public License version 2 as published by the Free Software
7  * Foundation, and any use by you of this program is subject to the terms
8  * of such GNU licence.
9  *
10  * A copy of the licence is included with the program, and can also be obtained
11  * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
12  * Boston, MA  02110-1301, USA.
13  *
14  */
15 
16 
17 
18 #ifndef _KERNEL_UTF_UTILS_H_
19 #define _KERNEL_UTF_UTILS_H_
20 
21 /* kutf_utils.h
22  * Utilities for the kernel UTF test infrastructure.
23  *
24  * This collection of library functions are provided for use by kernel UTF
25  * and users of kernel UTF which don't directly fit within the other
26  * code modules.
27  */
28 
29 #include <kutf/kutf_mem.h>
30 
31 /**
32  * Maximum size of the message strings within kernel UTF, messages longer then
33  * this will be truncated.
34  */
35 #define KUTF_MAX_DSPRINTF_LEN	1024
36 
37 /**
38  * kutf_dsprintf() - dynamic sprintf
39  * @pool:	memory pool to allocate from
40  * @fmt:	The format string describing the string to document.
41  * @...		The parameters to feed in to the format string.
42  *
43  * This function implements sprintf which dynamically allocates memory to store
44  * the string. The library will free the memory containing the string when the
45  * result set is cleared or destroyed.
46  *
47  * Note The returned string may be truncated to fit an internal temporary
48  * buffer, which is KUTF_MAX_DSPRINTF_LEN bytes in length.
49  *
50  * Return: Returns pointer to allocated string, or NULL on error.
51  */
52 const char *kutf_dsprintf(struct kutf_mempool *pool,
53 		const char *fmt, ...);
54 
55 #endif	/* _KERNEL_UTF_UTILS_H_ */
56