mirror of
https://github.com/systemd/systemd.git
synced 2025-02-14 05:57:40 +03:00
loop-util: define API for syncing loopback device
This commit is contained in:
parent
0de3c4f4b7
commit
8dbc208cc1
@ -472,3 +472,18 @@ int loop_device_flock(LoopDevice *d, int operation) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int loop_device_sync(LoopDevice *d) {
|
||||
assert(d);
|
||||
|
||||
/* We also do this implicitly in loop_device_unref(). Doing this explicitly here has the benefit that
|
||||
* we can check the return value though. */
|
||||
|
||||
if (d->fd < 0)
|
||||
return -EBADF;
|
||||
|
||||
if (fsync(d->fd) < 0)
|
||||
return -errno;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -26,3 +26,4 @@ void loop_device_relinquish(LoopDevice *d);
|
||||
int loop_device_refresh_size(LoopDevice *d, uint64_t offset, uint64_t size);
|
||||
|
||||
int loop_device_flock(LoopDevice *d, int operation);
|
||||
int loop_device_sync(LoopDevice *d);
|
||||
|
Loading…
x
Reference in New Issue
Block a user