WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] Fix non-portability in xentrace

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] Fix non-portability in xentrace
From: john.levon@xxxxxxx
Date: Wed, 27 Feb 2008 08:07:54 -0800
Delivery-date: Wed, 27 Feb 2008 08:08:31 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User john.levon@xxxxxxx
# Date 1204123693 28800
# Node ID 77ea7611d2c51c65a13736a46427ec401721f187
# Parent  c8be63feb437ce500fc2c200c816316c1bd0d12b
Fix non-portability in xentrace

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

Signed-off-by: John Levon <john.levon@xxxxxxx>

diff --git a/tools/xentrace/xentrace.c b/tools/xentrace/xentrace.c
--- a/tools/xentrace/xentrace.c
+++ b/tools/xentrace/xentrace.c
@@ -15,7 +15,6 @@
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-#include <sys/vfs.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <errno.h>
@@ -25,6 +24,7 @@
 #include <getopt.h>
 #include <assert.h>
 #include <sys/poll.h>
+#include <sys/statvfs.h>
 
 #include <xen/xen.h>
 #include <xen/trace.h>
@@ -87,7 +87,7 @@ void write_buffer(unsigned int cpu, unsi
 void write_buffer(unsigned int cpu, unsigned char *start, int size,
                int total_size, int outfd)
 {
-    struct statfs stat;
+    struct statvfs stat;
     size_t written = 0;
     
     if ( opts.disk_rsvd != 0 )
@@ -95,13 +95,13 @@ void write_buffer(unsigned int cpu, unsi
         unsigned long long freespace;
 
         /* Check that filesystem has enough space. */
-        if ( fstatfs (outfd, &stat) )
+        if ( fstatvfs (outfd, &stat) )
         {
                 fprintf(stderr, "Statfs failed!\n");
                 goto fail;
         }
 
-        freespace = stat.f_bsize * (unsigned long long)stat.f_bfree;
+        freespace = stat.f_frsize * (unsigned long long)stat.f_bfree;
 
         if ( total_size )
             freespace -= total_size;

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Fix non-portability in xentrace, john . levon <=