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