ulfs_quota1.h revision 1.1 1 1.1 dholland /* $NetBSD: ulfs_quota1.h,v 1.1 2013/06/06 00:40:55 dholland Exp $ */
2 1.1 dholland /* from NetBSD: quota1.h,v 1.7 2012/08/26 02:32:14 dholland Exp */
3 1.1 dholland
4 1.1 dholland /*
5 1.1 dholland * Copyright (c) 1982, 1986, 1993
6 1.1 dholland * The Regents of the University of California. All rights reserved.
7 1.1 dholland *
8 1.1 dholland * This code is derived from software contributed to Berkeley by
9 1.1 dholland * Robert Elz at The University of Melbourne.
10 1.1 dholland *
11 1.1 dholland * Redistribution and use in source and binary forms, with or without
12 1.1 dholland * modification, are permitted provided that the following conditions
13 1.1 dholland * are met:
14 1.1 dholland * 1. Redistributions of source code must retain the above copyright
15 1.1 dholland * notice, this list of conditions and the following disclaimer.
16 1.1 dholland * 2. Redistributions in binary form must reproduce the above copyright
17 1.1 dholland * notice, this list of conditions and the following disclaimer in the
18 1.1 dholland * documentation and/or other materials provided with the distribution.
19 1.1 dholland * 3. Neither the name of the University nor the names of its contributors
20 1.1 dholland * may be used to endorse or promote products derived from this software
21 1.1 dholland * without specific prior written permission.
22 1.1 dholland *
23 1.1 dholland * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 1.1 dholland * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 1.1 dholland * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 1.1 dholland * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 1.1 dholland * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 1.1 dholland * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 1.1 dholland * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 1.1 dholland * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 1.1 dholland * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 1.1 dholland * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 1.1 dholland * SUCH DAMAGE.
34 1.1 dholland *
35 1.1 dholland * @(#)quota.h 8.3 (Berkeley) 8/19/94
36 1.1 dholland */
37 1.1 dholland
38 1.1 dholland #ifndef _UFS_UFS_QUOTA1_H_
39 1.1 dholland #define _UFS_UFS_QUOTA1_H_
40 1.1 dholland
41 1.1 dholland #include <sys/quota.h>
42 1.1 dholland #include <ufs/ufs/quota.h>
43 1.1 dholland
44 1.1 dholland /*
45 1.1 dholland * These definitions are for the original disk quota implementation, which
46 1.1 dholland * is deprecated. the newer implementation is defined in quota2.h
47 1.1 dholland * and friends
48 1.1 dholland */
49 1.1 dholland
50 1.1 dholland /*
51 1.1 dholland * Definitions for disk quotas imposed on the average user
52 1.1 dholland * (big brother finally hits UNIX).
53 1.1 dholland *
54 1.1 dholland * The following constants define the amount of time given a user before the
55 1.1 dholland * soft limits are treated as hard limits (usually resulting in an allocation
56 1.1 dholland * failure). The timer is started when the user crosses their soft limit, it
57 1.1 dholland * is reset when they go below their soft limit.
58 1.1 dholland */
59 1.1 dholland #define MAX_IQ_TIME (7*24*60*60) /* seconds in 1 week */
60 1.1 dholland #define MAX_DQ_TIME (7*24*60*60) /* seconds in 1 week */
61 1.1 dholland
62 1.1 dholland #define QUOTAFILENAME "quota"
63 1.1 dholland #define QUOTAGROUP "operator"
64 1.1 dholland
65 1.1 dholland /*
66 1.1 dholland * Command definitions for the 'compat_50_quotactl' system call. The commands
67 1.1 dholland * are broken into a main command defined below and a subcommand that is used
68 1.1 dholland * to convey the type of quota that is being manipulated (see above).
69 1.1 dholland */
70 1.1 dholland #define SUBCMDMASK 0x00ff
71 1.1 dholland #define SUBCMDSHIFT 8
72 1.1 dholland #define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
73 1.1 dholland
74 1.1 dholland #define Q_QUOTAON 0x0100 /* enable quotas */
75 1.1 dholland #define Q_QUOTAOFF 0x0200 /* disable quotas */
76 1.1 dholland #define Q_GETQUOTA 0x0300 /* get limits and usage */
77 1.1 dholland #define Q_SETQUOTA 0x0400 /* set limits and usage */
78 1.1 dholland #define Q_SETUSE 0x0500 /* set usage */
79 1.1 dholland #define Q_SYNC 0x0600 /* sync disk copy of a filesystems quotas */
80 1.1 dholland
81 1.1 dholland /*
82 1.1 dholland * The following structure defines the format of the disk quota file
83 1.1 dholland * (as it appears on disk) - the file is an array of these structures
84 1.1 dholland * indexed by user or group number. The setquota system call establishes
85 1.1 dholland * the vnode for each quota file (a pointer is retained in the ufsmount
86 1.1 dholland * structure).
87 1.1 dholland */
88 1.1 dholland struct dqblk {
89 1.1 dholland u_int32_t dqb_bhardlimit; /* absolute limit on disk blks alloc */
90 1.1 dholland u_int32_t dqb_bsoftlimit; /* preferred limit on disk blks */
91 1.1 dholland u_int32_t dqb_curblocks; /* current block count */
92 1.1 dholland u_int32_t dqb_ihardlimit; /* maximum # allocated inodes + 1 */
93 1.1 dholland u_int32_t dqb_isoftlimit; /* preferred inode limit */
94 1.1 dholland u_int32_t dqb_curinodes; /* current # allocated inodes */
95 1.1 dholland int32_t dqb_btime; /* time limit for excessive disk use */
96 1.1 dholland int32_t dqb_itime; /* time limit for excessive files */
97 1.1 dholland };
98 1.1 dholland
99 1.1 dholland /* quota1_subr.c */
100 1.1 dholland void dqblk_to_quotavals(const struct dqblk *,
101 1.1 dholland struct quotaval *, struct quotaval *);
102 1.1 dholland void quotavals_to_dqblk(const struct quotaval *, const struct quotaval *,
103 1.1 dholland struct dqblk *);
104 1.1 dholland
105 1.1 dholland #endif /* !_UFS_UFS_QUOTA1_H_ */
106