]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/libudev/libudev-util.c
Merge pull request #32588 from CodethinkLabs/mkosi-selinux
[thirdparty/systemd.git] / src / libudev / libudev-util.c
CommitLineData
db9ecf05 1/* SPDX-License-Identifier: LGPL-2.1-or-later */
eb1f0e66 2
07630cea 3#include "device-nodes.h"
5ea78a39 4#include "libudev-util.h"
eb1f0e66 5
0bbe8838
KS
6/**
7 * SECTION:libudev-util
8 * @short_description: utils
21dbe43a
KS
9 *
10 * Utilities useful when dealing with devices and device node names.
0bbe8838
KS
11 */
12
92f43136 13/**
0bbe8838 14 * udev_util_encode_string:
92f43136
KS
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
0bbe8838 21 * corresponding 2 char hex value prefixed by '\x'.
92f43136
KS
22 *
23 * Returns: 0 if the entire string was copied, non-zero otherwise.
24 **/
1544d17f 25_public_ int udev_util_encode_string(const char *str, char *str_enc, size_t len) {
8f6ce71f 26 return encode_devnode_name(str, str_enc, len);
92f43136 27}