Fixed platform-quota.c for DragonFly. The patch is taken from dports.

This commit is contained in:
Aleksej Lebedev 2017-06-19 12:45:09 +02:00 committed by Mike Gelfand
parent f701d501a8
commit b7b1d2475e
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;