]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/basic/blockdev-util.h
Merge pull request #8575 from keszybz/non-absolute-paths
[thirdparty/systemd.git] / src / basic / blockdev-util.h
CommitLineData
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
21int block_get_whole_disk(dev_t d, dev_t *ret);
22
23int get_block_device(const char *path, dev_t *dev);
24
25int get_block_device_harder(const char *path, dev_t *dev);