/*
- * Copyright (C) 2006-2008 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2006-2009 Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
#include "string.h"
#include "list.h"
#include "sched.h"
+#include "ggo.h"
#include "write.h"
#include "error.h"
ret = wn->writer->open(wn);
if (ret < 0)
goto err_out;
- wn->chunk_bytes = ret;
- g->max_chunk_bytes = PARA_MAX(g->max_chunk_bytes, ret);
}
sprintf(g->task.status, "%s", "writer node group");
register_task(&g->task);
+ g->open = 1;
return 1;
err_out:
PARA_ERROR_LOG("%s\n", para_strerror(-ret));
return ret;
}
-
-/**
- * unregister a writer node group task
- *
- * \param g the group whose task is to be closed
- */
-void wng_unregister(struct writer_node_group *g)
-{
- unregister_task(&g->task);
-}
-
/**
* call the close function of each writer in the given group
*
{
int i;
- if (!g)
+ if (!g || !g->open)
return;
PARA_NOTICE_LOG("closing wng with %d writer(s)\n", g->num_writers);
FOR_EACH_WRITER_NODE(i, g) {
}
/**
- * call the init function of each supported paraslash writer
+ * Call the init function of each supported paraslash writer.
*/
-void init_supported_writers(void)
+void writer_init(void)
{
int i;
wng->writer_nodes[0].conf = writers[DEFAULT_WRITER].parse_config("");
return wng;
}
+
+void print_writer_helps(int detailed)
+{
+ int i;
+
+ printf_or_die("\nAvailable writers: \n\t");
+ FOR_EACH_WRITER(i)
+ printf_or_die("%s%s", i? " " : "", writer_names[i]);
+ printf_or_die("\n\n");
+ FOR_EACH_WRITER(i) {
+ struct writer *w = writers + i;
+
+ if (!w->help.short_help)
+ continue;
+ printf_or_die("Options for %s:\n", writer_names[i]);
+ ggo_print_help(&w->help, detailed);
+ }
+}