2 * $Id: quota.c,v 1.35 2010-04-03 07:11:35 franklahm Exp $
4 * Copyright (c) 1990,1993 Regents of The University of Michigan.
5 * All Rights Reserved. See COPYRIGHT.
10 #endif /* HAVE_CONFIG_H */
12 #ifndef NO_QUOTA_SUPPORT
17 #include <sys/types.h>
21 #else /* STDC_HEADERS */
25 #endif /* HAVE_STRCHR */
26 char *strchr (), *strrchr ();
28 #define memcpy(d,s,n) bcopy ((s), (d), (n))
29 #define memmove(d,s,n) bcopy ((s), (d), (n))
30 #endif /* ! HAVE_MEMCPY */
31 #endif /* STDC_HEADERS */
34 #include <sys/param.h>
37 #endif /* HAVE_UNISTD_H */
40 #endif /* HAVE_FCNTL_H */
42 #include <atalk/logger.h>
43 #include <atalk/afp.h>
44 #include <atalk/compat.h>
45 #include <atalk/util.h>
52 #include <quota/quota.h>
55 getfreespace(struct vol *vol, VolSpace *bfree, VolSpace *btotal,
56 uid_t uid, const char *classq)
59 struct ufs_quota_entry ufsq[QUOTA_NLIMITS];
62 if (time(&now) == -1) {
63 LOG(log_info, logtype_afpd, "time(): %s",
68 if ( seteuid( getuid() ) != 0 ) {
69 LOG(log_info, logtype_afpd, "seteuid(): %s",
73 if ((retq = getfsquota(vol->v_path, ufsq, uid, classq)) < 0) {
74 LOG(log_info, logtype_afpd, "getfsquota(%s, %s): %s",
75 vol->v_path, classq, strerror(errno));
81 switch(QL_STATUS(quota_check_limit(ufsq[QUOTA_LIMIT_BLOCK].ufsqe_cur, 1,
82 ufsq[QUOTA_LIMIT_BLOCK].ufsqe_softlimit,
83 ufsq[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit,
84 ufsq[QUOTA_LIMIT_BLOCK].ufsqe_time, now))) {
88 *btotal = dbtob(ufsq[QUOTA_LIMIT_BLOCK].ufsqe_cur);
91 *bfree = dbtob(ufsq[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit -
92 ufsq[QUOTA_LIMIT_BLOCK].ufsqe_cur);
93 *btotal = dbtob(ufsq[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit);
99 int uquota_getvolspace( struct vol *vol, VolSpace *bfree, VolSpace *btotal, const u_int32_t bsize)
102 VolSpace ubfree, ubtotal;
103 VolSpace gbfree, gbtotal;
105 uretq = getfreespace(vol, &ubfree, &ubtotal,
106 uuid, QUOTADICT_CLASS_USER);
107 LOG(log_info, logtype_afpd, "getfsquota(%s): %d %d",
108 vol->v_path, (int)ubfree, (int)ubtotal);
110 gretq = getfreespace(vol, &ubfree, &ubtotal,
111 groups[0], QUOTADICT_CLASS_GROUP);
114 if (uretq < 1 && gretq < 1) { /* no quota for this fs */
118 /* use group quotas */
121 } else if (gretq < 1) {
122 /* use user quotas */
126 /* return smallest remaining space of user and group */
127 if (ubfree < gbfree) {
139 #else /* HAVE_LIBQUOTA */
142 #define DEBUG_QUOTA 0
145 #define WANT_USER_QUOTA 0
146 #define WANT_GROUP_QUOTA 1
148 #ifdef NEED_QUOTACTL_WRAPPER
149 int quotactl(int cmd, const char *special, int id, caddr_t addr)
151 return syscall(__NR_quotactl, cmd, special, id, addr);
153 #endif /* NEED_QUOTACTL_WRAPPER */
155 static int overquota( struct dqblk *);
159 #ifdef HAVE_LINUX_XQM_H
160 #include <linux/xqm.h>
162 #ifdef HAVE_XFS_XQM_H
164 #define HAVE_LINUX_XQM_H
166 #ifdef HAVE_LINUX_DQBLK_XFS_H
167 #include <linux/dqblk_xfs.h>
168 #define HAVE_LINUX_XQM_H
169 #endif /* HAVE_LINUX_DQBLK_XFS_H */
170 #endif /* HAVE_XFS_XQM_H */
171 #endif /* HAVE_LINUX_XQM_H */
173 #include <linux/unistd.h>
175 static int is_xfs = 0;
177 static int get_linux_xfs_quota(int, char*, uid_t, struct dqblk *);
178 static int get_linux_fs_quota(int, char*, uid_t, struct dqblk *);
180 /* format supported by current kernel */
181 static int kernel_iface = IFACE_UNSET;
184 ** Check kernel quota version
185 ** Taken from quota-tools 3.08 by Jan Kara <jack@suse.cz>
187 static void linuxquota_get_api( void )
189 #ifndef LINUX_API_VERSION
192 if (stat("/proc/sys/fs/quota", &st) == 0) {
193 kernel_iface = IFACE_GENERIC;
196 struct dqstats_v2 v2_stats;
197 struct sigaction sig;
198 struct sigaction oldsig;
200 /* This signal handling is needed because old kernels send us SIGSEGV as they try to resolve the device */
201 sig.sa_handler = SIG_IGN;
202 sig.sa_sigaction = NULL;
204 sigemptyset(&sig.sa_mask);
205 if (sigaction(SIGSEGV, &sig, &oldsig) < 0) {
206 LOG( log_error, logtype_afpd, "cannot set SEGV signal handler: %s", strerror(errno));
209 if (quotactl(QCMD(Q_V2_GETSTATS, 0), NULL, 0, (void *)&v2_stats) >= 0) {
210 kernel_iface = IFACE_VFSV0;
212 else if (errno != ENOSYS && errno != ENOTSUP) {
213 /* RedHat 7.1 (2.4.2-2) newquota check
214 * Q_V2_GETSTATS in it's old place, Q_GETQUOTA in the new place
215 * (they haven't moved Q_GETSTATS to its new value) */
218 char tmp[1024]; /* Just temporary buffer */
220 if (quotactl(QCMD(Q_V1_GETSTATS, 0), NULL, 0, tmp))
222 if (quotactl(QCMD(Q_V1_GETQUOTA, 0), "/dev/null", 0, tmp))
225 /* On a RedHat 2.4.2-2 we expect 0, EINVAL
226 * On a 2.4.x we expect 0, ENOENT
227 * On a 2.4.x-ac we wont get here */
228 if (err_stat == 0 && err_quota == EINVAL) {
229 kernel_iface = IFACE_VFSV0;
232 kernel_iface = IFACE_VFSOLD;
236 /* This branch is *not* in quota-tools 3.08
237 ** but without it quota version is not correctly
238 ** identified for the original SuSE 8.0 kernel */
239 unsigned int vers_no;
242 if ((qf = fopen("/proc/fs/quota", "r"))) {
243 if (fscanf(qf, "Version %u", &vers_no) == 1) {
244 if ( (vers_no == (6*10000 + 5*100 + 0)) ||
245 (vers_no == (6*10000 + 5*100 + 1)) ) {
246 kernel_iface = IFACE_VFSV0;
252 if (sigaction(SIGSEGV, &oldsig, NULL) < 0) {
253 LOG(log_error, logtype_afpd, "cannot reset signal handler: %s", strerror(errno));
259 if (kernel_iface == IFACE_UNSET)
260 kernel_iface = IFACE_VFSOLD;
262 #else /* defined LINUX_API_VERSION */
263 kernel_iface = LINUX_API_VERSION;
267 /****************************************************************************/
269 static int get_linux_quota(int what, char *path, uid_t euser_id, struct dqblk *dp)
274 r=get_linux_xfs_quota(what, path, euser_id, dp);
276 r=get_linux_fs_quota(what, path, euser_id, dp);
281 /****************************************************************************
282 Abstract out the XFS Quota Manager quota get call.
283 ****************************************************************************/
285 static int get_linux_xfs_quota(int what, char *path, uid_t euser_id, struct dqblk *dqb)
288 #ifdef HAVE_LINUX_XQM_H
289 struct fs_disk_quota D;
291 memset (&D, 0, sizeof(D));
293 if ((ret = quotactl(QCMD(Q_XGETQUOTA,(what ? GRPQUOTA : USRQUOTA)), path, euser_id, (caddr_t)&D)))
296 dqb->bsize = (u_int64_t)512;
297 dqb->dqb_bsoftlimit = (u_int64_t)D.d_blk_softlimit;
298 dqb->dqb_bhardlimit = (u_int64_t)D.d_blk_hardlimit;
299 dqb->dqb_ihardlimit = (u_int64_t)D.d_ino_hardlimit;
300 dqb->dqb_isoftlimit = (u_int64_t)D.d_ino_softlimit;
301 dqb->dqb_curinodes = (u_int64_t)D.d_icount;
302 dqb->dqb_curblocks = (u_int64_t)D.d_bcount;
308 ** Wrapper for the quotactl(GETQUOTA) call.
309 ** For API v2 the results are copied back into a v1 structure.
310 ** Taken from quota-1.4.8 perl module
312 static int get_linux_fs_quota(int what, char *path, uid_t euser_id, struct dqblk *dqb)
316 if (kernel_iface == IFACE_UNSET)
317 linuxquota_get_api();
319 if (kernel_iface == IFACE_GENERIC)
321 struct dqblk_v3 dqb3;
323 ret = quotactl(QCMD(Q_V3_GETQUOTA, (what ? GRPQUOTA : USRQUOTA)), path, euser_id, (caddr_t) &dqb3);
326 dqb->dqb_bhardlimit = dqb3.dqb_bhardlimit;
327 dqb->dqb_bsoftlimit = dqb3.dqb_bsoftlimit;
328 dqb->dqb_curblocks = dqb3.dqb_curspace / DEV_QBSIZE;
329 dqb->dqb_ihardlimit = dqb3.dqb_ihardlimit;
330 dqb->dqb_isoftlimit = dqb3.dqb_isoftlimit;
331 dqb->dqb_curinodes = dqb3.dqb_curinodes;
332 dqb->dqb_btime = dqb3.dqb_btime;
333 dqb->dqb_itime = dqb3.dqb_itime;
334 dqb->bsize = DEV_QBSIZE;
337 else if (kernel_iface == IFACE_VFSV0)
339 struct dqblk_v2 dqb2;
341 ret = quotactl(QCMD(Q_V2_GETQUOTA, (what ? GRPQUOTA : USRQUOTA)), path, euser_id, (caddr_t) &dqb2);
344 dqb->dqb_bhardlimit = dqb2.dqb_bhardlimit;
345 dqb->dqb_bsoftlimit = dqb2.dqb_bsoftlimit;
346 dqb->dqb_curblocks = dqb2.dqb_curspace / DEV_QBSIZE;
347 dqb->dqb_ihardlimit = dqb2.dqb_ihardlimit;
348 dqb->dqb_isoftlimit = dqb2.dqb_isoftlimit;
349 dqb->dqb_curinodes = dqb2.dqb_curinodes;
350 dqb->dqb_btime = dqb2.dqb_btime;
351 dqb->dqb_itime = dqb2.dqb_itime;
352 dqb->bsize = DEV_QBSIZE;
355 else /* if (kernel_iface == IFACE_VFSOLD) */
357 struct dqblk_v1 dqb1;
359 ret = quotactl(QCMD(Q_V1_GETQUOTA, (what ? GRPQUOTA : USRQUOTA)), path, euser_id, (caddr_t) &dqb1);
362 dqb->dqb_bhardlimit = dqb1.dqb_bhardlimit;
363 dqb->dqb_bsoftlimit = dqb1.dqb_bsoftlimit;
364 dqb->dqb_curblocks = dqb1.dqb_curblocks;
365 dqb->dqb_ihardlimit = dqb1.dqb_ihardlimit;
366 dqb->dqb_isoftlimit = dqb1.dqb_isoftlimit;
367 dqb->dqb_curinodes = dqb1.dqb_curinodes;
368 dqb->dqb_btime = dqb1.dqb_btime;
369 dqb->dqb_itime = dqb1.dqb_itime;
370 dqb->bsize = DEV_QBSIZE;
378 #if defined(HAVE_SYS_MNTTAB_H) || defined(__svr4__)
380 * Return the mount point associated with the filesystem
381 * on which "file" resides. Returns NULL on failure.
384 mountp( char *file, int *nfs)
389 static struct mnttab mnt;
391 if (stat(file, &sb) < 0) {
396 if (( mtab = fopen( "/etc/mnttab", "r" )) == NULL ) {
400 while ( getmntent( mtab, &mnt ) == 0 ) {
402 if ( (stat( mnt.mnt_special, &sb ) == 0) && (devno == sb.st_rdev)) {
404 return mnt.mnt_mountp;
407 /* check for nfs. we probably should use
408 * strcmp(mnt.mnt_fstype, MNTTYPE_NFS), but that's not as fast. */
409 if ((stat(mnt.mnt_mountp, &sb) == 0) && (devno == sb.st_dev) &&
410 strchr(mnt.mnt_special, ':')) {
413 return mnt.mnt_special;
424 * Return the block-special device name associated with the filesystem
425 * on which "file" resides. Returns NULL on failure.
429 special( char *file, int *nfs)
431 static struct fs_data fsd;
433 if ( getmnt(0, &fsd, 0, STAT_ONE, file ) < 0 ) {
434 LOG(log_info, logtype_afpd, "special: getmnt %s: %s", file, strerror(errno) );
438 /* XXX: does this really detect an nfs mounted fs? */
439 if (strchr(fsd.fd_req.devname, ':'))
441 return( fsd.fd_req.devname );
445 #if (defined(HAVE_SYS_MOUNT_H) && !defined(__linux__)) || defined(BSD4_4) || defined(_IBMR2)
448 special(char *file, int *nfs)
450 static struct statfs sfs;
452 if ( statfs( file, &sfs ) < 0 ) {
457 /* Digital UNIX: The struct sfs contains a field sfs.f_type,
458 * the MOUNT_* constants are defined in <sys/mount.h> */
459 if ((sfs.f_type == MOUNT_NFS)||(sfs.f_type == MOUNT_NFS3))
461 /* XXX: make sure this really detects an nfs mounted fs */
462 if (strchr(sfs.f_mntfromname, ':'))
465 return( sfs.f_mntfromname );
471 special(char *file, int *nfs)
479 if (stat(file, &sb) < 0 ) {
484 if (( mtab = setmntent( "/etc/mtab", "r" )) == NULL ) {
488 while (( mnt = getmntent( mtab )) != NULL ) {
489 /* check for local fs */
490 if ( (stat( mnt->mnt_fsname, &sb ) == 0) && devno == sb.st_rdev) {
495 /* check for an nfs mount entry. the alternative is to use
496 * strcmp(mnt->mnt_type, MNTTYPE_NFS) instead of the strchr. */
497 if ((stat(mnt->mnt_dir, &sb) == 0) && (devno == sb.st_dev) &&
498 strchr(mnt->mnt_fsname, ':')) {
510 if (strcmp(mnt->mnt_type, "xfs") == 0)
514 return( mnt->mnt_fsname );
519 #endif /* __svr4__ */
522 static int getfsquota(struct vol *vol, const int uid, struct dqblk *dq)
531 memset(&dqg, 0, sizeof(dqg));
536 qc.addr = (caddr_t)dq;
537 if ( ioctl( vol->v_qfd, Q_QUOTACTL, &qc ) < 0 ) {
538 return( AFPERR_PARAM );
543 if ( quota( Q_GETDLIM, uid, vol->v_gvs, dq ) != 0 ) {
544 return( AFPERR_PARAM );
553 #define QCMD(a,b) (a)
557 /* for group quotas. we only use these if the user belongs
562 if ( seteuid( getuid() ) == 0 ) {
563 if ( quotactl( vol->v_path, QCMD(Q_GETQUOTA,USRQUOTA),
564 uid, (char *)dq ) != 0 ) {
565 /* try group quotas */
567 if ( quotactl(vol->v_path, QCMD(Q_GETQUOTA, GRPQUOTA),
568 groups[0], (char *) &dqg) != 0 ) {
570 return( AFPERR_PARAM );
578 if ( seteuid( getuid() ) == 0 ) {
579 if ( quotactl( vol->v_path, QCMD(Q_GETQUOTA, USRQUOTA),
580 uid, (char *)dq ) != 0 ) {
582 return ( AFPERR_PARAM );
588 if (get_linux_quota (WANT_USER_QUOTA, vol->v_gvs, uid, dq) !=0) {
589 return( AFPERR_PARAM );
592 if (get_linux_quota(WANT_GROUP_QUOTA, vol->v_gvs, getegid(), &dqg) != 0) {
594 LOG(log_debug, logtype_afpd, "group quota did not work!" );
595 #endif /* DEBUG_QUOTA */
597 return AFP_OK; /* no need to check user vs group quota */
603 /* return either the group quota entry or user quota entry,
604 whichever has the least amount of space remaining
607 /* if user space remaining > group space remaining */
609 /* if overquota, free space is 0 otherwise hard-current */
610 ( overquota( dq ) ? 0 : ( dq->dqb_bhardlimit ? dq->dqb_bhardlimit -
611 dq->dqb_curblocks : ~((u_int64_t) 0) ) )
615 ( overquota( &dqg ) ? 0 : ( dqg.dqb_bhardlimit ? dqg.dqb_bhardlimit -
616 dqg.dqb_curblocks : ~((u_int64_t) 0) ) )
620 /* use group quota limits rather than user limits */
621 dq->dqb_curblocks = dqg.dqb_curblocks;
622 dq->dqb_bhardlimit = dqg.dqb_bhardlimit;
623 dq->dqb_bsoftlimit = dqg.dqb_bsoftlimit;
624 dq->dqb_btimelimit = dqg.dqb_btimelimit;
630 #endif /* __svr4__ */
636 static int getquota( struct vol *vol, struct dqblk *dq, const u_int32_t bsize)
641 char buf[ MAXPATHLEN + 1];
643 if ( vol->v_qfd == -1 && vol->v_gvs == NULL) {
644 if (( p = mountp( vol->v_path, &vol->v_nfs)) == NULL ) {
645 LOG(log_info, logtype_afpd, "getquota: mountp %s fails", vol->v_path );
646 return( AFPERR_PARAM );
650 if (( vol->v_gvs = (char *)malloc( strlen( p ) + 1 )) == NULL ) {
651 LOG(log_error, logtype_afpd, "getquota: malloc: %s", strerror(errno) );
654 strcpy( vol->v_gvs, p );
657 sprintf( buf, "%s/quotas", p );
658 if (( vol->v_qfd = open( buf, O_RDONLY, 0 )) < 0 ) {
659 LOG(log_info, logtype_afpd, "open %s: %s", buf, strerror(errno) );
660 return( AFPERR_PARAM );
666 if ( vol->v_gvs == NULL ) {
667 if (( p = special( vol->v_path, &vol->v_nfs )) == NULL ) {
668 LOG(log_info, logtype_afpd, "getquota: special %s fails", vol->v_path );
669 return( AFPERR_PARAM );
672 if (( vol->v_gvs = (char *)malloc( strlen( p ) + 1 )) == NULL ) {
673 LOG(log_error, logtype_afpd, "getquota: malloc: %s", strerror(errno) );
676 strcpy( vol->v_gvs, p );
681 /* Digital UNIX: Two forms of specifying an NFS filesystem are possible,
682 either 'hostname:path' or 'path@hostname' (Ultrix heritage) */
685 char pathstring[MNAMELEN];
686 /* MNAMELEN ist defined in <sys/mount.h> */
689 if ((hostpath = strchr(vol->v_gvs,'@')) != NULL ) {
690 /* convert 'path@hostname' to 'hostname:path',
691 * call getnfsquota(),
692 * convert 'hostname:path' back to 'path@hostname' */
694 sprintf(pathstring,"%s:%s",hostpath+1,vol->v_gvs);
695 strcpy(vol->v_gvs,pathstring);
697 result = getnfsquota(vol, uuid, bsize, dq);
699 hostpath = strchr(vol->v_gvs,':');
701 sprintf(pathstring,"%s@%s",hostpath+1,vol->v_gvs);
702 strcpy(vol->v_gvs,pathstring);
707 /* vol->v_gvs is of the form 'hostname:path' */
708 return getnfsquota(vol, uuid, bsize, dq);
710 /* local filesystem */
711 return getfsquota(vol, uuid, dq);
714 return vol->v_nfs ? getnfsquota(vol, uuid, bsize, dq) :
715 getfsquota(vol, uuid, dq);
719 static int overquota( struct dqblk *dqblk)
723 if ( dqblk->dqb_curblocks > dqblk->dqb_bhardlimit &&
724 dqblk->dqb_bhardlimit != 0 ) {
728 if ( dqblk->dqb_curblocks < dqblk->dqb_bsoftlimit ||
729 dqblk->dqb_bsoftlimit == 0 ) {
733 if ( dqblk->dqb_bwarn ) {
737 if ( gettimeofday( &tv, NULL ) < 0 ) {
738 LOG(log_error, logtype_afpd, "overquota: gettimeofday: %s", strerror(errno) );
739 return( AFPERR_PARAM );
741 if ( dqblk->dqb_btimelimit && dqblk->dqb_btimelimit > tv.tv_sec ) {
749 * This next bit is basically for linux -- everything is fine
750 * if you use 1k blocks... but if you try (for example) to mount
751 * a volume via nfs from a netapp (which might use 4k blocks) everything
752 * gets reported improperly. I have no idea about dbtob on other
756 #ifdef HAVE_BROKEN_DBTOB
758 #define dbtob(a, b) ((VolSpace)((VolSpace)(a) * (VolSpace)(b)))
759 #define HAVE_2ARG_DBTOB
763 #define dbtob(a) ((a) << 10)
766 /* i do the cast to VolSpace here to make sure that 64-bit shifts
768 #ifdef HAVE_2ARG_DBTOB
769 #define tobytes(a, b) dbtob((VolSpace) (a), (VolSpace) (b))
771 #define tobytes(a, b) dbtob((VolSpace) (a))
774 int uquota_getvolspace( struct vol *vol, VolSpace *bfree, VolSpace *btotal, const u_int32_t bsize)
776 u_int64_t this_bsize;
781 if (getquota( vol, &dqblk, bsize) != 0 ) {
782 return( AFPERR_PARAM );
786 this_bsize = dqblk.bsize;
790 LOG(log_debug, logtype_afpd, "after calling getquota in uquota_getvolspace!" );
791 LOG(log_debug, logtype_afpd, "dqb_ihardlimit: %u", dqblk.dqb_ihardlimit );
792 LOG(log_debug, logtype_afpd, "dqb_isoftlimit: %u", dqblk.dqb_isoftlimit );
793 LOG(log_debug, logtype_afpd, "dqb_curinodes : %u", dqblk.dqb_curinodes );
794 LOG(log_debug, logtype_afpd, "dqb_bhardlimit: %u", dqblk.dqb_bhardlimit );
795 LOG(log_debug, logtype_afpd, "dqb_bsoftlimit: %u", dqblk.dqb_bsoftlimit );
796 LOG(log_debug, logtype_afpd, "dqb_curblocks : %u", dqblk.dqb_curblocks );
797 LOG(log_debug, logtype_afpd, "dqb_btime : %u", dqblk.dqb_btime );
798 LOG(log_debug, logtype_afpd, "dqb_itime : %u", dqblk.dqb_itime );
799 LOG(log_debug, logtype_afpd, "bsize/this_bsize : %u/%u", bsize, this_bsize );
800 LOG(log_debug, logtype_afpd, "dqblk.dqb_bhardlimit size: %u", tobytes( dqblk.dqb_bhardlimit, this_bsize ));
801 LOG(log_debug, logtype_afpd, "dqblk.dqb_bsoftlimit size: %u", tobytes( dqblk.dqb_bsoftlimit, this_bsize ));
802 LOG(log_debug, logtype_afpd, "dqblk.dqb_curblocks size: %u", tobytes( dqblk.dqb_curblocks, this_bsize ));
803 #endif /* DEBUG_QUOTA */
805 /* no limit set for this user. it might be set in the future. */
806 if (dqblk.dqb_bsoftlimit == 0 && dqblk.dqb_bhardlimit == 0) {
807 *btotal = *bfree = ~((VolSpace) 0);
808 } else if ( overquota( &dqblk )) {
809 if ( tobytes( dqblk.dqb_curblocks, this_bsize ) > tobytes( dqblk.dqb_bsoftlimit, this_bsize ) ) {
810 *btotal = tobytes( dqblk.dqb_curblocks, this_bsize );
814 *btotal = tobytes( dqblk.dqb_bsoftlimit, this_bsize );
815 *bfree = tobytes( dqblk.dqb_bsoftlimit, this_bsize ) -
816 tobytes( dqblk.dqb_curblocks, this_bsize );
819 *btotal = tobytes( dqblk.dqb_bhardlimit, this_bsize );
820 *bfree = tobytes( dqblk.dqb_bhardlimit, this_bsize ) -
821 tobytes( dqblk.dqb_curblocks, this_bsize );
825 LOG(log_debug, logtype_afpd, "bfree : %u", *bfree );
826 LOG(log_debug, logtype_afpd, "btotal : %u", *btotal );
827 LOG(log_debug, logtype_afpd, "bfree : %uKB", *bfree/1024 );
828 LOG(log_debug, logtype_afpd, "btotal : %uKB", *btotal/1024 );
833 #endif /* HAVE_LIBQUOTA */