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