summaryrefslogtreecommitdiffstats
path: root/plugins/utils_disk.c
diff options
context:
space:
mode:
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 0a71d79..31284d5 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)
43 *list = new_entry; 43 *list = new_entry;
44} 44}
45 45
46void 46/* Initialises a new parameter at the end of list */
47struct parameter_list *
47np_add_parameter(struct parameter_list **list, const char *name) 48np_add_parameter(struct parameter_list **list, const char *name)
48{ 49{
50 struct parameter_list *current = *list;
49 struct parameter_list *new_path; 51 struct parameter_list *new_path;
50 new_path = (struct parameter_list *) malloc (sizeof *new_path); 52 new_path = (struct parameter_list *) malloc (sizeof *new_path);
51 new_path->name = (char *) name; 53 new_path->name = (char *) name;
@@ -57,8 +59,17 @@ np_add_parameter(struct parameter_list **list, const char *name)
57 new_path->c_dfp = -1.0; 59 new_path->c_dfp = -1.0;
58 new_path->w_idfp = -1.0; 60 new_path->w_idfp = -1.0;
59 new_path->c_idfp = -1.0; 61 new_path->c_idfp = -1.0;
60 new_path->name_next = *list; 62 new_path->best_match = NULL;
61 *list = new_path; 63
64 if (current == NULL) {
65 *list = new_path;
66 } else {
67 while (current->name_next) {
68 current = current->name_next;
69 }
70 current->name_next = new_path;
71 }
72 return new_path;
62} 73}
63 74
64void 75void
@@ -93,6 +104,8 @@ np_set_best_match(struct parameter_list *desired, struct mount_entry *mount_list
93 if (best_match) { 104 if (best_match) {
94 d->best_match = best_match; 105 d->best_match = best_match;
95 d->found = TRUE; 106 d->found = TRUE;
107 } else {
108 d->best_match = NULL; /* Not sure why this is needed as it should be null on initialisation */
96 } 109 }
97 } 110 }
98} 111}
@@ -114,3 +127,15 @@ np_find_name (struct name_list *list, const char *name)
114 return FALSE; 127 return FALSE;
115} 128}
116 129
130int
131np_seen_name(struct name_list *list, const char *name)
132{
133 const struct name_list *s;
134 for (s = list; s; s=s->next) {
135 if (!strcmp(s->name, name)) {
136 return TRUE;
137 }
138 }
139 return FALSE;
140}
141