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>
51 #include <quota/quota.h>
54 getfreespace(struct vol *vol, VolSpace *bfree, VolSpace *btotal,
55 uid_t uid, const char *classq)
58 struct ufs_quota_entry ufsq[QUOTA_NLIMITS];
61 if (time(&now) == -1) {
62 LOG(log_info, logtype_afpd, "time(): %s",
67 if ( seteuid( getuid() ) != 0 ) {
68 LOG(log_info, logtype_afpd, "seteuid(): %s",
72 if ((retq = getfsquota(vol->v_path, ufsq, uid, classq)) < 0) {
73 LOG(log_info, logtype_afpd, "getfsquota(%s, %s): %s",
74 vol->v_path, classq, strerror(errno));
80 switch(QL_STATUS(quota_check_limit(ufsq[QUOTA_LIMIT_BLOCK].ufsqe_cur, 1,
81 ufsq[QUOTA_LIMIT_BLOCK].ufsqe_softlimit,
82 ufsq[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit,
83 ufsq[QUOTA_LIMIT_BLOCK].ufsqe_time, now))) {
87 *btotal = dbtob(ufsq[QUOTA_LIMIT_BLOCK].ufsqe_cur);
90 *bfree = dbtob(ufsq[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit -
91 ufsq[QUOTA_LIMIT_BLOCK].ufsqe_cur);
92 *btotal = dbtob(ufsq[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit);
98 int uquota_getvolspace( struct vol *vol, VolSpace *bfree, VolSpace *btotal, const u_int32_t bsize)
101 VolSpace ubfree, ubtotal;
102 VolSpace gbfree, gbtotal;
104 uretq = getfreespace(vol, &ubfree, &ubtotal,
105 uuid, QUOTADICT_CLASS_USER);
106 LOG(log_info, logtype_afpd, "getfsquota(%s): %d %d",
107 vol->v_path, (int)ubfree, (int)ubtotal);
109 gretq = getfreespace(vol, &ubfree, &ubtotal,
110 groups[0], QUOTADICT_CLASS_GROUP);
113 if (uretq < 1 && gretq < 1) { /* no quota for this fs */
117 /* use group quotas */
120 } else if (gretq < 1) {
121 /* use user quotas */
125 /* return smallest remaining space of user and group */
126 if (ubfree < gbfree) {
138 #else /* HAVE_LIBQUOTA */
141 #define DEBUG_QUOTA 0
144 #define WANT_USER_QUOTA 0
145 #define WANT_GROUP_QUOTA 1
147 #ifdef NEED_QUOTACTL_WRAPPER
148 int quotactl(int cmd, const char *special, int id, caddr_t addr)
150 return syscall(__NR_quotactl, cmd, special, id, addr);
152 #endif /* NEED_QUOTACTL_WRAPPER */
154 static int overquota( struct dqblk *);
158 #ifdef HAVE_LINUX_XQM_H
159 #include <linux/xqm.h>
161 #ifdef HAVE_XFS_XQM_H
163 #define HAVE_LINUX_XQM_H
165 #ifdef HAVE_LINUX_DQBLK_XFS_H
166 #include <linux/dqblk_xfs.h>
167 #define HAVE_LINUX_XQM_H
168 #endif /* HAVE_LINUX_DQBLK_XFS_H */
169 #endif /* HAVE_XFS_XQM_H */
170 #endif /* HAVE_LINUX_XQM_H */
172 #include <linux/unistd.h>
174 static int is_xfs = 0;
176 static int get_linux_xfs_quota(int, char*, uid_t, struct dqblk *);
177 static int get_linux_fs_quota(int, char*, uid_t, struct dqblk *);
179 /* format supported by current kernel */
180 static int kernel_iface = IFACE_UNSET;
183 ** Check kernel quota version
184 ** Taken from quota-tools 3.08 by Jan Kara <jack@suse.cz>
186 static void linuxquota_get_api( void )
188 #ifndef LINUX_API_VERSION
191 if (stat("/proc/sys/fs/quota", &st) == 0) {
192 kernel_iface = IFACE_GENERIC;
195 struct dqstats_v2 v2_stats;
196 struct sigaction sig;
197 struct sigaction oldsig;
199 /* This signal handling is needed because old kernels send us SIGSEGV as they try to resolve the device */
200 sig.sa_handler = SIG_IGN;
201 sig.sa_sigaction = NULL;
203 sigemptyset(&sig.sa_mask);
204 if (sigaction(SIGSEGV, &sig, &oldsig) < 0) {
205 LOG( log_error, logtype_afpd, "cannot set SEGV signal handler: %s", strerror(errno));
208 if (quotactl(QCMD(Q_V2_GETSTATS, 0), NULL, 0, (void *)&v2_stats) >= 0) {
209 kernel_iface = IFACE_VFSV0;
211 else if (errno != ENOSYS && errno != ENOTSUP) {
212 /* RedHat 7.1 (2.4.2-2) newquota check
213 * Q_V2_GETSTATS in it's old place, Q_GETQUOTA in the new place
214 * (they haven't moved Q_GETSTATS to its new value) */
217 char tmp[1024]; /* Just temporary buffer */
219 if (quotactl(QCMD(Q_V1_GETSTATS, 0), NULL, 0, tmp))
221 if (quotactl(QCMD(Q_V1_GETQUOTA, 0), "/dev/null", 0, tmp))
224 /* On a RedHat 2.4.2-2 we expect 0, EINVAL
225 * On a 2.4.x we expect 0, ENOENT
226 * On a 2.4.x-ac we wont get here */
227 if (err_stat == 0 && err_quota == EINVAL) {
228 kernel_iface = IFACE_VFSV0;
231 kernel_iface = IFACE_VFSOLD;
235 /* This branch is *not* in quota-tools 3.08
236 ** but without it quota version is not correctly
237 ** identified for the original SuSE 8.0 kernel */
238 unsigned int vers_no;
241 if ((qf = fopen("/proc/fs/quota", "r"))) {
242 if (fscanf(qf, "Version %u", &vers_no) == 1) {
243 if ( (vers_no == (6*10000 + 5*100 + 0)) ||
244 (vers_no == (6*10000 + 5*100 + 1)) ) {
245 kernel_iface = IFACE_VFSV0;
251 if (sigaction(SIGSEGV, &oldsig, NULL) < 0) {
252 LOG(log_error, logtype_afpd, "cannot reset signal handler: %s", strerror(errno));
258 if (kernel_iface == IFACE_UNSET)
259 kernel_iface = IFACE_VFSOLD;
261 #else /* defined LINUX_API_VERSION */
262 kernel_iface = LINUX_API_VERSION;
266 /****************************************************************************/
268 static int get_linux_quota(int what, char *path, uid_t euser_id, struct dqblk *dp)
273 r=get_linux_xfs_quota(what, path, euser_id, dp);
275 r=get_linux_fs_quota(what, path, euser_id, dp);
280 /****************************************************************************
281 Abstract out the XFS Quota Manager quota get call.
282 ****************************************************************************/
284 static int get_linux_xfs_quota(int what, char *path, uid_t euser_id, struct dqblk *dqb)
287 #ifdef HAVE_LINUX_XQM_H
288 struct fs_disk_quota D;
290 memset (&D, 0, sizeof(D));
292 if ((ret = quotactl(QCMD(Q_XGETQUOTA,(what ? GRPQUOTA : USRQUOTA)), path, euser_id, (caddr_t)&D)))
295 dqb->bsize = (u_int64_t)512;
296 dqb->dqb_bsoftlimit = (u_int64_t)D.d_blk_softlimit;
297 dqb->dqb_bhardlimit = (u_int64_t)D.d_blk_hardlimit;
298 dqb->dqb_ihardlimit = (u_int64_t)D.d_ino_hardlimit;
299 dqb->dqb_isoftlimit = (u_int64_t)D.d_ino_softlimit;
300 dqb->dqb_curinodes = (u_int64_t)D.d_icount;
301 dqb->dqb_curblocks = (u_int64_t)D.d_bcount;
307 ** Wrapper for the quotactl(GETQUOTA) call.
308 ** For API v2 the results are copied back into a v1 structure.
309 ** Taken from quota-1.4.8 perl module
311 static int get_linux_fs_quota(int what, char *path, uid_t euser_id, struct dqblk *dqb)
315 if (kernel_iface == IFACE_UNSET)
316 linuxquota_get_api();
318 if (kernel_iface == IFACE_GENERIC)
320 struct dqblk_v3 dqb3;
322 ret = quotactl(QCMD(Q_V3_GETQUOTA, (what ? GRPQUOTA : USRQUOTA)), path, euser_id, (caddr_t) &dqb3);
325 dqb->dqb_bhardlimit = dqb3.dqb_bhardlimit;
326 dqb->dqb_bsoftlimit = dqb3.dqb_bsoftlimit;
327 dqb->dqb_curblocks = dqb3.dqb_curspace / DEV_QBSIZE;
328 dqb->dqb_ihardlimit = dqb3.dqb_ihardlimit;
329 dqb->dqb_isoftlimit = dqb3.dqb_isoftlimit;
330 dqb->dqb_curinodes = dqb3.dqb_curinodes;
331 dqb->dqb_btime = dqb3.dqb_btime;
332 dqb->dqb_itime = dqb3.dqb_itime;
333 dqb->bsize = DEV_QBSIZE;
336 else if (kernel_iface == IFACE_VFSV0)
338 struct dqblk_v2 dqb2;
340 ret = quotactl(QCMD(Q_V2_GETQUOTA, (what ? GRPQUOTA : USRQUOTA)), path, euser_id, (caddr_t) &dqb2);
343 dqb->dqb_bhardlimit = dqb2.dqb_bhardlimit;
344 dqb->dqb_bsoftlimit = dqb2.dqb_bsoftlimit;
345 dqb->dqb_curblocks = dqb2.dqb_curspace / DEV_QBSIZE;
346 dqb->dqb_ihardlimit = dqb2.dqb_ihardlimit;
347 dqb->dqb_isoftlimit = dqb2.dqb_isoftlimit;
348 dqb->dqb_curinodes = dqb2.dqb_curinodes;
349 dqb->dqb_btime = dqb2.dqb_btime;
350 dqb->dqb_itime = dqb2.dqb_itime;
351 dqb->bsize = DEV_QBSIZE;
354 else /* if (kernel_iface == IFACE_VFSOLD) */
356 struct dqblk_v1 dqb1;
358 ret = quotactl(QCMD(Q_V1_GETQUOTA, (what ? GRPQUOTA : USRQUOTA)), path, euser_id, (caddr_t) &dqb1);
361 dqb->dqb_bhardlimit = dqb1.dqb_bhardlimit;
362 dqb->dqb_bsoftlimit = dqb1.dqb_bsoftlimit;
363 dqb->dqb_curblocks = dqb1.dqb_curblocks;
364 dqb->dqb_ihardlimit = dqb1.dqb_ihardlimit;
365 dqb->dqb_isoftlimit = dqb1.dqb_isoftlimit;
366 dqb->dqb_curinodes = dqb1.dqb_curinodes;
367 dqb->dqb_btime = dqb1.dqb_btime;
368 dqb->dqb_itime = dqb1.dqb_itime;
369 dqb->bsize = DEV_QBSIZE;
377 #if defined(HAVE_SYS_MNTTAB_H) || defined(__svr4__)
379 * Return the mount point associated with the filesystem
380 * on which "file" resides. Returns NULL on failure.
383 mountp( char *file, int *nfs)
388 static struct mnttab mnt;
390 if ( lstat( file, &sb ) < 0 ) {
395 if (( mtab = fopen( "/etc/mnttab", "r" )) == NULL ) {
399 while ( getmntent( mtab, &mnt ) == 0 ) {
401 if ( (lstat( mnt.mnt_special, &sb ) == 0) && (devno == sb.st_rdev)) {
403 return mnt.mnt_mountp;
406 /* check for nfs. we probably should use
407 * strcmp(mnt.mnt_fstype, MNTTYPE_NFS), but that's not as fast. */
408 if ((lstat(mnt.mnt_mountp, &sb) == 0) && (devno == sb.st_dev) &&
409 strchr(mnt.mnt_special, ':')) {
412 return mnt.mnt_special;
423 * Return the block-special device name associated with the filesystem
424 * on which "file" resides. Returns NULL on failure.
428 special( char *file, int *nfs)
430 static struct fs_data fsd;
432 if ( getmnt(0, &fsd, 0, STAT_ONE, file ) < 0 ) {
433 LOG(log_info, logtype_afpd, "special: getmnt %s: %s", file, strerror(errno) );
437 /* XXX: does this really detect an nfs mounted fs? */
438 if (strchr(fsd.fd_req.devname, ':'))
440 return( fsd.fd_req.devname );
444 #if (defined(HAVE_SYS_MOUNT_H) && !defined(__linux__)) || defined(BSD4_4) || defined(_IBMR2)
447 special(char *file, int *nfs)
449 static struct statfs sfs;
451 if ( statfs( file, &sfs ) < 0 ) {
456 /* Digital UNIX: The struct sfs contains a field sfs.f_type,
457 * the MOUNT_* constants are defined in <sys/mount.h> */
458 if ((sfs.f_type == MOUNT_NFS)||(sfs.f_type == MOUNT_NFS3))
460 /* XXX: make sure this really detects an nfs mounted fs */
461 if (strchr(sfs.f_mntfromname, ':'))
464 return( sfs.f_mntfromname );
470 special(char *file, int *nfs)
478 if ( lstat( file, &sb ) < 0 ) {
483 if (( mtab = setmntent( "/etc/mtab", "r" )) == NULL ) {
487 while (( mnt = getmntent( mtab )) != NULL ) {
488 /* check for local fs */
489 if ( (lstat( mnt->mnt_fsname, &sb ) == 0) && devno == sb.st_rdev) {
494 /* check for an nfs mount entry. the alternative is to use
495 * strcmp(mnt->mnt_type, MNTTYPE_NFS) instead of the strchr. */
496 if ((lstat(mnt->mnt_dir, &sb) == 0) && (devno == sb.st_dev) &&
497 strchr(mnt->mnt_fsname, ':')) {
509 if (strcmp(mnt->mnt_type, "xfs") == 0)
513 return( mnt->mnt_fsname );
518 #endif /* __svr4__ */
521 static int getfsquota(struct vol *vol, const int uid, struct dqblk *dq)
530 memset(&dqg, 0, sizeof(dqg));
535 qc.addr = (caddr_t)dq;
536 if ( ioctl( vol->v_qfd, Q_QUOTACTL, &qc ) < 0 ) {
537 return( AFPERR_PARAM );
542 if ( quota( Q_GETDLIM, uid, vol->v_gvs, dq ) != 0 ) {
543 return( AFPERR_PARAM );
552 #define QCMD(a,b) (a)
556 /* for group quotas. we only use these if the user belongs
561 if ( seteuid( getuid() ) == 0 ) {
562 if ( quotactl( vol->v_path, QCMD(Q_GETQUOTA,USRQUOTA),
563 uid, (char *)dq ) != 0 ) {
564 /* try group quotas */
566 if ( quotactl(vol->v_path, QCMD(Q_GETQUOTA, GRPQUOTA),
567 groups[0], (char *) &dqg) != 0 ) {
569 return( AFPERR_PARAM );
577 if ( seteuid( getuid() ) == 0 ) {
578 if ( quotactl( vol->v_path, QCMD(Q_GETQUOTA, USRQUOTA),
579 uid, (char *)dq ) != 0 ) {
581 return ( AFPERR_PARAM );
587 if (get_linux_quota (WANT_USER_QUOTA, vol->v_gvs, uid, dq) !=0) {
588 return( AFPERR_PARAM );
591 if (get_linux_quota(WANT_GROUP_QUOTA, vol->v_gvs, getegid(), &dqg) != 0) {
593 LOG(log_debug, logtype_afpd, "group quota did not work!" );
594 #endif /* DEBUG_QUOTA */
596 return AFP_OK; /* no need to check user vs group quota */
602 /* return either the group quota entry or user quota entry,
603 whichever has the least amount of space remaining
606 /* if user space remaining > group space remaining */
608 /* if overquota, free space is 0 otherwise hard-current */
609 ( overquota( dq ) ? 0 : ( dq->dqb_bhardlimit ? dq->dqb_bhardlimit -
610 dq->dqb_curblocks : ~((u_int64_t) 0) ) )
614 ( overquota( &dqg ) ? 0 : ( dqg.dqb_bhardlimit ? dqg.dqb_bhardlimit -
615 dqg.dqb_curblocks : ~((u_int64_t) 0) ) )
619 /* use group quota limits rather than user limits */
620 dq->dqb_curblocks = dqg.dqb_curblocks;
621 dq->dqb_bhardlimit = dqg.dqb_bhardlimit;
622 dq->dqb_bsoftlimit = dqg.dqb_bsoftlimit;
623 dq->dqb_btimelimit = dqg.dqb_btimelimit;
629 #endif /* __svr4__ */
635 static int getquota( struct vol *vol, struct dqblk *dq, const u_int32_t bsize)
640 char buf[ MAXPATHLEN + 1];
642 if ( vol->v_qfd == -1 && vol->v_gvs == NULL) {
643 if (( p = mountp( vol->v_path, &vol->v_nfs)) == NULL ) {
644 LOG(log_info, logtype_afpd, "getquota: mountp %s fails", vol->v_path );
645 return( AFPERR_PARAM );
649 if (( vol->v_gvs = (char *)malloc( strlen( p ) + 1 )) == NULL ) {
650 LOG(log_error, logtype_afpd, "getquota: malloc: %s", strerror(errno) );
653 strcpy( vol->v_gvs, p );
656 sprintf( buf, "%s/quotas", p );
657 if (( vol->v_qfd = open( buf, O_RDONLY, 0 )) < 0 ) {
658 LOG(log_info, logtype_afpd, "open %s: %s", buf, strerror(errno) );
659 return( AFPERR_PARAM );
665 if ( vol->v_gvs == NULL ) {
666 if (( p = special( vol->v_path, &vol->v_nfs )) == NULL ) {
667 LOG(log_info, logtype_afpd, "getquota: special %s fails", vol->v_path );
668 return( AFPERR_PARAM );
671 if (( vol->v_gvs = (char *)malloc( strlen( p ) + 1 )) == NULL ) {
672 LOG(log_error, logtype_afpd, "getquota: malloc: %s", strerror(errno) );
675 strcpy( vol->v_gvs, p );
680 /* Digital UNIX: Two forms of specifying an NFS filesystem are possible,
681 either 'hostname:path' or 'path@hostname' (Ultrix heritage) */
684 char pathstring[MNAMELEN];
685 /* MNAMELEN ist defined in <sys/mount.h> */
688 if ((hostpath = strchr(vol->v_gvs,'@')) != NULL ) {
689 /* convert 'path@hostname' to 'hostname:path',
690 * call getnfsquota(),
691 * convert 'hostname:path' back to 'path@hostname' */
693 sprintf(pathstring,"%s:%s",hostpath+1,vol->v_gvs);
694 strcpy(vol->v_gvs,pathstring);
696 result = getnfsquota(vol, uuid, bsize, dq);
698 hostpath = strchr(vol->v_gvs,':');
700 sprintf(pathstring,"%s@%s",hostpath+1,vol->v_gvs);
701 strcpy(vol->v_gvs,pathstring);
706 /* vol->v_gvs is of the form 'hostname:path' */
707 return getnfsquota(vol, uuid, bsize, dq);
709 /* local filesystem */
710 return getfsquota(vol, uuid, dq);
713 return vol->v_nfs ? getnfsquota(vol, uuid, bsize, dq) :
714 getfsquota(vol, uuid, dq);
718 static int overquota( struct dqblk *dqblk)
722 if ( dqblk->dqb_curblocks > dqblk->dqb_bhardlimit &&
723 dqblk->dqb_bhardlimit != 0 ) {
727 if ( dqblk->dqb_curblocks < dqblk->dqb_bsoftlimit ||
728 dqblk->dqb_bsoftlimit == 0 ) {
732 if ( dqblk->dqb_bwarn ) {
736 if ( gettimeofday( &tv, NULL ) < 0 ) {
737 LOG(log_error, logtype_afpd, "overquota: gettimeofday: %s", strerror(errno) );
738 return( AFPERR_PARAM );
740 if ( dqblk->dqb_btimelimit && dqblk->dqb_btimelimit > tv.tv_sec ) {
748 * This next bit is basically for linux -- everything is fine
749 * if you use 1k blocks... but if you try (for example) to mount
750 * a volume via nfs from a netapp (which might use 4k blocks) everything
751 * gets reported improperly. I have no idea about dbtob on other
755 #ifdef HAVE_BROKEN_DBTOB
757 #define dbtob(a, b) ((VolSpace)((VolSpace)(a) * (VolSpace)(b)))
758 #define HAVE_2ARG_DBTOB
762 #define dbtob(a) ((a) << 10)
765 /* i do the cast to VolSpace here to make sure that 64-bit shifts
767 #ifdef HAVE_2ARG_DBTOB
768 #define tobytes(a, b) dbtob((VolSpace) (a), (VolSpace) (b))
770 #define tobytes(a, b) dbtob((VolSpace) (a))
773 int uquota_getvolspace( struct vol *vol, VolSpace *bfree, VolSpace *btotal, const u_int32_t bsize)
775 u_int64_t this_bsize;
780 if (getquota( vol, &dqblk, bsize) != 0 ) {
781 return( AFPERR_PARAM );
785 this_bsize = dqblk.bsize;
789 LOG(log_debug, logtype_afpd, "after calling getquota in uquota_getvolspace!" );
790 LOG(log_debug, logtype_afpd, "dqb_ihardlimit: %u", dqblk.dqb_ihardlimit );
791 LOG(log_debug, logtype_afpd, "dqb_isoftlimit: %u", dqblk.dqb_isoftlimit );
792 LOG(log_debug, logtype_afpd, "dqb_curinodes : %u", dqblk.dqb_curinodes );
793 LOG(log_debug, logtype_afpd, "dqb_bhardlimit: %u", dqblk.dqb_bhardlimit );
794 LOG(log_debug, logtype_afpd, "dqb_bsoftlimit: %u", dqblk.dqb_bsoftlimit );
795 LOG(log_debug, logtype_afpd, "dqb_curblocks : %u", dqblk.dqb_curblocks );
796 LOG(log_debug, logtype_afpd, "dqb_btime : %u", dqblk.dqb_btime );
797 LOG(log_debug, logtype_afpd, "dqb_itime : %u", dqblk.dqb_itime );
798 LOG(log_debug, logtype_afpd, "bsize/this_bsize : %u/%u", bsize, this_bsize );
799 LOG(log_debug, logtype_afpd, "dqblk.dqb_bhardlimit size: %u", tobytes( dqblk.dqb_bhardlimit, this_bsize ));
800 LOG(log_debug, logtype_afpd, "dqblk.dqb_bsoftlimit size: %u", tobytes( dqblk.dqb_bsoftlimit, this_bsize ));
801 LOG(log_debug, logtype_afpd, "dqblk.dqb_curblocks size: %u", tobytes( dqblk.dqb_curblocks, this_bsize ));
802 #endif /* DEBUG_QUOTA */
804 /* no limit set for this user. it might be set in the future. */
805 if (dqblk.dqb_bsoftlimit == 0 && dqblk.dqb_bhardlimit == 0) {
806 *btotal = *bfree = ~((VolSpace) 0);
807 } else if ( overquota( &dqblk )) {
808 if ( tobytes( dqblk.dqb_curblocks, this_bsize ) > tobytes( dqblk.dqb_bsoftlimit, this_bsize ) ) {
809 *btotal = tobytes( dqblk.dqb_curblocks, this_bsize );
813 *btotal = tobytes( dqblk.dqb_bsoftlimit, this_bsize );
814 *bfree = tobytes( dqblk.dqb_bsoftlimit, this_bsize ) -
815 tobytes( dqblk.dqb_curblocks, this_bsize );
818 *btotal = tobytes( dqblk.dqb_bhardlimit, this_bsize );
819 *bfree = tobytes( dqblk.dqb_bhardlimit, this_bsize ) -
820 tobytes( dqblk.dqb_curblocks, this_bsize );
824 LOG(log_debug, logtype_afpd, "bfree : %u", *bfree );
825 LOG(log_debug, logtype_afpd, "btotal : %u", *btotal );
826 LOG(log_debug, logtype_afpd, "bfree : %uKB", *bfree/1024 );
827 LOG(log_debug, logtype_afpd, "btotal : %uKB", *btotal/1024 );
832 #endif /* HAVE_LIBQUOTA */