summaryrefslogtreecommitdiffstats
path: root/libblkid/src/superblocks/zfs.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:33:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:33:32 +0000
commit8bb05ac73a5b448b339ce0bc8d396c82c459b47f (patch)
tree1fdda006866bca20d41cb206767ea5241e36852f /libblkid/src/superblocks/zfs.c
parentAdding debian version 2.39.3-11. (diff)
downloadutil-linux-8bb05ac73a5b448b339ce0bc8d396c82c459b47f.tar.xz
util-linux-8bb05ac73a5b448b339ce0bc8d396c82c459b47f.zip
Merging upstream version 2.40.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libblkid/src/superblocks/zfs.c')
-rw-r--r--libblkid/src/superblocks/zfs.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/libblkid/src/superblocks/zfs.c b/libblkid/src/superblocks/zfs.c
index 1fcc384..008a200 100644
--- a/libblkid/src/superblocks/zfs.c
+++ b/libblkid/src/superblocks/zfs.c
@@ -71,13 +71,13 @@ struct nvlist {
struct nvpair nvl_nvpair;
};
-static void zfs_process_value(blkid_probe pr, char *name, size_t namelen,
- void *value, size_t max_value_size, unsigned directory_level)
+static void zfs_process_value(blkid_probe pr, const char *name, size_t namelen,
+ const void *value, size_t max_value_size, unsigned directory_level)
{
if (strncmp(name, "name", namelen) == 0 &&
sizeof(struct nvstring) <= max_value_size &&
!directory_level) {
- struct nvstring *nvs = value;
+ const struct nvstring *nvs = value;
uint32_t nvs_type = be32_to_cpu(nvs->nvs_type);
uint32_t nvs_strlen = be32_to_cpu(nvs->nvs_strlen);
@@ -92,7 +92,7 @@ static void zfs_process_value(blkid_probe pr, char *name, size_t namelen,
} else if (strncmp(name, "guid", namelen) == 0 &&
sizeof(struct nvuint64) <= max_value_size &&
!directory_level) {
- struct nvuint64 *nvu = value;
+ const struct nvuint64 *nvu = value;
uint32_t nvu_type = be32_to_cpu(nvu->nvu_type);
uint64_t nvu_value;
@@ -110,7 +110,7 @@ static void zfs_process_value(blkid_probe pr, char *name, size_t namelen,
} else if (strncmp(name, "pool_guid", namelen) == 0 &&
sizeof(struct nvuint64) <= max_value_size &&
!directory_level) {
- struct nvuint64 *nvu = value;
+ const struct nvuint64 *nvu = value;
uint32_t nvu_type = be32_to_cpu(nvu->nvu_type);
uint64_t nvu_value;
@@ -128,7 +128,7 @@ static void zfs_process_value(blkid_probe pr, char *name, size_t namelen,
"%"PRIu64, nvu_value);
} else if (strncmp(name, "ashift", namelen) == 0 &&
sizeof(struct nvuint64) <= max_value_size) {
- struct nvuint64 *nvu = value;
+ const struct nvuint64 *nvu = value;
uint32_t nvu_type = be32_to_cpu(nvu->nvu_type);
uint64_t nvu_value;
@@ -147,9 +147,9 @@ static void zfs_process_value(blkid_probe pr, char *name, size_t namelen,
static void zfs_extract_guid_name(blkid_probe pr, loff_t offset)
{
- unsigned char *p;
- struct nvlist *nvl;
- struct nvpair *nvp;
+ const unsigned char *p;
+ const struct nvlist *nvl;
+ const struct nvpair *nvp;
size_t left = 4096;
unsigned directory_level = 0;
@@ -166,16 +166,16 @@ static void zfs_extract_guid_name(blkid_probe pr, loff_t offset)
DBG(LOWPROBE, ul_debug("zfs_extract: nvlist offset %jd",
(intmax_t)offset));
- nvl = (struct nvlist *) p;
+ nvl = (const struct nvlist *) p;
nvp = &nvl->nvl_nvpair;
- left -= (unsigned char *)nvp - p; /* Already used up 12 bytes */
+ left -= (const unsigned char *)nvp - p; /* Already used up 12 bytes */
while (left > sizeof(*nvp)) {
uint32_t nvp_size = be32_to_cpu(nvp->nvp_size);
uint32_t nvp_namelen = be32_to_cpu(nvp->nvp_namelen);
uint64_t namesize = ((uint64_t)nvp_namelen + 3) & ~3;
size_t max_value_size;
- void *value;
+ const void *value;
if (!nvp->nvp_size) {
if (!directory_level)
@@ -201,7 +201,7 @@ static void zfs_extract_guid_name(blkid_probe pr, loff_t offset)
value = nvp->nvp_name + namesize;
if (sizeof(struct nvdirectory) <= max_value_size) {
- struct nvdirectory *nvu = value;
+ const struct nvdirectory *nvu = value;
if (be32_to_cpu(nvu->nvd_type) == DATA_TYPE_DIRECTORY) {
nvp_size = sizeof(*nvp) + namesize + sizeof(*nvu);
directory_level++;
@@ -259,7 +259,7 @@ static int probe_zfs(blkid_probe pr,
struct zfs_uberblock *ub = NULL;
loff_t offset = 0, ub_offset = 0;
int label_no, found = 0, found_in_label;
- void *label;
+ const void *label;
loff_t blk_align = (pr->size % (256 * 1024ULL));
DBG(PROBE, ul_debug("probe_zfs"));