perl plugin: Exported plugin_log() to Perl.
[collectd.git] / src / nfs.c
index 81f0793..40e4110 100644 (file)
--- a/src/nfs.c
+++ b/src/nfs.c
@@ -24,8 +24,6 @@
 #include "common.h"
 #include "plugin.h"
 
-#define MODULE_NAME "nfs"
-
 /* #if defined(KERNEL_LINUX) || defined(HAVE_LIBKSTAT) */
 #if KERNEL_LINUX
 # define NFS_HAVE_READ 1
@@ -264,9 +262,10 @@ static void nfs_read_stats_file (FILE *fh, char *inst)
                        values = (unsigned long long *) malloc (nfs2_procedures_names_num * sizeof (unsigned long long));
                        if (values == NULL)
                        {
+                               char errbuf[1024];
                                ERROR ("nfs plugin: malloc "
                                                "failed: %s",
-                                               strerror (errno));
+                                               sstrerror (errno, errbuf, sizeof (errbuf)));
                                continue;
                        }
 
@@ -300,9 +299,10 @@ static void nfs_read_stats_file (FILE *fh, char *inst)
                        values = (unsigned long long *) malloc (nfs3_procedures_names_num * sizeof (unsigned long long));
                        if (values == NULL)
                        {
+                               char errbuf[1024];
                                ERROR ("nfs plugin: malloc "
                                                "failed: %s",
-                                               strerror (errno));
+                                               sstrerror (errno, errbuf, sizeof (errbuf)));
                                continue;
                        }
 
@@ -378,13 +378,13 @@ static int nfs_read (void)
 }
 #endif /* NFS_HAVE_READ */
 
-void module_register (void)
+void module_register (modreg_e load)
 {
-       plugin_register_data_set (&procedure_ds);
+       if (load & MR_DATASETS)
+               plugin_register_data_set (&procedure_ds);
 
 #if NFS_HAVE_READ
-       plugin_register_read ("nfs", nfs_read);
+       if (load & MR_READ)
+               plugin_register_read ("nfs", nfs_read);
 #endif
-}
-
-#undef MODULE_NAME
+} /* void module_register */