]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/device-nodes.h
e76a419bb1b69d58968f43a11fab9722edc9ecb6
[thirdparty/systemd.git] / src / basic / device-nodes.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5 This file is part of systemd.
6
7 Copyright 2012 Lennart Poettering
8 ***/
9
10 #include <stddef.h>
11 #include <sys/types.h>
12
13 #include "macro.h"
14 #include "stdio-util.h"
15
16 int encode_devnode_name(const char *str, char *str_enc, size_t len);
17 int whitelisted_char_for_devnode(char c, const char *additional);
18
19 #define DEV_NUM_PATH_MAX \
20 (STRLEN("/dev/block/") + DECIMAL_STR_MAX(dev_t) + 1 + DECIMAL_STR_MAX(dev_t))
21 #define xsprintf_dev_num_path(buf, type, devno) \
22 xsprintf(buf, "/dev/%s/%u:%u", type, major(devno), minor(devno))