summaryrefslogtreecommitdiffstats
path: root/managemon.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2008-09-18 15:13:32 +1000
committerNeilBrown <neilb@suse.de>2008-09-18 15:13:32 +1000
commit7801ac209240ca5d5159d2ab990dd8d5573e2195 (patch)
tree9eef66102669532a41150d2750c234b6cf658bfe /managemon.c
parent9b2a22d319a85c1571c776e7059d9ca4bf1a0f0a (diff)
downloadmdadm-7801ac209240ca5d5159d2ab990dd8d5573e2195.tar.gz
mdadm-7801ac209240ca5d5159d2ab990dd8d5573e2195.tar.xz
mdadm-7801ac209240ca5d5159d2ab990dd8d5573e2195.zip
Factor out add-disk code
The variety of approaches to 'add_disk' are factored out into a separate function, and Incremental mode benefits by being closer to supporting the assembly of containers. Also remove the adding-to-array-data-structure out of sysfs_add_disk and into add_disk. And add some tests for --incremental mode to make sure we don't break it. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'managemon.c')
-rw-r--r--managemon.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/managemon.c b/managemon.c
index 779cb23..dc3ff7f 100644
--- a/managemon.c
+++ b/managemon.c
@@ -346,7 +346,11 @@ static void manage_member(struct mdstat_ent *mdstat,
struct mdinfo *newd;
if (sysfs_add_disk(&newa->info, d) < 0)
continue;
- newd = newa->info.devs;
+ newd = malloc(sizeof(*newd));
+ *newd = *d;
+ newd->next = newa->info.devs;
+ newa->info.devs = newd;
+
newd->state_fd = sysfs_open(a->devnum,
newd->sys_name,
"state");