Remove building with NOCRYPTO option
[minix.git] / sys / ufs / lfs / ulfs_quota.h
blobe398af7abf2320abfd89f34078b97956379d58c5
1 /* $NetBSD: ulfs_quota.h,v 1.5 2014/06/28 22:27:51 dholland Exp $ */
2 /* from NetBSD: ufs_quota.h,v 1.21 2012/02/18 06:13:23 matt Exp */
4 /*
5 * Copyright (c) 1982, 1986, 1990, 1993, 1995
6 * The Regents of the University of California. All rights reserved.
8 * This code is derived from software contributed to Berkeley by
9 * Robert Elz at The University of Melbourne.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
35 * @(#)ufs_quota.c 8.5 (Berkeley) 5/20/95
37 #include <ufs/lfs/ulfs_quota1.h>
38 #include <ufs/lfs/ulfs_quota2.h>
40 struct quotakcursor; /* from <sys/quotactl.h> */
43 /* link to this quota in the quota inode (for QUOTA2) */
44 struct dq2_desc {
45 uint64_t dq2_lblkno; /* logical disk block holding this quota */
46 u_int dq2_blkoff; /* offset in disk block holding this quota */
50 * The following structure records disk usage for a user or group on a
51 * filesystem. There is one allocated for each quota that exists on any
52 * filesystem for the current user or group. A cache is kept of recently
53 * used entries.
54 * Field markings and the corresponding locks:
55 * h: dqlock
56 * d: dq_interlock
58 * Lock order is: dq_interlock -> dqlock
59 * dq_interlock -> dqvp
61 struct dquot {
62 LIST_ENTRY(dquot) dq_hash; /* h: hash list */
63 u_int16_t dq_flags; /* d: flags, see below */
64 u_int16_t dq_type; /* d: quota type of this dquot */
65 u_int32_t dq_cnt; /* h: count of active references */
66 u_int32_t dq_id; /* d: identifier this applies to */
67 struct ulfsmount *dq_ump; /* d: filesystem this is taken from */
68 kmutex_t dq_interlock; /* d: lock this dquot */
69 union {
70 struct dqblk dq1_dqb; /* d: actual usage & quotas */
71 struct dq2_desc dq2_desc; /* d: pointer to quota data */
72 } dq_un;
76 * Flag values.
78 #define DQ_MOD 0x04 /* this quota modified since read */
79 #define DQ_FAKE 0x08 /* no limits here, just usage */
80 #define DQ_WARN(ltype) (0x10 << ltype) /* has been warned about "type" limit */
82 * Shorthand notation.
84 #define dq_bhardlimit dq_un.dq1_dqb.dqb_bhardlimit
85 #define dq_bsoftlimit dq_un.dq1_dqb.dqb_bsoftlimit
86 #define dq_curblocks dq_un.dq1_dqb.dqb_curblocks
87 #define dq_ihardlimit dq_un.dq1_dqb.dqb_ihardlimit
88 #define dq_isoftlimit dq_un.dq1_dqb.dqb_isoftlimit
89 #define dq_curinodes dq_un.dq1_dqb.dqb_curinodes
90 #define dq_btime dq_un.dq1_dqb.dqb_btime
91 #define dq_itime dq_un.dq1_dqb.dqb_itime
93 #define dq2_lblkno dq_un.dq2_desc.dq2_lblkno
94 #define dq2_blkoff dq_un.dq2_desc.dq2_blkoff
96 * If the system has never checked for a quota for this file, then it is
97 * set to NODQUOT. Once a write attempt is made the inode pointer is set
98 * to reference a dquot structure.
100 #define NODQUOT NULL
102 extern kmutex_t lfs_dqlock;
103 extern kcondvar_t lfs_dqcv;
105 * Quota name to error message mapping.
107 extern const char *lfs_quotatypes[ULFS_MAXQUOTAS];
109 int lfs_getinoquota(struct inode *);
110 int lfs_dqget(struct vnode *, u_long, struct ulfsmount *, int, struct dquot **);
111 void lfs_dqref(struct dquot *);
112 void lfs_dqrele(struct vnode *, struct dquot *);
113 void lfs_dqflush(struct vnode *);
115 int lfs_chkdq1(struct inode *, int64_t, kauth_cred_t, int);
116 int lfs_chkiq1(struct inode *, int32_t, kauth_cred_t, int);
117 int lfs_q1sync(struct mount *);
118 int lfs_dq1get(struct vnode *, u_long, struct ulfsmount *, int, struct dquot *);
119 int lfs_dq1sync(struct vnode *, struct dquot *);
120 int lfsquota1_handle_cmd_get(struct ulfsmount *, const struct quotakey *,
121 struct quotaval *);
122 int lfsquota1_handle_cmd_put(struct ulfsmount *, const struct quotakey *,
123 const struct quotaval *);
124 int lfsquota1_handle_cmd_quotaon(struct lwp *, struct ulfsmount *, int,
125 const char *);
126 int lfsquota1_handle_cmd_quotaoff(struct lwp *, struct ulfsmount *, int);
128 int lfs_chkdq2(struct inode *, int64_t, kauth_cred_t, int);
129 int lfs_chkiq2(struct inode *, int32_t, kauth_cred_t, int);
130 int lfsquota2_handle_cmd_get(struct ulfsmount *, const struct quotakey *,
131 struct quotaval *);
132 int lfsquota2_handle_cmd_put(struct ulfsmount *, const struct quotakey *,
133 const struct quotaval *);
134 int lfsquota2_handle_cmd_del(struct ulfsmount *, const struct quotakey *);
135 int lfsquota2_handle_cmd_cursorget(struct ulfsmount *, struct quotakcursor *,
136 struct quotakey *, struct quotaval *, unsigned, unsigned *);
137 int lfsquota2_handle_cmd_cursoropen(struct ulfsmount *, struct quotakcursor *);
138 int lfsquota2_handle_cmd_cursorclose(struct ulfsmount *, struct quotakcursor *);
139 int lfsquota2_handle_cmd_cursorskipidtype(struct ulfsmount *, struct quotakcursor *,
140 int);
141 int lfsquota2_handle_cmd_cursoratend(struct ulfsmount *, struct quotakcursor *,
142 int *);
143 int lfsquota2_handle_cmd_cursorrewind(struct ulfsmount *, struct quotakcursor *);
144 int lfs_q2sync(struct mount *);
145 int lfs_dq2get(struct vnode *, u_long, struct ulfsmount *, int, struct dquot *);
146 int lfs_dq2sync(struct vnode *, struct dquot *);