1 | /* This just represents the non-kernel parts of <linux/quota.h>. |
2 | Copyright (C) 1998-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. |
4 | |
5 | The GNU C Library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either |
8 | version 2.1 of the License, or (at your option) any later version. |
9 | |
10 | The GNU C Library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Lesser General Public |
16 | License along with the GNU C Library; if not, see |
17 | <https://www.gnu.org/licenses/>. */ |
18 | |
19 | /* |
20 | * Copyright (c) 1982, 1986 Regents of the University of California. |
21 | * All rights reserved. |
22 | * |
23 | * This code is derived from software contributed to Berkeley by |
24 | * Robert Elz at The University of Melbourne. |
25 | * |
26 | * Redistribution and use in source and binary forms, with or without |
27 | * modification, are permitted provided that the following conditions |
28 | * are met: |
29 | * 1. Redistributions of source code must retain the above copyright |
30 | * notice, this list of conditions and the following disclaimer. |
31 | * 2. Redistributions in binary form must reproduce the above copyright |
32 | * notice, this list of conditions and the following disclaimer in the |
33 | * documentation and/or other materials provided with the distribution. |
34 | * 4. Neither the name of the University nor the names of its contributors |
35 | * may be used to endorse or promote products derived from this software |
36 | * without specific prior written permission. |
37 | * |
38 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
39 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
40 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
41 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
42 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
43 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
44 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
45 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
46 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
47 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
48 | * SUCH DAMAGE. |
49 | */ |
50 | |
51 | #ifndef _SYS_QUOTA_H |
52 | #define _SYS_QUOTA_H 1 |
53 | |
54 | #include <features.h> |
55 | #include <sys/types.h> |
56 | |
57 | #include <linux/quota.h> |
58 | |
59 | /* |
60 | * Convert diskblocks to blocks and the other way around. |
61 | * currently only to fool the BSD source. :-) |
62 | */ |
63 | #define dbtob(num) ((num) << 10) |
64 | #define btodb(num) ((num) >> 10) |
65 | |
66 | /* |
67 | * Convert count of filesystem blocks to diskquota blocks, meant for |
68 | * filesystems where i_blksize != 1024. |
69 | */ |
70 | #define fs_to_dq_blocks(num, blksize) (((num) * (blksize)) / 1024) |
71 | |
72 | /* |
73 | * Definitions for disk quotas imposed on the average user |
74 | * (big brother finally hits Linux). |
75 | * |
76 | * The following constants define the amount of time given a user |
77 | * before the soft limits are treated as hard limits (usually resulting |
78 | * in an allocation failure). The timer is started when the user crosses |
79 | * their soft limit, it is reset when they go below their soft limit. |
80 | */ |
81 | #define MAX_IQ_TIME 604800 /* (7*24*60*60) 1 week */ |
82 | #define MAX_DQ_TIME 604800 /* (7*24*60*60) 1 week */ |
83 | |
84 | #define QUOTAFILENAME "quota" |
85 | #define QUOTAGROUP "staff" |
86 | |
87 | #define NR_DQHASH 43 /* Just an arbitrary number any suggestions ? */ |
88 | #define NR_DQUOTS 256 /* Number of quotas active at one time */ |
89 | |
90 | /* Old name for struct if_dqblk. */ |
91 | struct dqblk |
92 | { |
93 | __uint64_t dqb_bhardlimit; /* absolute limit on disk quota blocks alloc */ |
94 | __uint64_t dqb_bsoftlimit; /* preferred limit on disk quota blocks */ |
95 | __uint64_t dqb_curspace; /* current quota block count */ |
96 | __uint64_t dqb_ihardlimit; /* maximum # allocated inodes */ |
97 | __uint64_t dqb_isoftlimit; /* preferred inode limit */ |
98 | __uint64_t dqb_curinodes; /* current # allocated inodes */ |
99 | __uint64_t dqb_btime; /* time limit for excessive disk use */ |
100 | __uint64_t dqb_itime; /* time limit for excessive files */ |
101 | __uint32_t dqb_valid; /* bitmask of QIF_* constants */ |
102 | }; |
103 | |
104 | /* |
105 | * Shorthand notation. |
106 | */ |
107 | #define dq_bhardlimit dq_dqb.dqb_bhardlimit |
108 | #define dq_bsoftlimit dq_dqb.dqb_bsoftlimit |
109 | #define dq_curspace dq_dqb.dqb_curspace |
110 | #define dq_valid dq_dqb.dqb_valid |
111 | #define dq_ihardlimit dq_dqb.dqb_ihardlimit |
112 | #define dq_isoftlimit dq_dqb.dqb_isoftlimit |
113 | #define dq_curinodes dq_dqb.dqb_curinodes |
114 | #define dq_btime dq_dqb.dqb_btime |
115 | #define dq_itime dq_dqb.dqb_itime |
116 | |
117 | #define dqoff(UID) ((__loff_t)((UID) * sizeof (struct dqblk))) |
118 | |
119 | /* Old name for struct if_dqinfo. */ |
120 | struct dqinfo |
121 | { |
122 | __uint64_t dqi_bgrace; |
123 | __uint64_t dqi_igrace; |
124 | __uint32_t dqi_flags; |
125 | __uint32_t dqi_valid; |
126 | }; |
127 | |
128 | __BEGIN_DECLS |
129 | |
130 | extern int quotactl (int __cmd, const char *__special, int __id, |
131 | __caddr_t __addr) __THROW; |
132 | |
133 | __END_DECLS |
134 | |
135 | #endif /* sys/quota.h */ |
136 | |