forked from bartvdbraak/blender
Code cleanup: defines for statfs were getting out of hand for BSD's.
add __DragonFly__ and internal defines to avoid copy-pasting checks. also remove __CYGWIN32__ check, since cygwin is no longer supported.
This commit is contained in:
parent
17a4ba2c7c
commit
fee66f7bc8
@ -44,10 +44,6 @@
|
|||||||
|
|
||||||
#include "GHOST_System.h"
|
#include "GHOST_System.h"
|
||||||
|
|
||||||
#if defined(__CYGWIN32__)
|
|
||||||
# define __int64 long long
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class GHOST_EventButton;
|
class GHOST_EventButton;
|
||||||
class GHOST_EventCursor;
|
class GHOST_EventCursor;
|
||||||
class GHOST_EventKey;
|
class GHOST_EventKey;
|
||||||
|
@ -42,27 +42,25 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#if defined(__sun__) || defined(__sun) || defined(__NetBSD__)
|
#if defined(__NetBSD__) || defined(__DragonFly__) || defined(__sun__) || defined(__sun)
|
||||||
# include <sys/statvfs.h> /* Other modern unix os's should probably use this also */
|
/* Other modern unix os's should probably use this also */
|
||||||
#elif !defined(__FreeBSD__) && !defined(__linux__) && (defined(__sparc) || defined(__sparc__))
|
# include <sys/statvfs.h>
|
||||||
|
# define USE_STATFS_STATVFS
|
||||||
|
#elif (defined(__sparc) || defined(__sparc__)) && !defined(__FreeBSD__) && !defined(__linux__)
|
||||||
# include <sys/statfs.h>
|
# include <sys/statfs.h>
|
||||||
|
/* 4 argument version (not common) */
|
||||||
|
# define USE_STATFS_4ARGS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
|
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
|
||||||
# include <sys/param.h>
|
|
||||||
# include <sys/mount.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__CYGWIN32__) || defined(__hpux) || defined(__GNU__) || defined(__GLIBC__)
|
|
||||||
#include <sys/vfs.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
/* For statfs */
|
/* For statfs */
|
||||||
# include <sys/param.h>
|
# include <sys/param.h>
|
||||||
# include <sys/mount.h>
|
# include <sys/mount.h>
|
||||||
#endif /* __APPLE__ */
|
#endif
|
||||||
|
|
||||||
|
#if defined(__linux__) || defined(__hpux) || defined(__GNU__) || defined(__GLIBC__)
|
||||||
|
# include <sys/vfs.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <string.h> /* strcpy etc.. */
|
#include <string.h> /* strcpy etc.. */
|
||||||
@ -172,11 +170,12 @@ double BLI_dir_free_space(const char *dir)
|
|||||||
return (double) (freec * bytesps * sectorspc);
|
return (double) (freec * bytesps * sectorspc);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#if defined(__sun__) || defined(__sun) || defined(__NetBSD__)
|
#ifdef USE_STATFS_STATVFS
|
||||||
struct statvfs disk;
|
struct statvfs disk;
|
||||||
#else
|
#else
|
||||||
struct statfs disk;
|
struct statfs disk;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char name[FILE_MAXDIR], *slash;
|
char name[FILE_MAXDIR], *slash;
|
||||||
int len = strlen(dir);
|
int len = strlen(dir);
|
||||||
|
|
||||||
@ -193,15 +192,12 @@ double BLI_dir_free_space(const char *dir)
|
|||||||
strcpy(name, "/");
|
strcpy(name, "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__linux__) || defined(__OpenBSD__) || defined(__APPLE__) || defined(__GNU__) || defined(__GLIBC__)
|
#if defined(USE_STATFS_STATVFS)
|
||||||
if (statfs(name, &disk)) return(-1);
|
if (statvfs(name, &disk)) return -1;
|
||||||
#endif
|
#elif defined(USE_STATFS_4ARGS)
|
||||||
|
if (statfs(name, &disk, sizeof(struct statfs), 0)) return -1;
|
||||||
#if defined(__sun__) || defined(__sun) || defined(__NetBSD__)
|
#else
|
||||||
if (statvfs(name, &disk)) return(-1);
|
if (statfs(name, &disk)) return -1;
|
||||||
#elif !defined(__FreeBSD__) && !defined(__linux__) && (defined(__sparc) || defined(__sparc__))
|
|
||||||
/* WARNING - This may not be supported by geeneric unix os's - Campbell */
|
|
||||||
if (statfs(name, &disk, sizeof(struct statfs), 0)) return(-1);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ( ((double) disk.f_bsize) * ((double) disk.f_bfree));
|
return ( ((double) disk.f_bsize) * ((double) disk.f_bfree));
|
||||||
|
Loading…
Reference in New Issue
Block a user