summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-11-22 19:35:25 +1100
committerNeilBrown <neilb@suse.de>2010-11-22 19:35:25 +1100
commitfeab51f8f710f28a63a5b01ec59a5a609a45525b (patch)
treea12fafbfb76d636720f869a394051eb972609988 /util.c
parent8d86ffefdf9c91d1d01e27c671735b7bd5301e66 (diff)
open_subarray: pass subarray name as explicit arg.
Rather than hiding this arg in the 'st' structure, pass it explicitly. This is a first step to getting rid of 'subarray' from 'supertype'. The strcpy in open_subarray should have better error checking, but it will disappear soon so there is little point. Signed-off-by: NeilBrown <neilb@suse.de.
Diffstat (limited to 'util.c')
-rw-r--r--util.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/util.c b/util.c
index 27989636..b965c8d7 100644
--- a/util.c
+++ b/util.c
@@ -1441,12 +1441,12 @@ int is_container_active(char *container)
/* open_subarray - opens a subarray in a container
* @dev: container device name
- * @st: supertype with only ->subarray set
+ * @st: empty supertype
* @quiet: block reporting errors flag
*
* On success returns an fd to a container and fills in *st
*/
-int open_subarray(char *dev, struct supertype *st, int quiet)
+int open_subarray(char *dev, char *subarray, struct supertype *st, int quiet)
{
struct mdinfo *mdi;
int fd, err = 1;
@@ -1498,6 +1498,8 @@ int open_subarray(char *dev, struct supertype *st, int quiet)
goto free_sysfs;
}
+ strncpy(st->subarray, subarray, sizeof(st->subarray)-1);
+
if (st->ss->load_super(st, fd, NULL)) {
if (!quiet)
fprintf(stderr, Name ": Failed to find subarray-%s in %s\n",