summaryrefslogtreecommitdiffstats
path: root/sys/geom/concat
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/concat
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/concat')
-rw-r--r--sys/geom/concat/g_concat.c10
-rw-r--r--sys/geom/concat/g_concat.h11
2 files changed, 20 insertions, 1 deletions
diff --git a/sys/geom/concat/g_concat.c b/sys/geom/concat/g_concat.c
index 480b30d..8103ea6 100644
--- a/sys/geom/concat/g_concat.c
+++ b/sys/geom/concat/g_concat.c
@@ -567,6 +567,15 @@ g_concat_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
pp->name);
return (NULL);
}
+ /*
+ * Backward compatibility:
+ * There was no md_provider field in earlier versions of metadata.
+ */
+ if (md.md_version < 3)
+ bzero(md.md_provider, sizeof(md.md_provider));
+
+ if (md.md_provider[0] != '\0' && strcmp(md.md_provider, pp->name) != 0)
+ return (NULL);
/*
* Let's check if device already exists.
@@ -650,6 +659,7 @@ g_concat_ctl_create(struct gctl_req *req, struct g_class *mp)
md.md_id = arc4random();
md.md_no = 0;
md.md_all = *nargs - 1;
+ bzero(md.md_provider, sizeof(md.md_provider));
/* Check all providers are valid */
for (no = 1; no < *nargs; no++) {
diff --git a/sys/geom/concat/g_concat.h b/sys/geom/concat/g_concat.h
index 2c2296f..5cf8757 100644
--- a/sys/geom/concat/g_concat.h
+++ b/sys/geom/concat/g_concat.h
@@ -34,7 +34,13 @@
#define G_CONCAT_CLASS_NAME "CONCAT"
#define G_CONCAT_MAGIC "GEOM::CONCAT"
-#define G_CONCAT_VERSION 2
+/*
+ * Version history:
+ * 1 - Initial version number.
+ * 2 - Added 'stop' command to gconcat(8).
+ * 3 - Added md_provider field to metadata and '-h' option to gconcat(8).
+ */
+#define G_CONCAT_VERSION 3
#ifdef _KERNEL
#define G_CONCAT_TYPE_MANUAL 0
@@ -86,6 +92,7 @@ struct g_concat_metadata {
uint32_t md_id; /* Unique ID. */
uint16_t md_no; /* Disk number. */
uint16_t md_all; /* Number of all disks. */
+ char md_provider[16]; /* Hardcoded provider. */
};
static __inline void
concat_metadata_encode(const struct g_concat_metadata *md, u_char *data)
@@ -97,6 +104,7 @@ concat_metadata_encode(const struct g_concat_metadata *md, u_char *data)
le32enc(data + 36, md->md_id);
le16enc(data + 40, md->md_no);
le16enc(data + 42, md->md_all);
+ bcopy(md->md_provider, data + 44, sizeof(md->md_provider));
}
static __inline void
concat_metadata_decode(const u_char *data, struct g_concat_metadata *md)
@@ -108,5 +116,6 @@ concat_metadata_decode(const u_char *data, struct g_concat_metadata *md)
md->md_id = le32dec(data + 36);
md->md_no = le16dec(data + 40);
md->md_all = le16dec(data + 42);
+ bcopy(data + 44, md->md_provider, sizeof(md->md_provider));
}
#endif /* _G_CONCAT_H_ */
OpenPOWER on IntegriCloud