added __FreeBSD__ compilation fixes
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 3 Jan 2006 16:21:13 +0000 (16:21 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 3 Jan 2006 16:21:13 +0000 (16:21 +0000)
git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/fuse/perl-llin@68 6e4b0b00-1209-0410-87b2-b275959b5705

Fuse.xs

diff --git a/Fuse.xs b/Fuse.xs
index e473751..431c909 100644 (file)
--- a/Fuse.xs
+++ b/Fuse.xs
@@ -542,7 +542,13 @@ int _PLfuse_write (const char *file, const char *buf, size_t buflen, off_t off)
 }
 
 /* FIXME check for old fuse API (< 21?) and use statfs here */
-int _PLfuse_statfs (const char *file, struct statvfs *st) {
+#ifdef __FreeBSD__
+ #define _fuse_statvfs statfs
+#else
+ #define _fuse_statvfs statvfs
+#endif
+int _PLfuse_statfs (const char *file, struct _fuse_statvfs *st) {
+
        int rv;
        char *rvstr;
        FUSE_CONTEXT_PRE;
@@ -556,16 +562,20 @@ int _PLfuse_statfs (const char *file, struct statvfs *st) {
        SPAGAIN;
        DEBUGf("statfs got %i params\n",rv);
        if(rv == 6 || rv == 7) {
-               st->f_bsize    = POPi;
-               st->f_bfree = st->f_bavail = POPi;
-               st->f_blocks   = POPi;
-               st->f_ffree = st->f_favail  = POPi;
-               st->f_files    = POPi;
-               st->f_namemax  = POPi;
-               /* zero all other */
-               st->f_frsize = 4096;
+               st->f_bsize     = POPi;
+               st->f_bfree     = POPi;
+               st->f_blocks    = POPi;
+               st->f_ffree     = POPi;
+               st->f_files     = POPi;
+               st->f_namemax   = POPi;
+#ifndef __FreeBSD__
+               /* zero and fill-in other */
                st->f_fsid = 0;
+               st->f_frsize = 4096;
                st->f_flag = 0;
+               st->f_bavail = st->f_bfree;
+               st->f_favail = st->f_ffree;
+#endif
 
                if(rv == 7)
                        rv = POPi;