X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fnfs.c;h=91e6788631acba20630a3da4434444cde9e5f4f1;hb=a019b6c8144745db63c599680bd693ac02f11666;hp=d54c838852e0dc9a6a6f0c7afebf4a8ae78ac19f;hpb=39d723f4cb1d50b7ebb90c3251f0ebabad576412;p=collectd.git diff --git a/src/nfs.c b/src/nfs.c index d54c8388..91e67886 100644 --- a/src/nfs.c +++ b/src/nfs.c @@ -24,13 +24,8 @@ #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 -#else -# define NFS_HAVE_READ 0 +#if !KERNEL_LINUX +# error "No applicable input method." #endif /* @@ -78,17 +73,6 @@ Number Procedures Procedures 21 commit */ -static data_source_t procedure_dsrc[1] = -{ - {"value", DS_TYPE_COUNTER, 0, 4294967295.0} -}; - -static data_set_t procedure_ds = -{ - "nfs_procedure", 1, procedure_dsrc -}; - -#if NFS_HAVE_READ static const char *nfs2_procedures_names[] = { "null", @@ -204,8 +188,8 @@ static void nfs_procedures_submit (const char *plugin_instance, vl.values = values; vl.values_len = 1; vl.time = time (NULL); - strcpy (vl.host, hostname_g); - strcpy (vl.plugin, "nfs"); + sstrncpy (vl.host, hostname_g, sizeof (vl.host)); + sstrncpy (vl.plugin, "nfs", sizeof (vl.plugin)); strncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance)); @@ -221,7 +205,6 @@ static void nfs_procedures_submit (const char *plugin_instance, } } /* void nfs_procedures_submit */ -#if KERNEL_LINUX static void nfs_read_stats_file (FILE *fh, char *inst) { char buffer[BUFSIZE]; @@ -319,7 +302,6 @@ static void nfs_read_stats_file (FILE *fh, char *inst) } } /* while (fgets (buffer, BUFSIZE, fh) != NULL) */ } /* void nfs_read_stats_file */ -#endif /* defined(KERNEL_LINUX) */ #undef BUFSIZE #if HAVE_LIBKSTAT && 0 @@ -352,7 +334,6 @@ static void nfs2_read_kstat (kstat_t *ksp, char *inst) static int nfs_read (void) { -#if KERNEL_LINUX FILE *fh; if ((fh = fopen ("/proc/net/rpc/nfs", "r")) != NULL) @@ -367,9 +348,7 @@ static int nfs_read (void) fclose (fh); } -/* #endif defined(KERNEL_LINUX) */ - -#elif HAVE_LIBKSTAT && 0 +#if HAVE_LIBKSTAT && 0 if (nfs2_ksp_client != NULL) nfs2_read_kstat (nfs2_ksp_client, "client"); if (nfs2_ksp_server != NULL) @@ -378,15 +357,8 @@ static int nfs_read (void) return (0); } -#endif /* NFS_HAVE_READ */ void module_register (void) { - plugin_register_data_set (&procedure_ds); - -#if NFS_HAVE_READ plugin_register_read ("nfs", nfs_read); -#endif -} - -#undef MODULE_NAME +} /* void module_register */