ia64/xen-unstable

changeset 17141:45a24393a594

Fix non-portability in xentrace

Replace statfs() with the equivalent statvfs(), and correct the block
size multiplier.

Signed-off-by: John Levon <john.levon@sun.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Feb 28 10:19:49 2008 +0000 (2008-02-28)
parents 5e6e1fce3300
children b6cda88a3da6
files tools/xentrace/xentrace.c
line diff
     1.1 --- a/tools/xentrace/xentrace.c	Wed Feb 27 13:21:36 2008 +0000
     1.2 +++ b/tools/xentrace/xentrace.c	Thu Feb 28 10:19:49 2008 +0000
     1.3 @@ -15,7 +15,6 @@
     1.4  #include <sys/mman.h>
     1.5  #include <sys/stat.h>
     1.6  #include <sys/types.h>
     1.7 -#include <sys/vfs.h>
     1.8  #include <fcntl.h>
     1.9  #include <unistd.h>
    1.10  #include <errno.h>
    1.11 @@ -25,6 +24,7 @@
    1.12  #include <getopt.h>
    1.13  #include <assert.h>
    1.14  #include <sys/poll.h>
    1.15 +#include <sys/statvfs.h>
    1.16  
    1.17  #include <xen/xen.h>
    1.18  #include <xen/trace.h>
    1.19 @@ -87,7 +87,7 @@ void close_handler(int signal)
    1.20  void write_buffer(unsigned int cpu, unsigned char *start, int size,
    1.21                 int total_size, int outfd)
    1.22  {
    1.23 -    struct statfs stat;
    1.24 +    struct statvfs stat;
    1.25      size_t written = 0;
    1.26      
    1.27      if ( opts.disk_rsvd != 0 )
    1.28 @@ -95,13 +95,13 @@ void write_buffer(unsigned int cpu, unsi
    1.29          unsigned long long freespace;
    1.30  
    1.31          /* Check that filesystem has enough space. */
    1.32 -        if ( fstatfs (outfd, &stat) )
    1.33 +        if ( fstatvfs (outfd, &stat) )
    1.34          {
    1.35                  fprintf(stderr, "Statfs failed!\n");
    1.36                  goto fail;
    1.37          }
    1.38  
    1.39 -        freespace = stat.f_bsize * (unsigned long long)stat.f_bfree;
    1.40 +        freespace = stat.f_frsize * (unsigned long long)stat.f_bfree;
    1.41  
    1.42          if ( total_size )
    1.43              freespace -= total_size;