/* @(#)src/sol/kernel/base/vx_quota.h	3.11 01/04/99 06:19:48 -  */
/* #ident "@(#)vxfs:src/sol/kernel/base/vx_quota.h	3.11" */

/*
 * Copyright (c) 1998 VERITAS Software Corporation.  ALL RIGHTS RESERVED.
 * UNPUBLISHED -- RIGHTS RESERVED UNDER THE COPYRIGHT
 * LAWS OF THE UNITED STATES.  USE OF A COPYRIGHT NOTICE
 * IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
 * OR DISCLOSURE.
 *
 * THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND
 * TRADE SECRETS OF VERITAS SOFTWARE.  USE, DISCLOSURE,
 * OR REPRODUCTION IS PROHIBITED WITHOUT THE PRIOR
 * EXPRESS WRITTEN PERMISSION OF VERITAS SOFTWARE.
 *
 *		RESTRICTED RIGHTS LEGEND
 * USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT IS
 * SUBJECT TO RESTRICTIONS AS SET FORTH IN SUBPARAGRAPH
 * (C) (1) (ii) OF THE RIGHTS IN TECHNICAL DATA AND
 * COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013.
 *		VERITAS SOFTWARE
 * 1600 PLYMOUTH STREET, MOUNTAIN VIEW, CA 94043
 */

#ifndef	_FS_VXFS_VX_QUOTA_H
#define	_FS_VXFS_VX_QUOTA_H

/*
 * The following constants define the default amount of time given a user
 * before the soft limits are treated as hard limits (usually resulting
 * in an allocation failure). These may be  modified by the quotactl
 * system call with the VX_SETQLIM or VX_SETQUOTA commands.
 */

#define	VX_DQ_FTIMELIMIT	(7 * 24*60*60)		/* 1 week */
#define	VX_DQ_BTIMELIMIT	(7 * 24*60*60)		/* 1 week */

/*
 * The dqblk structure defines the format of the disk quota file
 * (as it appears on disk) - the file is an array of these structures
 * indexed by user number.  The setquota sys call establishes the inode
 * for each quota file (a pointer is retained in the mount structure).
 */

struct vx_dqblk {
	vx_u32_t	dqb_bhardlimit; /* absolute limit on disk blks alloc */
	vx_u32_t	dqb_bsoftlimit; /* preferred limit on disk blks */
	vx_u32_t	dqb_curblocks;	/* current block count */
	vx_u32_t	dqb_fhardlimit; /* maximum # allocated files + 1 */
	vx_u32_t	dqb_fsoftlimit; /* preferred file limit */
	vx_u32_t	dqb_curfiles;	/* current # allocated files */
	vx_u32_t	dqb_btimelimit; /* time limit for excessive disk use */
	vx_u32_t	dqb_ftimelimit; /* time limit for excessive files */
};

#define	vx_dqoff(UID)	((off_t)((UID) * sizeof (struct vx_dqblk)))

/*
 * Definitions for the 'quotactl' library function.
 */

#define	VX_QUOTAON	1	/* turn quotas on */
#define	VX_QUOTAOFF	2	/* turn quotas off */
#define	VX_SETQUOTA	3	/* set disk limits & usage */
#define	VX_GETQUOTA	4	/* get disk limits & usage */
#define	VX_SETQLIM	5	/* set disk limits only */
#define	VX_QSYNC	6	/* update disk copy of quota usages */
#define	VX_QSYNCALL	7	/* update disk copy of quota usages for all */
#define	VX_QSETFLAG	8	/* set quota flag on the fs to dirty */

/*
 * Don't want the quota file to exceed the 32-bit offset limit, so disallow
 * quotas for very large UIDs.
 */

#define VX_MAXDQID	67000000

#endif /* _FS_VXFS_VX_QUOTA_H */
