|
|
dbeef3 |
From f58a63a3d88cccd5fdf53ead425c5e8186f32cc1 Mon Sep 17 00:00:00 2001
|
|
|
dbeef3 |
From: Andrey Albershteyn <aalbersh@redhat.com>
|
|
|
dbeef3 |
Date: Mon, 2 May 2022 17:08:33 +0200
|
|
|
dbeef3 |
Subject: libblkid: merge FS* flags into one FSINFO
|
|
|
dbeef3 |
|
|
|
dbeef3 |
Put BLOCK_SIZE, FSSIZE and FSLASTBLOCK tags under one FSINFO flag.
|
|
|
dbeef3 |
These, and probably future ones, are read directly from the
|
|
|
dbeef3 |
superblock (with minor post-processing). These properties are
|
|
|
dbeef3 |
combined under one flag to escape adding a flag per superblock
|
|
|
dbeef3 |
member.
|
|
|
dbeef3 |
|
|
|
dbeef3 |
Upstream: http://github.com/util-linux/util-linux/commit/c9b2297eb
|
|
|
dbeef3 |
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2064810
|
|
|
dbeef3 |
Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
|
|
|
dbeef3 |
---
|
|
|
dbeef3 |
libblkid/samples/superblocks.c | 3 +--
|
|
|
dbeef3 |
libblkid/src/blkid.h.in | 23 +++++++++++------------
|
|
|
dbeef3 |
libblkid/src/superblocks/superblocks.c | 9 +++++++--
|
|
|
dbeef3 |
misc-utils/blkid.c | 3 +--
|
|
|
dbeef3 |
4 files changed, 20 insertions(+), 18 deletions(-)
|
|
|
dbeef3 |
|
|
|
dbeef3 |
diff --git a/libblkid/samples/superblocks.c b/libblkid/samples/superblocks.c
|
|
|
dbeef3 |
index b7f94ec14..5253f9cc4 100644
|
|
|
dbeef3 |
--- a/libblkid/samples/superblocks.c
|
|
|
dbeef3 |
+++ b/libblkid/samples/superblocks.c
|
|
|
dbeef3 |
@@ -44,8 +44,7 @@ int main(int argc, char *argv[])
|
|
|
dbeef3 |
BLKID_SUBLKS_UUID | BLKID_SUBLKS_UUIDRAW |
|
|
|
dbeef3 |
BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE |
|
|
|
dbeef3 |
BLKID_SUBLKS_USAGE | BLKID_SUBLKS_VERSION |
|
|
|
dbeef3 |
- BLKID_SUBLKS_MAGIC | BLKID_SUBLKS_FSSIZE |
|
|
|
dbeef3 |
- BLKID_SUBLKS_FSLASTBLOCK);
|
|
|
dbeef3 |
+ BLKID_SUBLKS_MAGIC | BLKID_SUBLKS_FSINFO);
|
|
|
dbeef3 |
|
|
|
dbeef3 |
rc = blkid_do_safeprobe(pr);
|
|
|
dbeef3 |
if (rc == -1)
|
|
|
dbeef3 |
diff --git a/libblkid/src/blkid.h.in b/libblkid/src/blkid.h.in
|
|
|
dbeef3 |
index 56e64f9ab..ae4e555e3 100644
|
|
|
dbeef3 |
--- a/libblkid/src/blkid.h.in
|
|
|
dbeef3 |
+++ b/libblkid/src/blkid.h.in
|
|
|
dbeef3 |
@@ -271,18 +271,17 @@ extern int blkid_superblocks_get_name(size_t idx, const char **name, int *usage)
|
|
|
dbeef3 |
extern int blkid_probe_enable_superblocks(blkid_probe pr, int enable)
|
|
|
dbeef3 |
__ul_attribute__((nonnull));
|
|
|
dbeef3 |
|
|
|
dbeef3 |
-#define BLKID_SUBLKS_LABEL (1 << 1) /* read LABEL from superblock */
|
|
|
dbeef3 |
-#define BLKID_SUBLKS_LABELRAW (1 << 2) /* read and define LABEL_RAW result value*/
|
|
|
dbeef3 |
-#define BLKID_SUBLKS_UUID (1 << 3) /* read UUID from superblock */
|
|
|
dbeef3 |
-#define BLKID_SUBLKS_UUIDRAW (1 << 4) /* read and define UUID_RAW result value */
|
|
|
dbeef3 |
-#define BLKID_SUBLKS_TYPE (1 << 5) /* define TYPE result value */
|
|
|
dbeef3 |
-#define BLKID_SUBLKS_SECTYPE (1 << 6) /* define compatible fs type (second type) */
|
|
|
dbeef3 |
-#define BLKID_SUBLKS_USAGE (1 << 7) /* define USAGE result value */
|
|
|
dbeef3 |
-#define BLKID_SUBLKS_VERSION (1 << 8) /* read FS type from superblock */
|
|
|
dbeef3 |
-#define BLKID_SUBLKS_MAGIC (1 << 9) /* define SBMAGIC and SBMAGIC_OFFSET */
|
|
|
dbeef3 |
-#define BLKID_SUBLKS_BADCSUM (1 << 10) /* allow a bad checksum */
|
|
|
dbeef3 |
-#define BLKID_SUBLKS_FSSIZE (1 << 11) /* read and define FSSIZE from superblock */
|
|
|
dbeef3 |
-#define BLKID_SUBLKS_FSLASTBLOCK (1 << 12) /* read and define FSLASTBLOCK from superblock */
|
|
|
dbeef3 |
+#define BLKID_SUBLKS_LABEL (1 << 1) /* read LABEL from superblock */
|
|
|
dbeef3 |
+#define BLKID_SUBLKS_LABELRAW (1 << 2) /* read and define LABEL_RAW result value*/
|
|
|
dbeef3 |
+#define BLKID_SUBLKS_UUID (1 << 3) /* read UUID from superblock */
|
|
|
dbeef3 |
+#define BLKID_SUBLKS_UUIDRAW (1 << 4) /* read and define UUID_RAW result value */
|
|
|
dbeef3 |
+#define BLKID_SUBLKS_TYPE (1 << 5) /* define TYPE result value */
|
|
|
dbeef3 |
+#define BLKID_SUBLKS_SECTYPE (1 << 6) /* define compatible fs type (second type) */
|
|
|
dbeef3 |
+#define BLKID_SUBLKS_USAGE (1 << 7) /* define USAGE result value */
|
|
|
dbeef3 |
+#define BLKID_SUBLKS_VERSION (1 << 8) /* read FS type from superblock */
|
|
|
dbeef3 |
+#define BLKID_SUBLKS_MAGIC (1 << 9) /* define SBMAGIC and SBMAGIC_OFFSET */
|
|
|
dbeef3 |
+#define BLKID_SUBLKS_BADCSUM (1 << 10) /* allow a bad checksum */
|
|
|
dbeef3 |
+#define BLKID_SUBLKS_FSINFO (1 << 11) /* read and define fs properties from superblock */
|
|
|
dbeef3 |
|
|
|
dbeef3 |
#define BLKID_SUBLKS_DEFAULT (BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID | \
|
|
|
dbeef3 |
BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE)
|
|
|
dbeef3 |
diff --git a/libblkid/src/superblocks/superblocks.c b/libblkid/src/superblocks/superblocks.c
|
|
|
dbeef3 |
index 5b899a830..a1f42c611 100644
|
|
|
dbeef3 |
--- a/libblkid/src/superblocks/superblocks.c
|
|
|
dbeef3 |
+++ b/libblkid/src/superblocks/superblocks.c
|
|
|
dbeef3 |
@@ -562,6 +562,11 @@ int blkid_probe_sprintf_version(blkid_probe pr, const char *fmt, ...)
|
|
|
dbeef3 |
|
|
|
dbeef3 |
int blkid_probe_set_block_size(blkid_probe pr, unsigned block_size)
|
|
|
dbeef3 |
{
|
|
|
dbeef3 |
+ struct blkid_chain *chn = blkid_probe_get_chain(pr);
|
|
|
dbeef3 |
+
|
|
|
dbeef3 |
+ if (!(chn->flags & BLKID_SUBLKS_FSINFO))
|
|
|
dbeef3 |
+ return 0;
|
|
|
dbeef3 |
+
|
|
|
dbeef3 |
return blkid_probe_sprintf_value(pr, "BLOCK_SIZE", "%u", block_size);
|
|
|
dbeef3 |
}
|
|
|
dbeef3 |
|
|
|
dbeef3 |
@@ -591,7 +596,7 @@ int blkid_probe_set_fssize(blkid_probe pr, uint64_t size)
|
|
|
dbeef3 |
{
|
|
|
dbeef3 |
struct blkid_chain *chn = blkid_probe_get_chain(pr);
|
|
|
dbeef3 |
|
|
|
dbeef3 |
- if (!(chn->flags & BLKID_SUBLKS_FSSIZE))
|
|
|
dbeef3 |
+ if (!(chn->flags & BLKID_SUBLKS_FSINFO))
|
|
|
dbeef3 |
return 0;
|
|
|
dbeef3 |
|
|
|
dbeef3 |
return blkid_probe_sprintf_value(pr, "FSSIZE", "%" PRIu64, size);
|
|
|
dbeef3 |
@@ -601,7 +606,7 @@ int blkid_probe_set_fslastblock(blkid_probe pr, uint64_t lastblock)
|
|
|
dbeef3 |
{
|
|
|
dbeef3 |
struct blkid_chain *chn = blkid_probe_get_chain(pr);
|
|
|
dbeef3 |
|
|
|
dbeef3 |
- if (!(chn->flags & BLKID_SUBLKS_FSLASTBLOCK))
|
|
|
dbeef3 |
+ if (!(chn->flags & BLKID_SUBLKS_FSINFO))
|
|
|
dbeef3 |
return 0;
|
|
|
dbeef3 |
|
|
|
dbeef3 |
return blkid_probe_sprintf_value(pr, "FSLASTBLOCK", "%" PRIu64,
|
|
|
dbeef3 |
diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c
|
|
|
dbeef3 |
index f2b190ce3..744151616 100644
|
|
|
dbeef3 |
--- a/misc-utils/blkid.c
|
|
|
dbeef3 |
+++ b/misc-utils/blkid.c
|
|
|
dbeef3 |
@@ -893,8 +893,7 @@ int main(int argc, char **argv)
|
|
|
dbeef3 |
BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID |
|
|
|
dbeef3 |
BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE |
|
|
|
dbeef3 |
BLKID_SUBLKS_USAGE | BLKID_SUBLKS_VERSION |
|
|
|
dbeef3 |
- BLKID_SUBLKS_FSSIZE | BLKID_SUBLKS_FSLASTBLOCK);
|
|
|
dbeef3 |
-
|
|
|
dbeef3 |
+ BLKID_SUBLKS_FSINFO);
|
|
|
dbeef3 |
|
|
|
dbeef3 |
if (fltr_usage &&
|
|
|
dbeef3 |
blkid_probe_filter_superblocks_usage(pr, fltr_flag, fltr_usage))
|
|
|
dbeef3 |
--
|
|
|
dbeef3 |
2.36.1
|
|
|
dbeef3 |
|