Merge pull request #312 from realzhtw/master

Fixed platform-quota.c for DragonFly.
This commit is contained in:
Mike Gelfand 2017-06-19 19:47:41 +03:00 committed by GitHub
commit 88ef7c1344
1 changed files with 8 additions and 2 deletions

View File

@ -17,6 +17,8 @@
#include <sys/types.h> /* types needed by quota.h */
#if defined(__FreeBSD__) || defined(__OpenBSD__)
#include <ufs/ufs/quota.h> /* quotactl() */
#elif defined(__DragonFly__)
#include <vfs/ufs/quota.h> /* quotactl */
#elif defined(__NetBSD__)
#include <sys/param.h>
#ifndef statfs
@ -313,12 +315,16 @@ static int64_t getquota(char const* device)
static int64_t getquota(char const* device)
{
#if defined(__DragonFly__)
struct ufs_dqblk dq;
#else
struct dqblk dq;
#endif
int64_t limit;
int64_t freespace;
int64_t spaceused;
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
if (quotactl(device, QCMD(Q_GETQUOTA, USRQUOTA), getuid(), (caddr_t)&dq) == 0)
{
@ -363,7 +369,7 @@ static int64_t getquota(char const* device)
return -1;
}
#if defined(__FreeBSD__) || defined(__OpenBSD__)
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
spaceused = (int64_t)dq.dqb_curblocks >> 1;
#elif defined(__APPLE__)
spaceused = (int64_t)dq.dqb_curbytes;