From edd8d13c0247b8df5876a94c2d61d74d2cf62c7e Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Sat, 12 Jul 2008 20:27:40 +1000 Subject: Create arrays via metadata-update Support creating arrays inside an active ddf container by sending a metadata update over a pipe to mdmon. --- managemon.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'managemon.c') diff --git a/managemon.c b/managemon.c index 1917218..03de9a8 100644 --- a/managemon.c +++ b/managemon.c @@ -428,9 +428,25 @@ void manage(struct mdstat_ent *mdstat, struct supertype *container) } } -static int handle_message(struct supertype *container, struct metadata_update *msg) +static void handle_message(struct supertype *container, struct metadata_update *msg) { - return -1; + /* queue this metadata update through to the monitor */ + + struct metadata_update *mu; + + if (msg->len == 0) { + wait_update_handled(); + } else { + mu = malloc(sizeof(*mu)); + mu->len = msg->len; + mu->buf = msg->buf; + msg->buf = NULL; + mu->space = NULL; + mu->next = NULL; + if (container->ss->prepare_update) + container->ss->prepare_update(container, mu); + queue_metadata_update(mu); + } } void read_sock(struct supertype *container) @@ -460,8 +476,6 @@ void read_sock(struct supertype *container) } else terminate = 1; - if (msg.buf) - free(msg.buf); } while (!terminate); close(fd); -- cgit