aboutsummaryrefslogtreecommitdiff
path: root/plugins/utils_disk.c
diff options
context:
space:
mode:
authorGravatar Ton Voon <tonvoon@users.sourceforge.net> 2006-07-12 22:53:27 +0000
committerGravatar Ton Voon <tonvoon@users.sourceforge.net> 2006-07-12 22:53:27 +0000
commita46e358d68027289cffaffeb7a4b32ababb2105b (patch)
tree0d426cd3d3a360c98e048cb2cc63d6faceedbc2d /plugins/utils_disk.c
parent4edea20b86fb08209ffb38c77be2df1d3a373e82 (diff)
downloadmonitoring-plugins-a46e358d68027289cffaffeb7a4b32ababb2105b.tar.gz
Added -E option for exact match of filesystem. Restructured main filesystem
loop. Added extra tests for possible duplicate filesystems. git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1449 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/utils_disk.c')
-rw-r--r--plugins/utils_disk.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/plugins/utils_disk.c b/plugins/utils_disk.c
index 0a71d792..31284d5d 100644
--- a/plugins/utils_disk.c
+++ b/plugins/utils_disk.c
@@ -43,9 +43,11 @@ np_add_name (struct name_list **list, const char *name)
*list = new_entry;
}
-void
+/* Initialises a new parameter at the end of list */
+struct parameter_list *
np_add_parameter(struct parameter_list **list, const char *name)
{
+ struct parameter_list *current = *list;
struct parameter_list *new_path;
new_path = (struct parameter_list *) malloc (sizeof *new_path);
new_path->name = (char *) name;
@@ -57,8 +59,17 @@ np_add_parameter(struct parameter_list **list, const char *name)
new_path->c_dfp = -1.0;
new_path->w_idfp = -1.0;
new_path->c_idfp = -1.0;
- new_path->name_next = *list;
- *list = new_path;
+ new_path->best_match = NULL;
+
+ if (current == NULL) {
+ *list = new_path;
+ } else {
+ while (current->name_next) {
+ current = current->name_next;
+ }
+ current->name_next = new_path;
+ }
+ return new_path;
}
void
@@ -93,6 +104,8 @@ np_set_best_match(struct parameter_list *desired, struct mount_entry *mount_list
if (best_match) {
d->best_match = best_match;
d->found = TRUE;
+ } else {
+ d->best_match = NULL; /* Not sure why this is needed as it should be null on initialisation */
}
}
}
@@ -114,3 +127,15 @@ np_find_name (struct name_list *list, const char *name)
return FALSE;
}
+int
+np_seen_name(struct name_list *list, const char *name)
+{
+ const struct name_list *s;
+ for (s = list; s; s=s->next) {
+ if (!strcmp(s->name, name)) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+