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", "zfs"} |
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> |
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 |