ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/disk_stats.c
(Generate patch)

Comparing projects/libstatgrab/src/libstatgrab/disk_stats.c (file contents):
Revision 1.30 by ats, Sun Oct 19 00:10:30 2003 UTC vs.
Revision 1.33 by ats, Sun Oct 19 11:23:21 2003 UTC

# Line 39 | Line 39
39   #include <sys/vfs.h>
40   #include <mntent.h>
41   #include "tools.h"
42 < #define VALID_FS_TYPES {"ext2", "ext3", "xfs", "reiserfs", "vfat", "tmpfs"}
42 > #define VALID_FS_TYPES {"adfs", "affs", "befs", "bfs", "efs", "ext2", \
43 >                        "ext3", "vxfs", "hfs", "hfsplus", "hpfs", "jffs", \
44 >                        "jffs2", "minix", "msdos", "ntfs", "qnx4", "ramfs", \
45 >                        "rootfs", "reiserfs", "sysv", "v7", "udf", "ufs", \
46 >                        "umsdos", "vfat", "xfs", "jfs"}
47   #endif
48  
49 < #ifdef FREEBSD
49 > #ifdef ALLBSD
50   #include <sys/param.h>
51   #include <sys/ucred.h>
52   #include <sys/mount.h>
53 + #define VALID_FS_TYPES {"ufs", "mfs", "ffs"}
54 + #endif
55 + #ifdef FREEBSD
56   #include <sys/dkstat.h>
57   #include <devstat.h>
51 #define VALID_FS_TYPES {"ufs", "mfs"}
58   #endif
59 +
60   #define START_VAL 1
61  
62   char *copy_string(char *orig_ptr, const char *newtext){
# Line 98 | Line 105 | disk_stat_t *get_disk_stats(int *entries){
105          struct mntent *mp;
106          struct statfs fs;
107   #endif
108 < #ifdef FREEBSD
108 > #ifdef ALLBSD
109          int nummnt;
110          struct statfs *mp;
111   #endif
# Line 111 | Line 118 | disk_stat_t *get_disk_stats(int *entries){
118                  watermark=START_VAL;
119                  init_disk_stat(0, watermark-1, disk_stats);
120          }
121 < #ifdef FREEBSD
121 > #ifdef ALLBSD
122          nummnt=getmntinfo(&mp , MNT_LOCAL);
123          if (nummnt<=0){
124                  return NULL;
# Line 175 | Line 182 | disk_stat_t *get_disk_stats(int *entries){
182                          }
183  
184                          disk_ptr=disk_stats+num_disks;
185 < #ifdef FREEBSD
185 > #ifdef ALLBSD
186                          if((disk_ptr->device_name=copy_string(disk_ptr->device_name, mp->f_mntfromname))==NULL){
187                                  return NULL;
188                          }
# Line 334 | Line 341 | diskio_stat_t *get_diskio_stats(int *entries){
341          long sel_gen;
342          struct devstat *dev_ptr;
343   #endif
344 + #ifdef NETBSD
345 +        /* FIXME get_diskio_stats NYI on NetBSD.
346 +         * See vmstat/dkstats.c in NetBSD source for examples.
347 +         */
348 + #endif
349          num_diskio=0;
350  
351   #ifdef FREEBSD
352          if (!stats_init) {
353                  stats.dinfo=malloc(sizeof(struct devinfo));
342                bzero(stats.dinfo, sizeof(struct devinfo));
354                  if(stats.dinfo==NULL) return NULL;
355 +                bzero(stats.dinfo, sizeof(struct devinfo));
356                  stats_init = 1;
357          }
358   #ifdef FREEBSD5

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines