1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2
3 #include "device-nodes.h"
4 #include "libudev-util.h"
5
6 /**
7 * SECTION:libudev-util
8 * @short_description: utils
9 *
10 * Utilities useful when dealing with devices and device node names.
11 */
12
13 /**
14 * udev_util_encode_string:
15 * @str: input string to be encoded
16 * @str_enc: output string to store the encoded input string
17 * @len: maximum size of the output string, which may be
18 * four times as long as the input string
19 *
20 * Encode all potentially unsafe characters of a string to the
21 * corresponding 2 char hex value prefixed by '\x'.
22 *
23 * Returns: 0 if the entire string was copied, non-zero otherwise.
24 **/
udev_util_encode_string(const char * str,char * str_enc,size_t len)25 _public_ int udev_util_encode_string(const char *str, char *str_enc, size_t len) {
26 return encode_devnode_name(str, str_enc, len);
27 }
28