@cryptotaxi247 / netdata-1 / commits / 8cb31e18f

commented mountinfo optional_fields code

Costa Tsaousis (ktsaou) committed Apr 29, 2016 at 04:27 UTC 8cb31e18f69baddf3698d8e34b89c896b1988038
2 files changed +12 -4
src/proc_self_mountinfo.c
+9 -3
@@ -48,16 +48,18 @@ void mountinfo_free(struct mountinfo *mi) {
48 if(likely(mi->next))
49 mountinfo_free(mi->next);
50
51 - free(mi->root);
52 - free(mi->mount_point);
53 - free(mi->mount_options);
51 + if(mi->root) free(mi->root);
52 + if(mi->mount_point) free(mi->mount_point);
53 + if(mi->mount_options) free(mi->mount_options);
54
55 +/*
56 if(mi->optional_fields_count) {
57 int i;
58 for(i = 0; i < mi->optional_fields_count ; i++)
59 free(mi->optional_fields[i]);
60 }
61 free(mi->optional_fields);
62 +*/
63
64 free(mi->filesystem);
65 free(mi->mount_source);
@@ -123,7 +125,9 @@ struct mountinfo *mountinfo_read() {
125 if(unlikely(!mi->mount_options)) fatal("Cannot allocate memory");
126
127 // count the optional fields
128 +/*
129 unsigned long wo = w;
130 +*/
131 mi->optional_fields_count = 0;
132 char *s = procfile_lineword(ff, l, w);
133 while(*s && *s != '-') {
@@ -132,6 +136,7 @@ struct mountinfo *mountinfo_read() {
136 mi->optional_fields_count++;
137 }
138
139 +/*
140 if(unlikely(mi->optional_fields_count)) {
141 // we have some optional fields
142 // read them into a new array of pointers;
@@ -149,6 +154,7 @@ struct mountinfo *mountinfo_read() {
154 }
155 else
156 mi->optional_fields = NULL;
157 +*/
158
159 if(likely(*s == '-')) {
160 w++;
src/proc_self_mountinfo.h
+3 -1
@@ -18,7 +18,9 @@ struct mountinfo {
18 char *mount_options; // mount options: per-mount options.
19
20 int optional_fields_count;
21 - char **optional_fields; // optional fields: zero or more fields of the form "tag[:value]".
21 +/*
22 + char *(*optional_fields); // optional fields: zero or more fields of the form "tag[:value]".
23 +*/
24
25 char *filesystem; // filesystem type: name of filesystem in the form "type[.subtype]".
26 uint32_t filesystem_hash;