/*
- * $Id: nfsquota.c,v 1.10 2002-08-29 17:22:06 jmarcus Exp $
+ * $Id: nfsquota.c,v 1.11 2003-12-28 13:51:12 srittau Exp $
*
* parts of this are lifted from the bsd quota program and are
* therefore under the following copyright:
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/param.h> /* for DEV_BSIZE */
-#include <sys/time.h> /* <rpc/rpc.h> on ultrix doesn't include this */
+#include <sys/time.h>
#include <atalk/logger.h>
#ifdef HAVE_NETDB_H
gq_rslt.GQR_RQUOTA.rq_bhardlimit*NFS_BSIZE;
dqp->dqb_bsoftlimit =
gq_rslt.GQR_RQUOTA.rq_bsoftlimit*NFS_BSIZE;
+#ifdef HAVE_STRUCT_IF_DQBLK
+ dqp->dqb_curspace =
+#else
dqp->dqb_curblocks =
+#endif
gq_rslt.GQR_RQUOTA.rq_curblocks*NFS_BSIZE;
-#ifdef ultrix
- dqp->dqb_bwarn = gq_rslt.GQR_RQUOTA.rq_btimeleft;
-#else /* ultrix */
dqp->dqb_btimelimit =
tv.tv_sec + gq_rslt.GQR_RQUOTA.rq_btimeleft;
-#endif /* ultrix */
*hostpath = ':';
return AFP_OK;
/*
- * $Id: quota.c,v 1.23 2003-12-15 04:49:56 srittau Exp $
+ * $Id: quota.c,v 1.24 2003-12-28 13:51:12 srittau Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
}
#else /* __svr4__ */
-#ifdef ultrix
-/*
-* Return the block-special device name associated with the filesystem
-* on which "file" resides. Returns NULL on failure.
-*/
-
-static char *
-special( file, nfs )
-char *file;
-int *nfs;
-{
- static struct fs_data fsd;
-
- if ( getmnt(0, &fsd, 0, STAT_ONE, file ) < 0 ) {
- LOG(log_info, logtype_afpd, "special: getmnt %s: %s", file, strerror(errno) );
- return( NULL );
- }
-
- /* XXX: does this really detect an nfs mounted fs? */
- if (strchr(fsd.fd_req.devname, ':'))
- *nfs = 1;
- return( fsd.fd_req.devname );
-}
-
-#else /* ultrix */
#if (defined(HAVE_SYS_MOUNT_H) && !defined(__linux__)) || defined(BSD4_4) || defined(_IBMR2)
static char *
}
#endif /* BSD4_4 */
-#endif /* ultrix */
#endif /* __svr4__ */
}
#else /* __svr4__ */
-#ifdef ultrix
- if ( quota( Q_GETDLIM, uid, vol->v_gvs, dq ) != 0 ) {
- return( AFPERR_PARAM );
- }
-#else /* ultrix */
#ifndef USRQUOTA
#define USRQUOTA 0
/* set stuff up for group quotas if necessary */
/* max(user blocks, group blocks) */
+#ifdef HAVE_STRUCT_IF_DQBLK
+ if (dqg.dqb_curspace && (dq->dqb_curspace < dqg.dqb_curspace))
+ dq->dqb_curspace = dqg.dqb_curspace;
+#else
if (dqg.dqb_curblocks && (dq->dqb_curblocks < dqg.dqb_curblocks))
dq->dqb_curblocks = dqg.dqb_curblocks;
+#endif
/* min(user limit, group limit) */
if (dqg.dqb_bhardlimit && (!dq->dqb_bhardlimit ||
#endif /* TRU64 */
-#endif /* ultrix */
#endif /* __svr4__ */
return AFP_OK;
{
struct timeval tv;
+#ifdef HAVE_STRUCT_IF_DQBLK
+ if ( dqblk->dqb_curspace < dqblk->dqb_bsoftlimit ) {
+#else
if ( dqblk->dqb_curblocks < dqblk->dqb_bsoftlimit ) {
- return( 0 );
- }
-#ifdef ultrix
- if ( dqblk->dqb_bwarn ) {
- return( 0 );
+#endif
+ return 0 ;
}
-#else /* ultrix */
if ( gettimeofday( &tv, 0 ) < 0 ) {
LOG(log_error, logtype_afpd, "overquota: gettimeofday: %s", strerror(errno) );
return( AFPERR_PARAM );
if ( dqblk->dqb_btimelimit && dqblk->dqb_btimelimit > tv.tv_sec ) {
return( 0 );
}
-#endif /* ultrix */
return( 1 );
}
if (dqblk.dqb_bsoftlimit == 0 && dqblk.dqb_bhardlimit == 0) {
*btotal = *bfree = ~((VolSpace) 0);
} else if ( overquota( &dqblk )) {
+#ifdef HAVE_STRUCT_IF_DQBLK
+ if ( tobytes( dqblk.dqb_curspace, bsize ) > tobytes( dqblk.dqb_bhardlimit, bsize ) ) {
+ *btotal = tobytes( dqblk.dqb_curspace, bsize );
+#else
if ( tobytes( dqblk.dqb_curblocks, bsize ) > tobytes( dqblk.dqb_bhardlimit, bsize ) ) {
*btotal = tobytes( dqblk.dqb_curblocks, bsize );
+#endif
*bfree = 0;
}
else {
*btotal = tobytes( dqblk.dqb_bhardlimit, bsize );
*bfree = tobytes( dqblk.dqb_bhardlimit, bsize ) -
+#ifdef HAVE_STRUCT_IF_DQBLK
+ tobytes( dqblk.dqb_curspace, bsize );
+#else
tobytes( dqblk.dqb_curblocks, bsize );
+#endif
}
} else {
*btotal = tobytes( dqblk.dqb_bsoftlimit, bsize );
/*
- * $Id: unix.h,v 1.15 2003-12-15 04:59:45 srittau Exp $
+ * $Id: unix.h,v 1.16 2003-12-28 13:51:12 srittau Exp $
*/
#ifndef AFPD_UNIX_H
#include <sys/mnttab.h>
#endif /* __svr4__ || HAVE_SYS_MNTTAB_H */
-#if defined(HAVE_SYS_MOUNT_H) || defined(BSD4_4) || \
- defined(linux) || defined(ultrix)
+#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
-#endif /* HAVE_SYS_MOUNT_H || BSD4_4 || linux || ultrix */
+#endif /* HAVE_SYS_MOUNT_H */
#if defined(linux) || defined(HAVE_MNTENT_H)
#include <mntent.h>
#include <sys/stat.h>
#include "directory.h"
+#ifdef HAVE_STRUCT_IF_DQBLK
+#undef dqblk
+#define dqblk if_dqblk
+#endif
+
extern int getnfsquota __P((const struct vol *, const int, const u_int32_t,
struct dqblk *));