summaryrefslogtreecommitdiffstats
path: root/sys/geom/stripe
diff options
context:
space:
mode:
Diffstat (limited to 'sys/geom/stripe')
-rw-r--r--sys/geom/stripe/g_stripe.c11
-rw-r--r--sys/geom/stripe/g_stripe.h8
2 files changed, 15 insertions, 4 deletions
diff --git a/sys/geom/stripe/g_stripe.c b/sys/geom/stripe/g_stripe.c
index abf2608..e9dfeba 100644
--- a/sys/geom/stripe/g_stripe.c
+++ b/sys/geom/stripe/g_stripe.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>
+ * Copyright (c) 2004-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -901,13 +901,18 @@ g_stripe_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
}
/*
* Backward compatibility:
- * There was no md_provider field in earlier versions of metadata.
*/
+ /* There was no md_provider field in earlier versions of metadata. */
if (md.md_version < 2)
bzero(md.md_provider, sizeof(md.md_provider));
+ /* There was no md_provsize field in earlier versions of metadata. */
+ if (md.md_version < 3)
+ md.md_provsize = pp->mediasize;
if (md.md_provider[0] != '\0' && strcmp(md.md_provider, pp->name) != 0)
return (NULL);
+ if (md.md_provsize != pp->mediasize)
+ return (NULL);
/*
* Let's check if device already exists.
@@ -999,6 +1004,8 @@ g_stripe_ctl_create(struct gctl_req *req, struct g_class *mp)
}
md.md_stripesize = *stripesize;
bzero(md.md_provider, sizeof(md.md_provider));
+ /* This field is not important here. */
+ md.md_provsize = 0;
/* Check all providers are valid */
for (no = 1; no < *nargs; no++) {
diff --git a/sys/geom/stripe/g_stripe.h b/sys/geom/stripe/g_stripe.h
index 5d73141..b343e23 100644
--- a/sys/geom/stripe/g_stripe.h
+++ b/sys/geom/stripe/g_stripe.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>
+ * Copyright (c) 2004-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -39,8 +39,9 @@
* 0 - Initial version number.
* 1 - Added 'stop' command for gstripe(8).
* 2 - Added md_provider field to metadata and '-h' option for gstripe(8).
+ * 3 - Added md_provsize field to metadata.
*/
-#define G_STRIPE_VERSION 2
+#define G_STRIPE_VERSION 3
#ifdef _KERNEL
#define G_STRIPE_TYPE_MANUAL 0
@@ -88,6 +89,7 @@ struct g_stripe_metadata {
uint16_t md_all; /* Number of all disks. */
uint32_t md_stripesize; /* Stripe size. */
char md_provider[16]; /* Hardcoded provider. */
+ uint64_t md_provsize; /* Provider's size. */
};
static __inline void
stripe_metadata_encode(const struct g_stripe_metadata *md, u_char *data)
@@ -101,6 +103,7 @@ stripe_metadata_encode(const struct g_stripe_metadata *md, u_char *data)
le16enc(data + 42, md->md_all);
le32enc(data + 44, md->md_stripesize);
bcopy(md->md_provider, data + 48, sizeof(md->md_provider));
+ le64enc(data + 64, md->md_provsize);
}
static __inline void
stripe_metadata_decode(const u_char *data, struct g_stripe_metadata *md)
@@ -114,6 +117,7 @@ stripe_metadata_decode(const u_char *data, struct g_stripe_metadata *md)
md->md_all = le16dec(data + 42);
md->md_stripesize = le32dec(data + 44);
bcopy(data + 48, md->md_provider, sizeof(md->md_provider));
+ md->md_provsize = le64dec(data + 64);
}
#ifndef BITCOUNT
OpenPOWER on IntegriCloud