]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/loop-util.h
Merge pull request #8417 from brauner/2018-03-09/add_bind_mount_fallback_to_private_d...
[thirdparty/systemd.git] / src / shared / loop-util.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5 This file is part of systemd.
6
7 Copyright 2016 Lennart Poettering
8 ***/
9
10 #include "macro.h"
11
12 typedef struct LoopDevice LoopDevice;
13
14 /* Some helpers for setting up loopback block devices */
15
16 struct LoopDevice {
17 int fd;
18 int nr;
19 char *node;
20 bool relinquished;
21 };
22
23 int loop_device_make(int fd, int open_flags, LoopDevice **ret);
24 int loop_device_make_by_path(const char *path, int open_flags, LoopDevice **ret);
25
26 LoopDevice* loop_device_unref(LoopDevice *d);
27 DEFINE_TRIVIAL_CLEANUP_FUNC(LoopDevice*, loop_device_unref);
28
29 void loop_device_relinquish(LoopDevice *d);