summaryrefslogtreecommitdiffstats
path: root/sys/geom/mirror/g_mirror.h
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2004-08-09 11:29:42 +0000
committerpjd <pjd@FreeBSD.org>2004-08-09 11:29:42 +0000
commita98f2557009185f782b7d19053597e414ef9fb3a (patch)
tree46ee8e035f9336efb5b00d5af5c35f6afc1a3c96 /sys/geom/mirror/g_mirror.h
parent62b3492f0e226a7641b06a30d62538c7d1f6fb17 (diff)
downloadFreeBSD-src-a98f2557009185f782b7d19053597e414ef9fb3a.zip
FreeBSD-src-a98f2557009185f782b7d19053597e414ef9fb3a.tar.gz
- Introduce option for hardcoding providers' names into metadata.
It allows to fix problems when last provider's sector is shared between few providers. - Bump version number for CONCAT and STRIPE and add code for backward compatibility. - Do not bump version number of MIRROR, as it wasn't officially introduced yet. Even if someone started to play with it, there is no big deal, because wrong MD5 sum of metadata will deny those providers. - Update manual pages. - Add version history to g_(stripe|concat).h files.
Diffstat (limited to 'sys/geom/mirror/g_mirror.h')
-rw-r--r--sys/geom/mirror/g_mirror.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/geom/mirror/g_mirror.h b/sys/geom/mirror/g_mirror.h
index 5be5cda..77dc433 100644
--- a/sys/geom/mirror/g_mirror.h
+++ b/sys/geom/mirror/g_mirror.h
@@ -49,6 +49,7 @@
#define G_MIRROR_DISK_FLAG_SYNCHRONIZING 0x0000000000000002ULL
#define G_MIRROR_DISK_FLAG_FORCE_SYNC 0x0000000000000004ULL
#define G_MIRROR_DISK_FLAG_INACTIVE 0x0000000000000008ULL
+#define G_MIRROR_DISK_FLAG_HARDCODED 0x0000000000000010ULL
#define G_MIRROR_DISK_FLAG_MASK (G_MIRROR_DISK_FLAG_DIRTY | \
G_MIRROR_DISK_FLAG_SYNCHRONIZING | \
G_MIRROR_DISK_FLAG_FORCE_SYNC | \
@@ -210,6 +211,7 @@ struct g_mirror_metadata {
uint64_t md_sync_offset; /* Synchronized offset. */
uint64_t md_mflags; /* Additional mirror flags. */
uint64_t md_dflags; /* Additional disk flags. */
+ char md_provider[16]; /* Hardcoded provider. */
u_char md_hash[16]; /* MD5 hash. */
};
static __inline void
@@ -232,10 +234,11 @@ mirror_metadata_encode(struct g_mirror_metadata *md, u_char *data)
le64enc(data + 67, md->md_sync_offset);
le64enc(data + 75, md->md_mflags);
le64enc(data + 83, md->md_dflags);
+ bcopy(md->md_provider, data + 91, 16);
MD5Init(&ctx);
- MD5Update(&ctx, data, 91);
+ MD5Update(&ctx, data, 107);
MD5Final(md->md_hash, &ctx);
- bcopy(md->md_hash, data + 91, 16);
+ bcopy(md->md_hash, data + 107, 16);
}
static __inline int
mirror_metadata_decode(const u_char *data, struct g_mirror_metadata *md)
@@ -257,11 +260,12 @@ mirror_metadata_decode(const u_char *data, struct g_mirror_metadata *md)
md->md_sync_offset = le64dec(data + 67);
md->md_mflags = le64dec(data + 75);
md->md_dflags = le64dec(data + 83);
- bcopy(data + 91, md->md_hash, 16);
+ bcopy(data + 91, md->md_provider, 16);
+ bcopy(data + 107, md->md_hash, 16);
MD5Init(&ctx);
- MD5Update(&ctx, data, 91);
+ MD5Update(&ctx, data, 107);
MD5Final(md->md_hash, &ctx);
- if (bcmp(md->md_hash, data + 91, 16) != 0)
+ if (bcmp(md->md_hash, data + 107, 16) != 0)
return (EINVAL);
return (0);
}
@@ -345,6 +349,7 @@ mirror_metadata_dump(const struct g_mirror_metadata *md)
printf(" INACTIVE");
}
printf("\n");
+ printf("hcprovider: %s\n", md->md_provider);
bzero(hash, sizeof(hash));
for (i = 0; i < 16; i++) {
hash[i * 2] = hex[md->md_hash[i] >> 4];
OpenPOWER on IntegriCloud