]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/loop-util.h
update TODO
[thirdparty/systemd.git] / src / shared / loop-util.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
8c1be37e
LP
2#pragma once
3
8c1be37e
LP
4#include "macro.h"
5
6typedef struct LoopDevice LoopDevice;
7
8/* Some helpers for setting up loopback block devices */
9
10struct LoopDevice {
11 int fd;
12 int nr;
13 char *node;
a2ea3b2f 14 bool relinquished;
8c1be37e
LP
15};
16
1b49e3e3 17int loop_device_make(int fd, int open_flags, uint64_t offset, uint64_t size, uint32_t loop_flags, LoopDevice **ret);
e08f94ac 18int loop_device_make_by_path(const char *path, int open_flags, uint32_t loop_flags, LoopDevice **ret);
9dabc4fd 19int loop_device_open(const char *loop_path, int open_flags, LoopDevice **ret);
8c1be37e
LP
20
21LoopDevice* loop_device_unref(LoopDevice *d);
8c1be37e 22DEFINE_TRIVIAL_CLEANUP_FUNC(LoopDevice*, loop_device_unref);
a2ea3b2f
LP
23
24void loop_device_relinquish(LoopDevice *d);
9dabc4fd 25
c37878fc 26int loop_device_refresh_size(LoopDevice *d, uint64_t offset, uint64_t size);
441ec804
LP
27
28int loop_device_flock(LoopDevice *d, int operation);