On Mon, 2006-06-12 at 18:39 +0300, Timo Sirainen wrote:
On Mon, 2006-06-12 at 17:56 +0300, Dumitru Negara wrote:
Timo Sirainen wrote:
On Mon, 2006-06-12 at 17:12 +0300, Dumitru Negara wrote:
# repquota -u /dev/sda9
Could you run it through strace and show me the quotactl() call it does? Or does it do a quotactl() call at all?
So I looked through repquota's sources and it looks like XFS has its own Q_XGETQSTAT quota command which needs to be used with it. I think I'm not going to bother figuring out how it's supposed to be used. Patches welcome.
It's not that hard. Here's some example code:
#include <sys/quota.h> #include <xfs/xqm.h>
#define FS_WHATEVER 0 #define FS_XFS 1
int getquot(char *dev, uid_t uid, struct dqblk *dq, int fstype) { fs_disk_quota_t fdq;
switch(fstype) {
case FS_XFS:
if (quotactl(QCMD(Q_XGETQUOTA, USRQUOTA),
dev, uid, (caddr_t)&fdq) < 0)
return -1;
dq->dqb_bhardlimit = fdq.d_blk_hardlimit;
dq->dqb_bsoftlimit = fdq.d_blk_softlimit;
dq->dqb_ihardlimit = fdq.d_ino_hardlimit;
dq->dqb_isoftlimit = fdq.d_ino_softlimit;
dq->dqb_curblocks = fdq.d_bcount;
dq->dqb_curinodes = fdq.d_icount;
dq->dqb_btime = fdq.d_btimer;
dq->dqb_itime = fdq.d_itimer;
break;
default:
if (quotactl(QCMD(Q_GETQUOTA, USRQUOTA),
dev, uid, (caddr_t)dq) < 0)
return -1;
break;
}
return 0;
}