37 |
|
#include <sys/mnttab.h> |
38 |
|
#include <sys/statvfs.h> |
39 |
|
#include <kstat.h> |
40 |
< |
#define VALID_FS_TYPES {"ufs", "tmpfs", "vxfs"} |
40 |
> |
#define VALID_FS_TYPES {"ufs", "tmpfs", "vxfs", "nfs", "zfs"} |
41 |
|
#endif |
42 |
|
|
43 |
|
#if defined(LINUX) || defined(CYGWIN) |
66 |
|
#if defined(FREEBSD) || defined(DFBSD) |
67 |
|
#include <sys/dkstat.h> |
68 |
|
#include <devstat.h> |
69 |
< |
#define VALID_FS_TYPES {"hpfs", "msdosfs", "ntfs", "udf", "ext2fs", \ |
70 |
< |
"ufs", "mfs", "nfs"} |
69 |
> |
#include <sys/param.h> |
70 |
> |
#include <sys/mount.h> |
71 |
> |
#include <sys/sysctl.h> |
72 |
> |
/*#define VALID_FS_TYPES {"hpfs", "msdosfs", "ntfs", "udf", "ext2fs", \ |
73 |
> |
"ufs", "mfs", "nfs", "zfs", "tmpfs", "reiserfs", \ |
74 |
> |
"xfs"}*/ |
75 |
|
#endif |
76 |
|
#if defined(NETBSD) || defined(OPENBSD) |
77 |
|
#include <sys/param.h> |
91 |
|
#include <dirent.h> |
92 |
|
#include <stdio.h> |
93 |
|
#include <time.h> |
94 |
< |
#define VALID_FS_TYPES {"vxfs", "hfs"} |
94 |
> |
#define VALID_FS_TYPES {"vxfs", "hfs", "nfs"} |
95 |
|
#define DISK_BATCH 30 |
96 |
|
#endif |
97 |
|
|
155 |
|
|
156 |
|
#ifndef WIN32 /* not used by WIN32, so stop compiler throwing warnings */ |
157 |
|
static int is_valid_fs_type(const char *type) { |
154 |
– |
const char *types[] = VALID_FS_TYPES; |
158 |
|
int i; |
159 |
|
|
160 |
+ |
#if defined(FREEBSD) || defined(DFBSD) |
161 |
+ |
struct xvfsconf *xvfsp; |
162 |
+ |
size_t buflen; |
163 |
+ |
int cnt, nbvfs = 0; |
164 |
+ |
|
165 |
+ |
if (sysctlbyname("vfs.conflist", NULL, &buflen, NULL, 0) < 0) { |
166 |
+ |
sg_set_error_with_errno(SG_ERROR_SYSCTLBYNAME, "vfs.conflist"); |
167 |
+ |
return 0; |
168 |
+ |
} |
169 |
+ |
xvfsp = alloca(buflen); |
170 |
+ |
if (sysctlbyname("vfs.conflist", xvfsp, &buflen, NULL, 0) < 0) { |
171 |
+ |
sg_set_error_with_errno(SG_ERROR_SYSCTLBYNAME, "vfs.conflist"); |
172 |
+ |
return 0; |
173 |
+ |
} |
174 |
+ |
cnt = buflen / sizeof(struct xvfsconf); |
175 |
+ |
for (i = 0; i < cnt; i++) { |
176 |
+ |
if (strcmp(xvfsp[i].vfc_name, type) == 0) { |
177 |
+ |
return 1; |
178 |
+ |
} |
179 |
+ |
} |
180 |
+ |
#else |
181 |
+ |
const char *types[] = VALID_FS_TYPES; |
182 |
+ |
|
183 |
|
for (i = 0; i < (int) (sizeof types / sizeof *types); i++) { |
184 |
|
if (strcmp(types[i], type) == 0) { |
185 |
|
return 1; |
186 |
|
} |
187 |
|
} |
188 |
+ |
#endif |
189 |
|
return 0; |
190 |
|
} |
191 |
|
#endif |
783 |
|
diskio_stats_ptr->write_bytes=kios.nwritten; |
784 |
|
if (sg_update_string(&diskio_stats_ptr->disk_name, |
785 |
|
sg_get_svr_from_bsd(ksp->ks_name)) < 0) { |
786 |
+ |
kstat_close(kc); |
787 |
|
return NULL; |
788 |
|
} |
789 |
|
diskio_stats_ptr->systime=time(NULL); |