/*
- * $Id: quota.c,v 1.25 2005-04-28 20:49:44 bfernhomberg Exp $
+ * $Id: quota.c,v 1.32 2009-10-14 02:24:05 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#include "volume.h"
#include "unix.h"
+/*
#define DEBUG_QUOTA 0
+*/
+
#define WANT_USER_QUOTA 0
#define WANT_GROUP_QUOTA 1
#ifdef HAVE_XFS_XQM_H
#include <xfs/xqm.h>
#define HAVE_LINUX_XQM_H
+#else
+#ifdef HAVE_LINUX_DQBLK_XFS_H
+#include <linux/dqblk_xfs.h>
+#define HAVE_LINUX_XQM_H
+#endif /* HAVE_LINUX_DQBLK_XFS_H */
#endif /* HAVE_XFS_XQM_H */
#endif /* HAVE_LINUX_XQM_H */
Abstract out the XFS Quota Manager quota get call.
****************************************************************************/
-static int get_linux_xfs_quota(what, path, euser_id, dqb)
-int what;
-char *path;
-uid_t euser_id;
-struct dqblk *dqb;
+static int get_linux_xfs_quota(int what, char *path, uid_t euser_id, struct dqblk *dqb)
{
int ret = -1;
#ifdef HAVE_LINUX_XQM_H
** For API v2 the results are copied back into a v1 structure.
** Taken from quota-1.4.8 perl module
*/
-static int get_linux_fs_quota( what, path, euser_id, dqb)
-int what;
-char *path;
-uid_t euser_id;
-struct dqblk *dqb;
+static int get_linux_fs_quota(int what, char *path, uid_t euser_id, struct dqblk *dqb)
{
int ret;
* on which "file" resides. Returns NULL on failure.
*/
static char *
-mountp( file, nfs)
-char *file;
-int *nfs;
+mountp( char *file, int *nfs)
{
struct stat sb;
FILE *mtab;
*/
static char *
-special( file, nfs )
-char *file;
-int *nfs;
+special( char *file, int *nfs)
{
static struct fs_data fsd;
#if (defined(HAVE_SYS_MOUNT_H) && !defined(__linux__)) || defined(BSD4_4) || defined(_IBMR2)
static char *
-special( file, nfs )
-char *file;
-int *nfs;
+special(char *file, int *nfs)
{
static struct statfs sfs;
#else /* BSD4_4 */
static char *
-special( file, nfs )
-char *file;
-int *nfs;
+special(char *file, int *nfs)
{
struct stat sb;
FILE *mtab;
#endif /* __svr4__ */
-static int getfsquota(vol, uid, dq)
-struct vol *vol;
-const int uid;
-struct dqblk *dq;
+static int getfsquota(struct vol *vol, const int uid, struct dqblk *dq)
{
struct dqblk dqg;
}
-static int getquota( vol, dq, bsize)
-struct vol *vol;
-struct dqblk *dq;
-const u_int32_t bsize;
+static int getquota( struct vol *vol, struct dqblk *dq, const u_int32_t bsize)
{
char *p;
#endif /* TRU64 */
}
-static int overquota( dqblk )
-struct dqblk *dqblk;
+static int overquota( struct dqblk *dqblk)
{
struct timeval tv;
return( 0 );
}
#else /* ultrix */
- if ( gettimeofday( &tv, 0 ) < 0 ) {
+ if ( gettimeofday( &tv, NULL ) < 0 ) {
LOG(log_error, logtype_afpd, "overquota: gettimeofday: %s", strerror(errno) );
return( AFPERR_PARAM );
}
#define tobytes(a, b) dbtob((VolSpace) (a))
#endif
-int uquota_getvolspace( vol, bfree, btotal, bsize)
-struct vol *vol;
-VolSpace *bfree, *btotal;
-const u_int32_t bsize;
+int uquota_getvolspace( struct vol *vol, VolSpace *bfree, VolSpace *btotal, const u_int32_t bsize)
{
u_int64_t this_bsize;
struct dqblk dqblk;
this_bsize = dqblk.bsize;
#endif
-#if DEBUG_QUOTA
+#ifdef DEBUG_QUOTA
LOG(log_info, logtype_afpd, "after calling getquota in uquota_getvolspace!" );
LOG(log_info, logtype_afpd, "dqb_ihardlimit: %u", dqblk.dqb_ihardlimit );
LOG(log_info, logtype_afpd, "dqb_isoftlimit: %u", dqblk.dqb_isoftlimit );
tobytes( dqblk.dqb_curblocks, this_bsize );
}
-#if DEBUG_QUOTA
+#ifdef DEBUG_QUOTA
LOG(log_info, logtype_afpd, "bfree : %u", *bfree );
LOG(log_info, logtype_afpd, "btotal : %u", *btotal );
LOG(log_info, logtype_afpd, "bfree : %uKB", *bfree/1024 );