chiark / gitweb /
delete vol_id and require util-linux-ng's blkid
[elogind.git] / extras / volume_id / lib / ddf_raid.c
index 53d309b8c0f63d76a679a8aaa05181d9489a8a41..32f20ced49931119487c07748b916775232449dc 100644 (file)
@@ -50,8 +50,7 @@ int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size)
        const uint8_t *buf;
        struct ddf_header *ddf;
 
-       info("probing at offset 0x%llx, size 0x%llx\n",
-            (unsigned long long)off, (unsigned long long)size);
+       info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size);
        if (size < 0x30000)
                return -1;
 
@@ -62,11 +61,11 @@ int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size)
                return -1;
        ddf = (struct ddf_header *) buf;
        if (memcmp(ddf->signature, "\x11\xde\x11\xde", 4) == 0) {
-               info("header (little endian) found at %llu\n", (unsigned long long)(off + ddf_off));
+               info("header (little endian) found at %" PRIu64 "\n", (off + ddf_off));
                goto found;
        }
        if (memcmp(ddf->signature, "\xde\x11\xde\x11", 4) == 0) {
-               info("header (big endian) found at %llu\n", (unsigned long long)(off + ddf_off));
+               info("header (big endian) found at %" PRIu64 "\n", (off + ddf_off));
                goto found;
        }
 
@@ -77,18 +76,18 @@ int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size)
                return -1;
        ddf = (struct ddf_header *) buf;
        if (memcmp(ddf->signature, "\x11\xde\x11\xde", 4) == 0) {
-               info("header adaptec (little endian) found at %llu\n", (unsigned long long)(off + ddf_off));
+               info("header adaptec (little endian) found at %" PRIu64 "\n", (off + ddf_off));
                goto found;
        }
        if (memcmp(ddf->signature, "\xde\x11\xde\x11", 4) == 0) {
-               info("header adaptec (big endian) found at %llu\n", (unsigned long long)(off + ddf_off));
+               info("header adaptec (big endian) found at %" PRIu64 "\n", (off + ddf_off));
                goto found;
        }
 
        return -1;
 found:
        volume_id_set_uuid(id, ddf->guid, DDF_GUID_LENGTH, UUID_STRING);
-       snprintf(id->type_version, DDF_REV_LENGTH, "%s", ddf->ddf_rev);
+       snprintf(id->type_version, DDF_REV_LENGTH + 1, "%s", ddf->ddf_rev);
        volume_id_set_usage(id, VOLUME_ID_RAID);
        id->type = "ddf_raid_member";
        return 0;