]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
8c1be37e LP |
2 | #pragma once |
3 | ||
4 | /*** | |
8c1be37e | 5 | Copyright 2016 Lennart Poettering |
8c1be37e LP |
6 | ***/ |
7 | ||
8 | #include "macro.h" | |
9 | ||
10 | typedef struct LoopDevice LoopDevice; | |
11 | ||
12 | /* Some helpers for setting up loopback block devices */ | |
13 | ||
14 | struct LoopDevice { | |
15 | int fd; | |
16 | int nr; | |
17 | char *node; | |
a2ea3b2f | 18 | bool relinquished; |
8c1be37e LP |
19 | }; |
20 | ||
21 | int loop_device_make(int fd, int open_flags, LoopDevice **ret); | |
22 | int loop_device_make_by_path(const char *path, int open_flags, LoopDevice **ret); | |
23 | ||
24 | LoopDevice* loop_device_unref(LoopDevice *d); | |
8c1be37e | 25 | DEFINE_TRIVIAL_CLEANUP_FUNC(LoopDevice*, loop_device_unref); |
a2ea3b2f LP |
26 | |
27 | void loop_device_relinquish(LoopDevice *d); |