1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
7 typedef struct LoopDevice LoopDevice
;
9 /* Some helpers for setting up loopback block devices */
17 uint64_t uevent_seqnum_not_before
; /* uevent sequm right before we attached the loopback device, or UINT64_MAX if we don't know */
18 usec_t timestamp_not_before
; /* CLOCK_MONOTONIC timestamp taken immediately before attaching the loopback device, or USEC_INFINITY if we don't know */
21 int loop_device_make(int fd
, int open_flags
, uint64_t offset
, uint64_t size
, uint32_t loop_flags
, LoopDevice
**ret
);
22 int loop_device_make_by_path(const char *path
, int open_flags
, uint32_t loop_flags
, LoopDevice
**ret
);
23 int loop_device_open(const char *loop_path
, int open_flags
, LoopDevice
**ret
);
25 LoopDevice
* loop_device_unref(LoopDevice
*d
);
26 DEFINE_TRIVIAL_CLEANUP_FUNC(LoopDevice
*, loop_device_unref
);
28 void loop_device_relinquish(LoopDevice
*d
);
30 int loop_device_refresh_size(LoopDevice
*d
, uint64_t offset
, uint64_t size
);
32 int loop_device_flock(LoopDevice
*d
, int operation
);
33 int loop_device_sync(LoopDevice
*d
);