]>
Commit | Line | Data |
---|---|---|
18c528e9 LP |
1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
2 | #pragma once | |
3 | ||
4 | /*** | |
5 | This file is part of systemd. | |
6 | ||
7 | Copyright 2010 Lennart Poettering | |
18c528e9 LP |
8 | ***/ |
9 | ||
10 | #include <sys/types.h> | |
11 | ||
12 | #include "macro.h" | |
13 | #include "stdio-util.h" | |
14 | #include "string-util.h" | |
15 | ||
16 | #define SYS_BLOCK_PATH_MAX(suffix) \ | |
17 | (STRLEN("/sys/dev/block/") + DECIMAL_STR_MAX(dev_t) + 1 + DECIMAL_STR_MAX(dev_t) + strlen_ptr(suffix)) | |
18 | #define xsprintf_sys_block_path(buf, suffix, devno) \ | |
19 | xsprintf(buf, "/sys/dev/block/%u:%u%s", major(devno), minor(devno), strempty(suffix)) | |
20 | ||
21 | int block_get_whole_disk(dev_t d, dev_t *ret); | |
22 | ||
23 | int get_block_device(const char *path, dev_t *dev); | |
24 | ||
25 | int get_block_device_harder(const char *path, dev_t *dev); |