loop: parse and store disk sequence number

When loop devices are re-used, the disk sequence number is increased.
Parse it when creating a loop device and store it.
The kernel will never return DISKSEQ=0, so use it to signal that it's
not supported by the current kernel.
This commit is contained in:
Luca Boccassi
2021-07-28 19:59:38 +01:00
parent 122adcb294
commit bcef1743a5
3 changed files with 39 additions and 0 deletions
+5
View File
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <linux/fs.h>
#include <linux/loop.h>
#ifndef LOOP_CONFIGURE
@@ -13,3 +14,7 @@ struct loop_config {
#define LOOP_CONFIGURE 0x4C0A
#endif
#ifndef BLKGETDISKSEQ
#define BLKGETDISKSEQ _IOR(0x12,128,__u64)
#endif