1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-03 18:25:35 +00:00

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

View file

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