summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2013-01-15 09:28:30 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2013-01-15 09:28:30 +0000
commit068be0ecc961956b5b84933b2b9f7342aa74cb1e (patch)
tree5136bd528068f2cf3862f4ee6d1765206551fd0a /sys/dev
parentc7e3b3570efae04df3150d5ca168c6cc96822bff (diff)
Always initialise the discipline name, not just when we are doing a create.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/softraid_aoe.c6
-rw-r--r--sys/dev/softraid_concat.c6
-rw-r--r--sys/dev/softraid_crypto.c4
-rw-r--r--sys/dev/softraid_raid0.c4
-rw-r--r--sys/dev/softraid_raid1.c5
-rw-r--r--sys/dev/softraid_raid6.c6
-rw-r--r--sys/dev/softraid_raidp.c12
7 files changed, 18 insertions, 25 deletions
diff --git a/sys/dev/softraid_aoe.c b/sys/dev/softraid_aoe.c
index fd2f53e2880..c7d388bf6c2 100644
--- a/sys/dev/softraid_aoe.c
+++ b/sys/dev/softraid_aoe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_aoe.c,v 1.27 2013/01/15 04:03:01 jsing Exp $ */
+/* $OpenBSD: softraid_aoe.c,v 1.28 2013/01/15 09:28:29 jsing Exp $ */
/*
* Copyright (c) 2008 Ted Unangst <tedu@openbsd.org>
* Copyright (c) 2008 Marco Peereboom <marco@openbsd.org>
@@ -84,6 +84,7 @@ sr_aoe_discipline_init(struct sr_discipline *sd)
/* Fill out discipline members. */
sd->sd_type = SR_MD_AOE_INIT;
+ strlcpy(sd->sd_name, "AOE INIT", sizeof(sd->sd_name));
sd->sd_capabilities = SR_CAP_SYSTEM_DISK;
sd->sd_max_wu = SR_RAIDAOE_NOWU;
@@ -102,6 +103,7 @@ sr_aoe_server_discipline_init(struct sr_discipline *sd)
/* Fill out discipline members. */
sd->sd_type = SR_MD_AOE_TARG;
+ strlcpy(sd->sd_name, "AOE TARG", sizeof(sd->sd_name));
sd->sd_capabilities = 0;
sd->sd_max_wu = SR_RAIDAOE_NOWU;
@@ -132,8 +134,6 @@ sr_aoe_create(struct sr_discipline *sd, struct bioc_createraid *bc,
if (no_chunk != 1)
return EINVAL;
- strlcpy(sd->sd_name, "AOE INIT", sizeof(sd->sd_name));
-
sd->sd_max_ccb_per_wu = no_chunk;
return 0;
diff --git a/sys/dev/softraid_concat.c b/sys/dev/softraid_concat.c
index 279e2073a18..76185df0451 100644
--- a/sys/dev/softraid_concat.c
+++ b/sys/dev/softraid_concat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_concat.c,v 1.4 2013/01/15 04:03:01 jsing Exp $ */
+/* $OpenBSD: softraid_concat.c,v 1.5 2013/01/15 09:28:29 jsing Exp $ */
/*
* Copyright (c) 2008 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2011 Joel Sing <jsing@openbsd.org>
@@ -45,9 +45,9 @@ void sr_concat_intr(struct buf *);
void
sr_concat_discipline_init(struct sr_discipline *sd)
{
-
/* Fill out discipline members. */
sd->sd_type = SR_MD_CONCAT;
+ strlcpy(sd->sd_name, "CONCAT", sizeof(sd->sd_name));
sd->sd_capabilities = SR_CAP_SYSTEM_DISK | SR_CAP_AUTO_ASSEMBLE |
SR_CAP_NON_COERCED;
sd->sd_max_wu = SR_CONCAT_NOWU;
@@ -72,8 +72,6 @@ sr_concat_create(struct sr_discipline *sd, struct bioc_createraid *bc,
return EINVAL;
}
- strlcpy(sd->sd_name, "CONCAT", sizeof(sd->sd_name));
-
sd->sd_meta->ssdi.ssd_size = 0;
for (i = 0; i < no_chunk; i++)
sd->sd_meta->ssdi.ssd_size +=
diff --git a/sys/dev/softraid_crypto.c b/sys/dev/softraid_crypto.c
index dc152f3f1ac..39c8ed86fc2 100644
--- a/sys/dev/softraid_crypto.c
+++ b/sys/dev/softraid_crypto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_crypto.c,v 1.83 2013/01/15 04:03:01 jsing Exp $ */
+/* $OpenBSD: softraid_crypto.c,v 1.84 2013/01/15 09:28:29 jsing Exp $ */
/*
* Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Hans-Joerg Hoexer <hshoexer@openbsd.org>
@@ -114,6 +114,7 @@ sr_crypto_discipline_init(struct sr_discipline *sd)
/* Fill out discipline members. */
sd->sd_type = SR_MD_CRYPTO;
+ strlcpy(sd->sd_name, "CRYPTO", sizeof(sd->sd_name));
sd->sd_capabilities = SR_CAP_SYSTEM_DISK | SR_CAP_AUTO_ASSEMBLE;
sd->sd_max_wu = SR_CRYPTO_NOWU;
@@ -181,7 +182,6 @@ sr_crypto_create(struct sr_discipline *sd, struct bioc_createraid *bc,
if (!(bc->bc_flags & BIOC_SCNOAUTOASSEMBLE) && bc->bc_key_disk == NODEV)
goto done;
- strlcpy(sd->sd_name, "CRYPTO", sizeof(sd->sd_name));
sd->sd_meta->ssdi.ssd_size = coerced_size;
sr_crypto_create_keys(sd);
diff --git a/sys/dev/softraid_raid0.c b/sys/dev/softraid_raid0.c
index 734dc2e4d68..3946e50900d 100644
--- a/sys/dev/softraid_raid0.c
+++ b/sys/dev/softraid_raid0.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_raid0.c,v 1.28 2013/01/15 04:03:01 jsing Exp $ */
+/* $OpenBSD: softraid_raid0.c,v 1.29 2013/01/15 09:28:29 jsing Exp $ */
/*
* Copyright (c) 2008 Marco Peereboom <marco@peereboom.us>
*
@@ -60,6 +60,7 @@ sr_raid0_discipline_init(struct sr_discipline *sd)
/* Fill out discipline members. */
sd->sd_type = SR_MD_RAID0;
+ strlcpy(sd->sd_name, "RAID 0", sizeof(sd->sd_name));
sd->sd_capabilities = SR_CAP_SYSTEM_DISK | SR_CAP_AUTO_ASSEMBLE;
sd->sd_max_wu = SR_RAID0_NOWU;
@@ -85,7 +86,6 @@ sr_raid0_create(struct sr_discipline *sd, struct bioc_createraid *bc,
* XXX add variable strip size later even though MAXPHYS is really
* the clever value, users like to tinker with that type of stuff.
*/
- strlcpy(sd->sd_name, "RAID 0", sizeof(sd->sd_name));
sd->sd_meta->ssdi.ssd_strip_size = MAXPHYS;
sd->sd_meta->ssdi.ssd_size = (coerced_size &
~((sd->sd_meta->ssdi.ssd_strip_size >> DEV_BSHIFT) - 1)) * no_chunk;
diff --git a/sys/dev/softraid_raid1.c b/sys/dev/softraid_raid1.c
index 454f2c3d55a..73e82017e92 100644
--- a/sys/dev/softraid_raid1.c
+++ b/sys/dev/softraid_raid1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_raid1.c,v 1.33 2013/01/15 04:03:01 jsing Exp $ */
+/* $OpenBSD: softraid_raid1.c,v 1.34 2013/01/15 09:28:29 jsing Exp $ */
/*
* Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
*
@@ -60,9 +60,9 @@ void sr_raid1_set_vol_state(struct sr_discipline *);
void
sr_raid1_discipline_init(struct sr_discipline *sd)
{
-
/* Fill out discipline members. */
sd->sd_type = SR_MD_RAID1;
+ strlcpy(sd->sd_name, "RAID 1", sizeof(sd->sd_name));
sd->sd_capabilities = SR_CAP_SYSTEM_DISK | SR_CAP_AUTO_ASSEMBLE |
SR_CAP_REBUILD;
sd->sd_max_wu = SR_RAID1_NOWU;
@@ -88,7 +88,6 @@ sr_raid1_create(struct sr_discipline *sd, struct bioc_createraid *bc,
return EINVAL;
}
- strlcpy(sd->sd_name, "RAID 1", sizeof(sd->sd_name));
sd->sd_meta->ssdi.ssd_size = coerced_size;
sd->sd_max_ccb_per_wu = no_chunk;
diff --git a/sys/dev/softraid_raid6.c b/sys/dev/softraid_raid6.c
index a22a0cbbf19..6a4261cdc83 100644
--- a/sys/dev/softraid_raid6.c
+++ b/sys/dev/softraid_raid6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_raid6.c,v 1.28 2013/01/15 04:03:01 jsing Exp $ */
+/* $OpenBSD: softraid_raid6.c,v 1.29 2013/01/15 09:28:29 jsing Exp $ */
/*
* Copyright (c) 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2009 Jordan Hargrave <jordan@openbsd.org>
@@ -94,12 +94,12 @@ struct sr_raid6_opaque {
void
sr_raid6_discipline_init(struct sr_discipline *sd)
{
-
/* Initialize GF256 tables. */
gf_init();
/* Fill out discipline members. */
sd->sd_type = SR_MD_RAID6;
+ strlcpy(sd->sd_name, "RAID 6", sizeof(sd->sd_name));
sd->sd_capabilities = SR_CAP_SYSTEM_DISK | SR_CAP_AUTO_ASSEMBLE;
sd->sd_max_wu = SR_RAID6_NOWU;
@@ -123,8 +123,6 @@ sr_raid6_create(struct sr_discipline *sd, struct bioc_createraid *bc,
if (no_chunk < 4)
return EINVAL;
- strlcpy(sd->sd_name, "RAID 6", sizeof(sd->sd_name));
-
/*
* XXX add variable strip size later even though MAXPHYS is really
* the clever value, users like * to tinker with that type of stuff.
diff --git a/sys/dev/softraid_raidp.c b/sys/dev/softraid_raidp.c
index 7158852c4ff..ed1bd07394e 100644
--- a/sys/dev/softraid_raidp.c
+++ b/sys/dev/softraid_raidp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_raidp.c,v 1.25 2013/01/15 04:03:01 jsing Exp $ */
+/* $OpenBSD: softraid_raidp.c,v 1.26 2013/01/15 09:28:29 jsing Exp $ */
/*
* Copyright (c) 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2009 Jordan Hargrave <jordan@openbsd.org>
@@ -71,9 +71,12 @@ void sr_put_block(struct sr_discipline *, void *, int);
void
sr_raidp_discipline_init(struct sr_discipline *sd, u_int8_t type)
{
-
/* Fill out discipline members. */
sd->sd_type = type;
+ if (sd->sd_type == SR_MD_RAID4)
+ strlcpy(sd->sd_name, "RAID 4", sizeof(sd->sd_name));
+ else
+ strlcpy(sd->sd_name, "RAID 5", sizeof(sd->sd_name));
sd->sd_capabilities = SR_CAP_SYSTEM_DISK | SR_CAP_AUTO_ASSEMBLE;
sd->sd_max_ccb_per_wu = 4; /* only if stripsize <= MAXPHYS */
sd->sd_max_wu = SR_RAIDP_NOWU;
@@ -98,11 +101,6 @@ sr_raidp_create(struct sr_discipline *sd, struct bioc_createraid *bc,
if (no_chunk < 3)
return EINVAL;
- if (sd->sd_type == SR_MD_RAID4)
- strlcpy(sd->sd_name, "RAID 4", sizeof(sd->sd_name));
- else
- strlcpy(sd->sd_name, "RAID 5", sizeof(sd->sd_name));
-
/*
* XXX add variable strip size later even though MAXPHYS is really
* the clever value, users like to tinker with that type of stuff.