98 |
|
} |
99 |
|
} |
100 |
|
|
101 |
+ |
int is_valid_fs_type(const char *type) { |
102 |
+ |
const char *types[] = VALID_FS_TYPES; |
103 |
+ |
int i; |
104 |
+ |
|
105 |
+ |
for (i = 0; i < (sizeof types / sizeof *types); i++) { |
106 |
+ |
if (strcmp(types[i], type) == 0) { |
107 |
+ |
return 1; |
108 |
+ |
} |
109 |
+ |
} |
110 |
+ |
return 0; |
111 |
+ |
} |
112 |
+ |
|
113 |
|
disk_stat_t *get_disk_stats(int *entries){ |
114 |
|
|
115 |
|
static disk_stat_t *disk_stats; |
116 |
|
static int watermark=-1; |
117 |
|
|
118 |
< |
char *fs_types[] = VALID_FS_TYPES; |
107 |
< |
int x, valid_type; |
118 |
> |
int valid_type; |
119 |
|
int num_disks=0; |
120 |
|
#if defined(LINUX) || defined (SOLARIS) || defined(CYGWIN) |
121 |
|
FILE *f; |
150 |
|
return NULL; |
151 |
|
} |
152 |
|
for(;nummnt--; mp++){ |
153 |
< |
valid_type=0; |
143 |
< |
for(x=0;x<((sizeof(fs_types))/(sizeof(char*)));x++){ |
144 |
< |
if(strcmp(mp->f_fstypename, fs_types[x]) ==0){ |
145 |
< |
valid_type=1; |
146 |
< |
break; |
147 |
< |
} |
148 |
< |
} |
153 |
> |
valid_type = is_valid_fs_type(mp->f_fstypename); |
154 |
|
#endif |
155 |
|
|
156 |
|
#if defined(LINUX) || defined(CYGWIN) |
163 |
|
continue; |
164 |
|
} |
165 |
|
|
166 |
< |
valid_type=0; |
162 |
< |
for(x=0;x<((sizeof(fs_types))/(sizeof(char*)));x++){ |
163 |
< |
if(strcmp(mp->mnt_type, fs_types[x]) ==0){ |
164 |
< |
valid_type=1; |
165 |
< |
break; |
166 |
< |
} |
167 |
< |
} |
166 |
> |
valid_type = is_valid_fs_type(mp->mnt_type); |
167 |
|
#endif |
168 |
|
|
169 |
|
#ifdef SOLARIS |
174 |
|
if ((statvfs(mp.mnt_mountp, &fs)) !=0){ |
175 |
|
continue; |
176 |
|
} |
177 |
< |
valid_type=0; |
179 |
< |
for(x=0;x<((sizeof(fs_types))/(sizeof(char*)));x++){ |
180 |
< |
if(strcmp(mp.mnt_fstype, fs_types[x]) ==0){ |
181 |
< |
valid_type=1; |
182 |
< |
break; |
183 |
< |
} |
184 |
< |
} |
177 |
> |
valid_type = is_valid_fs_type(mp.mnt_fstype); |
178 |
|
#endif |
179 |
|
|
180 |
|
if(valid_type){ |