+
+ clone = cna_alloc_host ();
+ if (clone == NULL)
+ return (NULL);
+
+ if (host->name != NULL) {
+ clone->name = strdup (host->name);
+ if (clone->name == NULL) {
+ free_host_config (clone);
+ return NULL;
+ }
+ }
+
+ clone->protocol = host->protocol;
+
+ if (host->host != NULL) {
+ clone->host = strdup (host->host);
+ if (clone->host == NULL) {
+ free_host_config (clone);
+ return NULL;
+ }
+ }
+
+ clone->port = host->port;
+
+ if (host->username != NULL) {
+ clone->username = strdup (host->username);
+ if (clone->username == NULL) {
+ free_host_config (clone);
+ return NULL;
+ }
+ }
+ if (host->password != NULL) {
+ clone->password = strdup (host->password);
+ if (clone->password == NULL) {
+ free_host_config (clone);
+ return NULL;
+ }
+ }
+
+ clone->interval = host->interval;
+
+ return (clone);
+} /* }}} host_config_t *cna_shallow_clone_host */
+
+static int cna_read (user_data_t *ud);
+
+static int cna_register_host (host_config_t *host) /* {{{ */
+{
+ char cb_name[256];
+ struct timespec interval;
+ user_data_t ud;
+
+ if (host->vfiler)
+ ssnprintf (cb_name, sizeof (cb_name), "netapp-%s-%s",
+ host->name, host->vfiler);
+ else
+ ssnprintf (cb_name, sizeof (cb_name), "netapp-%s", host->name);
+
+ CDTIME_T_TO_TIMESPEC (host->interval, &interval);
+
+ memset (&ud, 0, sizeof (ud));
+ ud.data = host;
+ ud.free_func = (void (*) (void *)) free_host_config;
+
+ plugin_register_complex_read (/* group = */ NULL, cb_name,
+ /* callback = */ cna_read,
+ /* interval = */ (host->interval > 0) ? &interval : NULL,
+ /* user data = */ &ud);
+
+ return (0);
+} /* }}} int cna_register_host */
+
+static int cna_config_host (host_config_t *host, /* {{{ */
+ const oconfig_item_t *ci)
+{
+ oconfig_item_t *item;
+ _Bool is_vfiler = 0;
+ int status;
+ int i;
+
+ if (! strcasecmp (ci->key, "VFiler"))
+ is_vfiler = 1;
+
+ if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING)) {
+ WARNING ("netapp plugin: \"%s\" needs exactly one string argument. Ignoring host block.", ci->key);
+ return (1);