50 |
|
"ext3", "vxfs", "hfs", "hfsplus", "hpfs", "jffs", \ |
51 |
|
"jffs2", "minix", "msdos", "ntfs", "qnx4", "ramfs", \ |
52 |
|
"rootfs", "reiserfs", "sysv", "v7", "udf", "ufs", \ |
53 |
< |
"umsdos", "vfat", "xfs", "jfs"} |
53 |
> |
"umsdos", "vfat", "xfs", "jfs", "nfs"} |
54 |
|
#endif |
55 |
|
|
56 |
|
#ifdef CYGWIN |
66 |
|
#include <sys/dkstat.h> |
67 |
|
#include <devstat.h> |
68 |
|
#define VALID_FS_TYPES {"hpfs", "msdosfs", "ntfs", "udf", "ext2fs", \ |
69 |
< |
"ufs", "mfs"} |
69 |
> |
"ufs", "mfs", "nfs"} |
70 |
|
#endif |
71 |
|
#if defined(NETBSD) || defined(OPENBSD) |
72 |
|
#include <sys/param.h> |
73 |
|
#include <sys/sysctl.h> |
74 |
|
#include <sys/disk.h> |
75 |
|
#define VALID_FS_TYPES {"ffs", "mfs", "msdos", "lfs", "adosfs", "ext2fs", \ |
76 |
< |
"ntfs"} |
76 |
> |
"ntfs", "nfs"} |
77 |
|
#endif |
78 |
|
|
79 |
|
#ifdef HPUX |
106 |
|
const char *types[] = VALID_FS_TYPES; |
107 |
|
int i; |
108 |
|
|
109 |
< |
for (i = 0; i < (sizeof types / sizeof *types); i++) { |
109 |
> |
for (i = 0; i < (int) (sizeof types / sizeof *types); i++) { |
110 |
|
if (strcmp(types[i], type) == 0) { |
111 |
|
return 1; |
112 |
|
} |
144 |
|
#endif |
145 |
|
|
146 |
|
#ifdef ALLBSD |
147 |
< |
nummnt=getmntinfo(&mp , MNT_LOCAL); |
147 |
> |
nummnt=getmntinfo(&mp, MNT_WAIT); |
148 |
|
if (nummnt<=0){ |
149 |
|
sg_set_error_with_errno(SG_ERROR_GETMNTINFO, NULL); |
150 |
|
return NULL; |
338 |
|
int i, n; |
339 |
|
time_t now; |
340 |
|
const char *format; |
341 |
+ |
static regex_t not_part_re, part_re; |
342 |
+ |
static int re_compiled = 0; |
343 |
|
#endif |
344 |
|
#if defined(FREEBSD) || defined(DFBSD) |
345 |
|
static struct statinfo stats; |
394 |
|
} |
395 |
|
|
396 |
|
/* We can't seperate the reads from the writes, we'll |
397 |
< |
just give the same to each. */ |
398 |
< |
rbytes = wbytes = di->psd_dkwds / 2; |
397 |
> |
* just give the same to each. (This value is in |
398 |
> |
* 64-byte chunks according to the pstat header file, |
399 |
> |
* and can wrap to be negative.) |
400 |
> |
*/ |
401 |
> |
rbytes = wbytes = ((unsigned long) di->psd_dkwds) * 64LL; |
402 |
|
|
403 |
|
/* Skip unused disks. */ |
404 |
|
if (rbytes == 0 && wbytes == 0) { |
701 |
|
if (f == NULL) goto out; |
702 |
|
now = time(NULL); |
703 |
|
|
704 |
+ |
if (!re_compiled) { |
705 |
+ |
if (regcomp(&part_re, "^(.*/)?[^/]*[0-9]$", REG_EXTENDED | REG_NOSUB) != 0) { |
706 |
+ |
sg_set_error(SG_ERROR_PARSE, NULL); |
707 |
+ |
goto out; |
708 |
+ |
} |
709 |
+ |
if (regcomp(¬_part_re, "^(.*/)?[^/0-9]+[0-9]+d[0-9]+$", REG_EXTENDED | REG_NOSUB) != 0) { |
710 |
+ |
sg_set_error(SG_ERROR_PARSE, NULL); |
711 |
+ |
goto out; |
712 |
+ |
} |
713 |
+ |
re_compiled = 1; |
714 |
+ |
} |
715 |
+ |
|
716 |
|
while ((line_ptr = sg_f_read_line(f, "")) != NULL) { |
717 |
|
char name[100]; |
701 |
– |
char *s; |
718 |
|
long long rsect, wsect; |
719 |
|
|
720 |
|
int nr = sscanf(line_ptr, format, |
722 |
|
if (nr < 3) continue; |
723 |
|
|
724 |
|
/* Skip device names ending in numbers, since they're |
725 |
< |
partitions. */ |
726 |
< |
s = name; |
727 |
< |
while (*s != '\0') s++; |
728 |
< |
--s; |
729 |
< |
if (*s >= '0' && *s <= '9') continue; |
725 |
> |
partitions, unless they match the c0d0 pattern that some |
726 |
> |
RAID devices use. */ |
727 |
> |
/* FIXME: For 2.6+, we should probably be using sysfs to detect |
728 |
> |
this... */ |
729 |
> |
if ((regexec(&part_re, name, 0, NULL, 0) == 0) |
730 |
> |
&& (regexec(¬_part_re, name, 0, NULL, 0) != 0)) { |
731 |
> |
continue; |
732 |
> |
} |
733 |
|
|
734 |
|
if (nr < 5) { |
735 |
|
has_pp_stats = 0; |