1 /* This just represents the non-kernel parts of <linux/quota.h>.
3 * here's the corresponding copyright:
4 * Copyright (c) 1982, 1986 Regents of the University of California.
7 * This code is derived from software contributed to Berkeley by
8 * Robert Elz at The University of Melbourne.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the University of
21 * California, Berkeley and its contributors.
22 * 4. Neither the name of the University nor the names of its contributors
23 * may be used to endorse or promote products derived from this software
24 * without specific prior written permission.
26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
42 #define _SYS_QUOTA_H 1
45 #include <sys/types.h>
48 * Convert diskblocks to blocks and the other way around.
49 * currently only to fool the BSD source. :-)
51 #define dbtob(num) ((num) << 10)
52 #define btodb(num) ((num) >> 10)
55 * Convert count of filesystem blocks to diskquota blocks, meant
56 * for filesystems where i_blksize != BLOCK_SIZE
58 #define fs_to_dq_blocks(num, blksize) (((num) * (blksize)) / BLOCK_SIZE)
61 * Definitions for disk quotas imposed on the average user
62 * (big brother finally hits Linux).
64 * The following constants define the amount of time given a user
65 * before the soft limits are treated as hard limits (usually resulting
66 * in an allocation failure). The timer is started when the user crosses
67 * their soft limit, it is reset when they go below their soft limit.
69 #define MAX_IQ_TIME 604800 /* (7*24*60*60) 1 week */
70 #define MAX_DQ_TIME 604800 /* (7*24*60*60) 1 week */
73 #define USRQUOTA 0 /* element used for user quotas */
74 #define GRPQUOTA 1 /* element used for group quotas */
77 * Definitions for the default names of the quotas files.
79 #define INITQFNAMES { \
80 "user", /* USRQUOTA */ \
81 "group", /* GRPQUOTA */ \
85 #define QUOTAFILENAME "quota"
86 #define QUOTAGROUP "staff"
88 #define NR_DQHASH 43 /* Just an arbitrary number any suggestions ? */
89 #define NR_DQUOTS 256 /* Number of quotas active at one time */
92 * Command definitions for the 'quotactl' system call.
93 * The commands are broken into a main command defined below
94 * and a subcommand that is used to convey the type of
95 * quota that is being manipulated (see above).
97 #define SUBCMDMASK 0x00ff
99 #define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
101 #define Q_QUOTAON 0x0100 /* enable quotas */
102 #define Q_QUOTAOFF 0x0200 /* disable quotas */
103 #define Q_GETQUOTA 0x0300 /* get limits and usage */
104 #define Q_SETQUOTA 0x0400 /* set limits and usage */
105 #define Q_SETUSE 0x0500 /* set usage */
106 #define Q_SYNC 0x0600 /* sync disk copy of a filesystems quotas */
107 #define Q_SETQLIM 0x0700 /* set limits */
108 #define Q_GETSTATS 0x0800 /* get collected stats */
111 * The following structure defines the format of the disk quota file
112 * (as it appears on disk) - the file is an array of these structures
113 * indexed by user or group number.
117 u_int32_t dqb_bhardlimit
; /* absolute limit on disk blks alloc */
118 u_int32_t dqb_bsoftlimit
; /* preferred limit on disk blks */
119 u_int32_t dqb_curblocks
; /* current block count */
120 u_int32_t dqb_ihardlimit
; /* maximum # allocated inodes */
121 u_int32_t dqb_isoftlimit
; /* preferred inode limit */
122 u_int32_t dqb_curinodes
; /* current # allocated inodes */
123 time_t dqb_btime
; /* time limit for excessive disk use */
124 time_t dqb_itime
; /* time limit for excessive files */
128 * Shorthand notation.
130 #define dq_bhardlimit dq_dqb.dqb_bhardlimit
131 #define dq_bsoftlimit dq_dqb.dqb_bsoftlimit
132 #define dq_curblocks dq_dqb.dqb_curblocks
133 #define dq_ihardlimit dq_dqb.dqb_ihardlimit
134 #define dq_isoftlimit dq_dqb.dqb_isoftlimit
135 #define dq_curinodes dq_dqb.dqb_curinodes
136 #define dq_btime dq_dqb.dqb_btime
137 #define dq_itime dq_dqb.dqb_itime
139 #define dqoff(UID) ((loff_t)((UID) * sizeof (struct dqblk)))
147 u_int32_t cache_hits
;
148 u_int32_t pages_allocated
;
149 u_int32_t allocated_dquots
;
150 u_int32_t free_dquots
;
156 extern int quotactl
__P ((int __cmd
, const char *__special
, int __id
,
161 #endif /* sys/quota.h */