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.28 by pajs, Thu Oct 9 15:22:59 2003 UTC vs.
Revision 1.32 by ats, Sun Oct 19 11:15:30 2003 UTC

# Line 35 | Line 35
35   #endif
36  
37   #ifdef LINUX
38 + #include <time.h>
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>
50 #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 97 | 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 110 | 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 174 | 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 333 | 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
# Line 344 | Line 357 | diskio_stat_t *get_diskio_stats(int *entries){
357          }
358   #ifdef FREEBSD5
359          if ((devstat_getdevs(NULL, &stats)) < 0) return NULL;
360 <        /* Not aware of a get all devices, so i said 999. If we ever                                                                           * find a machine with more than 999 disks, then i'll change                                                                           * this number :)                                                                                                                      */
360 >        /* Not aware of a get all devices, so i said 999. If we ever
361 >         * find a machine with more than 999 disks, then i'll change
362 >         * this number :)
363 >         */
364          if (devstat_selectdevs(&dev_sel, &n_selected, &n_selections, &sel_gen, stats.dinfo->generation, stats.dinfo->devices, stats.dinfo->numdevs, NULL, 0, NULL, 0, DS_SELECT_ONLY, 999, 1) < 0) return NULL;
365   #else
366          if ((getdevs(&stats)) < 0) return NULL;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines