summaryrefslogtreecommitdiff
path: root/sys/dev/softraid_raidp.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/softraid_raidp.c')
-rw-r--r--sys/dev/softraid_raidp.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/sys/dev/softraid_raidp.c b/sys/dev/softraid_raidp.c
index 7ff4ff89dd2..930e6bc31b3 100644
--- a/sys/dev/softraid_raidp.c
+++ b/sys/dev/softraid_raidp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_raidp.c,v 1.12 2009/12/07 14:33:38 jsing Exp $ */
+/* $OpenBSD: softraid_raidp.c,v 1.13 2009/12/15 13:19:37 jsing Exp $ */
/*
* Copyright (c) 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2009 Jordan Hargrave <jordan@openbsd.org>
@@ -45,6 +45,10 @@
#include <dev/rndvar.h>
/* RAID P functions. */
+int sr_raidp_create(struct sr_discipline *, struct bioc_createraid *,
+ int, int64_t);
+int sr_raidp_assemble(struct sr_discipline *, struct bioc_createraid *,
+ int);
int sr_raidp_alloc_resources(struct sr_discipline *);
int sr_raidp_free_resources(struct sr_discipline *);
int sr_raidp_rw(struct sr_workunit *);
@@ -75,6 +79,8 @@ sr_raidp_discipline_init(struct sr_discipline *sd, u_int8_t type)
sd->sd_max_wu = SR_RAIDP_NOWU;
/* setup discipline pointers. */
+ sd->sd_create = sr_raidp_create;
+ sd->sd_assemble = sr_raidp_assemble;
sd->sd_alloc_resources = sr_raidp_alloc_resources;
sd->sd_free_resources = sr_raidp_free_resources;
sd->sd_start_discipline = NULL;
@@ -91,6 +97,39 @@ sr_raidp_discipline_init(struct sr_discipline *sd, u_int8_t type)
}
int
+sr_raidp_create(struct sr_discipline *sd, struct bioc_createraid *bc,
+ int no_chunk, int64_t coerced_size)
+{
+
+ 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.
+ */
+ 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 - 1);
+
+ return 0;
+}
+
+int
+sr_raidp_assemble(struct sr_discipline *sd, struct bioc_createraid *bc,
+ int no_chunk)
+{
+
+ return 0;
+}
+
+int
sr_raidp_openings(struct sr_discipline *sd)
{
return (sd->sd_max_wu >> 1); /* 2 wu's per IO */