summaryrefslogtreecommitdiff
path: root/sys/dev/softraid_raid1.c
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2009-12-15 13:19:38 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2009-12-15 13:19:38 +0000
commit8ed27ec4f664b4978413fa34ae76cb7285d1c652 (patch)
tree45b5fb394bc8c16dd1edd4c81e42098ece90d41c /sys/dev/softraid_raid1.c
parent1fdae7d88513e611e8f7756a3c456d97a6797a16 (diff)
Factor out discipline specific create/assemble code.
"in, in, in!" marco@
Diffstat (limited to 'sys/dev/softraid_raid1.c')
-rw-r--r--sys/dev/softraid_raid1.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/sys/dev/softraid_raid1.c b/sys/dev/softraid_raid1.c
index 939afa3f602..cab77bc65a0 100644
--- a/sys/dev/softraid_raid1.c
+++ b/sys/dev/softraid_raid1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_raid1.c,v 1.20 2009/12/07 14:27:12 jsing Exp $ */
+/* $OpenBSD: softraid_raid1.c,v 1.21 2009/12/15 13:19:37 jsing Exp $ */
/*
* Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
*
@@ -44,6 +44,10 @@
#include <dev/rndvar.h>
/* RAID 1 functions. */
+int sr_raid1_create(struct sr_discipline *, struct bioc_createraid *,
+ int, int64_t);
+int sr_raid1_assemble(struct sr_discipline *, struct bioc_createraid *,
+ int);
int sr_raid1_alloc_resources(struct sr_discipline *);
int sr_raid1_free_resources(struct sr_discipline *);
int sr_raid1_rw(struct sr_workunit *);
@@ -59,10 +63,11 @@ sr_raid1_discipline_init(struct sr_discipline *sd)
sd->sd_type = SR_MD_RAID1;
sd->sd_capabilities = SR_CAP_SYSTEM_DISK | SR_CAP_AUTO_ASSEMBLE |
SR_CAP_REBUILD;
- sd->sd_max_ccb_per_wu = sd->sd_meta->ssdi.ssd_chunk_no;
sd->sd_max_wu = SR_RAID1_NOWU;
/* Setup discipline pointers. */
+ sd->sd_create = sr_raid1_create;
+ sd->sd_assemble = sr_raid1_assemble;
sd->sd_alloc_resources = sr_raid1_alloc_resources;
sd->sd_free_resources = sr_raid1_free_resources;
sd->sd_start_discipline = NULL;
@@ -78,6 +83,32 @@ sr_raid1_discipline_init(struct sr_discipline *sd)
}
int
+sr_raid1_create(struct sr_discipline *sd, struct bioc_createraid *bc,
+ int no_chunk, int64_t coerced_size)
+{
+
+ if (no_chunk < 2)
+ 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;
+
+ return 0;
+}
+
+int
+sr_raid1_assemble(struct sr_discipline *sd, struct bioc_createraid *bc,
+ int no_chunk)
+{
+
+ sd->sd_max_ccb_per_wu = sd->sd_meta->ssdi.ssd_chunk_no;
+
+ return 0;
+}
+
+int
sr_raid1_alloc_resources(struct sr_discipline *sd)
{
int rv = EINVAL;