blob: 326da31cb1b05ea6ae221c6993291dc043416ac5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
$NetBSD: patch-aa,v 1.1.1.1 2006/02/01 00:53:00 markd Exp $
--- libk3b/core/k3bglobals.cpp.orig 2005-12-16 02:09:01.000000000 +1300
+++ libk3b/core/k3bglobals.cpp
@@ -38,12 +38,21 @@
#include <cmath>
#include <sys/utsname.h>
#include <sys/stat.h>
+#ifdef __NetBSD__
+#define stat64 stat
+#endif
-#ifdef __FreeBSD__
+#include <config.h>
+#if defined(__FreeBSD__) || defined(__NetBSD__)
#include <sys/param.h>
#include <sys/mount.h>
#else
-#include <sys/vfs.h>
+# ifdef HAVE_SYS_STATVFS_H
+# include <sys/statvfs.h>
+# endif
+# ifdef HAVE_SYS_STATFS_H
+# include <sys/vfs.h>
+# endif
#endif
@@ -235,10 +244,19 @@ QString K3b::systemName()
bool K3b::kbFreeOnFs( const QString& path, unsigned long& size, unsigned long& avail )
{
+#ifdef HAVE_STATVFS
+ struct statvfs fs;
+ if( ::statvfs( QFile::encodeName(path), &fs ) == 0 ) {
+ unsigned long kBfak = fs.f_frsize/1024;
+#else
+# ifndef HAVE_STATFS
+# error "No statfs, no statvfs? Help!"
+# endif
struct statfs fs;
if( ::statfs( QFile::encodeName(path), &fs ) == 0 ) {
unsigned long kBfak = fs.f_bsize/1024;
+#endif
size = fs.f_blocks*kBfak;
avail = fs.f_bavail*kBfak;
|