]>
Commit | Line | Data |
---|---|---|
1eeddf25 JK |
1 | .\" Copyright (c) 2010, Jan Kara |
2 | .\" A few pieces copyright (c) 1996 Andries Brouwer (aeb@cwi.nl) | |
3 | .\" and copyright 2010 (c) Michael Kerrisk <mtk.manpages@gmail.com> | |
fea681da | 4 | .\" |
93015253 | 5 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
6 | .\" Permission is granted to make and distribute verbatim copies of this |
7 | .\" manual provided the copyright notice and this permission notice are | |
8 | .\" preserved on all copies. | |
9 | .\" | |
1eeddf25 JK |
10 | .\" Permission is granted to copy and distribute modified versions of |
11 | .\" this manual under the conditions for verbatim copying, provided that | |
12 | .\" the entire resulting derived work is distributed under the terms of | |
13 | .\" a permission notice identical to this one. | |
c13182ef | 14 | .\" |
fea681da | 15 | .\" Since the Linux kernel and libraries are constantly changing, this |
62290181 SP |
16 | .\" manual page may be incorrect or out-of-date. The author(s) assume |
17 | .\" no responsibility for errors or omissions, or for damages resulting | |
18 | .\" from the use of the information contained herein. The author(s) may | |
19 | .\" not have taken the same level of care in the production of this | |
20 | .\" manual, which is licensed free of charge, as they might when working | |
fea681da | 21 | .\" professionally. |
c13182ef | 22 | .\" |
fea681da MK |
23 | .\" Formatted or processed versions of this manual, if unaccompanied by |
24 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 25 | .\" %%%LICENSE_END |
fea681da | 26 | .\" |
e8426ca2 | 27 | .TH QUOTACTL 2 2020-04-11 "Linux" "Linux Programmer's Manual" |
fea681da | 28 | .SH NAME |
1eeddf25 | 29 | quotactl \- manipulate disk quotas |
fea681da | 30 | .SH SYNOPSIS |
cb2431bf | 31 | .nf |
fea681da | 32 | .B #include <sys/quota.h> |
90d79b64 | 33 | .B #include <xfs/xqm.h> /* for XFS quotas */ |
dd3568a1 | 34 | .PP |
cb2431bf MK |
35 | .BI "int quotactl(int " cmd ", const char *" special ", int " id \ |
36 | ", caddr_t " addr ); | |
cb2431bf | 37 | .fi |
fea681da | 38 | .SH DESCRIPTION |
dd3568a1 | 39 | .PP |
093b6f20 | 40 | The quota system can be used to set per-user, per-group, and per-project limits |
b5b42cc5 | 41 | on the amount of disk space used on a filesystem. |
1eeddf25 | 42 | For each user and/or group, |
9ee4a2b6 | 43 | a soft limit and a hard limit can be set for each filesystem. |
1eeddf25 JK |
44 | The hard limit can't be exceeded. |
45 | The soft limit can be exceeded, but warnings will ensue. | |
955ea4e7 ES |
46 | Moreover, the user can't exceed the soft limit for more than grace period |
47 | duration (one week by default) at a time; | |
48 | after this, the soft limit counts as a hard limit. | |
efeece04 | 49 | .PP |
fea681da | 50 | The |
e511ffb6 | 51 | .BR quotactl () |
1eeddf25 JK |
52 | call manipulates disk quotas. |
53 | The | |
54 | .I cmd | |
55 | argument indicates a command to be applied to the user or | |
56 | group ID specified in | |
57 | .IR id . | |
58 | To initialize the | |
59 | .IR cmd | |
60 | argument, use the | |
61 | .IR "QCMD(subcmd, type)" | |
62 | macro. | |
63 | The | |
fea681da | 64 | .I type |
1eeddf25 JK |
65 | value is either |
66 | .BR USRQUOTA , | |
67 | for user quotas, | |
1eeddf25 | 68 | .BR GRPQUOTA , |
b5b42cc5 ES |
69 | for group quotas, or (since Linux 4.1) |
70 | .\" 847aac644e92e5624f2c153bab409bf713d5ff9a | |
71 | .BR PRJQUOTA , | |
72 | for project quotas. | |
1eeddf25 | 73 | The |
fea681da | 74 | .I subcmd |
1eeddf25 | 75 | value is described below. |
efeece04 | 76 | .PP |
1eeddf25 | 77 | The |
fea681da | 78 | .I special |
1eeddf25 | 79 | argument is a pointer to a null-terminated string containing the pathname |
9ee4a2b6 | 80 | of the (mounted) block special device for the filesystem being manipulated. |
efeece04 | 81 | .PP |
1eeddf25 | 82 | The |
fea681da | 83 | .I addr |
1eeddf25 JK |
84 | argument is the address of an optional, command-specific, data structure |
85 | that is copied in or out of the system. | |
86 | The interpretation of | |
87 | .I addr | |
96e60ae5 | 88 | is given with each operation below. |
efeece04 | 89 | .PP |
fea681da MK |
90 | The |
91 | .I subcmd | |
96e60ae5 | 92 | value is one of the following operations: |
0019177e | 93 | .TP |
5a11d358 | 94 | .B Q_QUOTAON |
9ee4a2b6 | 95 | Turn on quotas for a filesystem. |
c13182ef | 96 | The |
1eeddf25 JK |
97 | .I id |
98 | argument is the identification number of the quota format to be used. | |
99 | Currently, there are three supported quota formats: | |
100 | .RS | |
101 | .TP 13 | |
102 | .BR QFMT_VFS_OLD | |
103 | The original quota format. | |
fea681da | 104 | .TP |
1eeddf25 JK |
105 | .BR QFMT_VFS_V0 |
106 | The standard VFS v0 quota format, which can handle 32-bit UIDs and GIDs | |
107 | and quota limits up to 2^42 bytes and 2^32 inodes. | |
108 | .TP | |
109 | .BR QFMT_VFS_V1 | |
110 | A quota format that can handle 32-bit UIDs and GIDs | |
111 | and quota limits of 2^64 bytes and 2^64 inodes. | |
112 | .RE | |
113 | .IP | |
114 | The | |
115 | .IR addr | |
116 | argument points to the pathname of a file containing the quotas for | |
9ee4a2b6 | 117 | the filesystem. |
1eeddf25 JK |
118 | The quota file must exist; it is normally created with the |
119 | .BR quotacheck (8) | |
f5fd82cc MK |
120 | program |
121 | .IP | |
122 | Quota information can be also stored in hidden system inodes | |
123 | for ext4, XFS, and other filesystems if the filesystem is configured so. | |
ae848b1d YX |
124 | In this case, there are no visible quota files and there is no need to |
125 | use | |
126 | .BR quotacheck (8). | |
f5fd82cc MK |
127 | Quota information is always kept consistent by the filesystem and the |
128 | .B Q_QUOTAON | |
129 | operation serves only to enable enforcement of quota limits. | |
130 | The presence of hidden | |
131 | system inodes with quota information is indicated by the | |
132 | .B DQF_SYS_FILE | |
133 | flag in the | |
134 | .I dqi_flags | |
135 | field returned by the | |
136 | .B Q_GETINFO | |
137 | operation. | |
138 | .IP | |
1eeddf25 JK |
139 | This operation requires privilege |
140 | .RB ( CAP_SYS_ADMIN ). | |
0019177e | 141 | .TP |
fea681da | 142 | .B Q_QUOTAOFF |
9ee4a2b6 | 143 | Turn off quotas for a filesystem. |
1eeddf25 JK |
144 | The |
145 | .I addr | |
146 | and | |
147 | .I id | |
148 | arguments are ignored. | |
149 | This operation requires privilege | |
150 | .RB ( CAP_SYS_ADMIN ). | |
fea681da MK |
151 | .TP |
152 | .B Q_GETQUOTA | |
1eeddf25 JK |
153 | Get disk quota limits and current usage for user or group |
154 | .IR id . | |
c13182ef | 155 | The |
fea681da | 156 | .I addr |
1eeddf25 JK |
157 | argument is a pointer to a |
158 | .I dqblk | |
159 | structure defined in | |
160 | .IR <sys/quota.h> | |
161 | as follows: | |
e646a1ba | 162 | .IP |
1eeddf25 | 163 | .in +4n |
e646a1ba | 164 | .EX |
72da9ef1 | 165 | /* uint64_t is an unsigned 64\-bit integer; |
8f172c56 | 166 | uint32_t is an unsigned 32\-bit integer */ |
1eeddf25 | 167 | |
d38f98b6 MK |
168 | struct dqblk { /* Definition since Linux 2.4.22 */ |
169 | uint64_t dqb_bhardlimit; /* Absolute limit on disk | |
170 | quota blocks alloc */ | |
171 | uint64_t dqb_bsoftlimit; /* Preferred limit on | |
172 | disk quota blocks */ | |
173 | uint64_t dqb_curspace; /* Current occupied space | |
174 | (in bytes) */ | |
175 | uint64_t dqb_ihardlimit; /* Maximum number of | |
176 | allocated inodes */ | |
177 | uint64_t dqb_isoftlimit; /* Preferred inode limit */ | |
178 | uint64_t dqb_curinodes; /* Current number of | |
179 | allocated inodes */ | |
180 | uint64_t dqb_btime; /* Time limit for excessive | |
181 | disk use */ | |
182 | uint64_t dqb_itime; /* Time limit for excessive | |
183 | files */ | |
184 | uint32_t dqb_valid; /* Bit mask of QIF_* | |
185 | constants */ | |
1eeddf25 JK |
186 | }; |
187 | ||
188 | /* Flags in dqb_valid that indicate which fields in | |
189 | dqblk structure are valid. */ | |
190 | ||
191 | #define QIF_BLIMITS 1 | |
192 | #define QIF_SPACE 2 | |
193 | #define QIF_ILIMITS 4 | |
194 | #define QIF_INODES 8 | |
195 | #define QIF_BTIME 16 | |
196 | #define QIF_ITIME 32 | |
197 | #define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS) | |
198 | #define QIF_USAGE (QIF_SPACE | QIF_INODES) | |
199 | #define QIF_TIMES (QIF_BTIME | QIF_ITIME) | |
200 | #define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES) | |
e646a1ba | 201 | .EE |
1eeddf25 | 202 | .in |
e646a1ba | 203 | .IP |
1eeddf25 JK |
204 | The |
205 | .I dqb_valid | |
206 | field is a bit mask that is set to indicate the entries in the | |
207 | .I dqblk | |
208 | structure that are valid. | |
209 | Currently, the kernel fills in all entries of the | |
210 | .I dqblk | |
211 | structure and marks them as valid in the | |
212 | .I dqb_valid | |
213 | field. | |
214 | Unprivileged users may retrieve only their own quotas; | |
215 | a privileged user | |
216 | .RB ( CAP_SYS_ADMIN ) | |
217 | can retrieve the quotas of any user. | |
fea681da | 218 | .TP |
8d03f12c MK |
219 | .BR Q_GETNEXTQUOTA " (since Linux 4.6)" |
220 | .\" commit 926132c0257a5a8d149a6a395cc3405e55420566 | |
221 | This operation is the same as | |
222 | .BR Q_GETQUOTA , | |
223 | but it returns quota information for the next ID greater than or equal to | |
224 | .IR id | |
225 | that has a quota set. | |
efeece04 | 226 | .IP |
8d03f12c MK |
227 | The |
228 | .I addr | |
229 | argument is a pointer to a | |
230 | .I nextdqblk | |
231 | structure whose fields are as for the | |
232 | .IR dqblk , | |
233 | except for the addition of a | |
234 | .I dqb_id | |
235 | field that is used to return the ID for which | |
236 | quota information is being returned: | |
efeece04 | 237 | .IP |
8d03f12c | 238 | .in +4n |
b8302363 | 239 | .EX |
8d03f12c MK |
240 | struct nextdqblk { |
241 | uint64_t dqb_bhardlimit; | |
242 | uint64_t dqb_bsoftlimit; | |
243 | uint64_t dqb_curspace; | |
244 | uint64_t dqb_ihardlimit; | |
245 | uint64_t dqb_isoftlimit; | |
246 | uint64_t dqb_curinodes; | |
247 | uint64_t dqb_btime; | |
248 | uint64_t dqb_itime; | |
249 | uint32_t dqb_valid; | |
250 | uint32_t dqb_id; | |
251 | }; | |
b8302363 | 252 | .EE |
e646a1ba | 253 | .in |
8d03f12c | 254 | .TP |
fea681da | 255 | .B Q_SETQUOTA |
1eeddf25 JK |
256 | Set quota information for user or group |
257 | .IR id , | |
258 | using the information supplied in the | |
259 | .I dqblk | |
260 | structure pointed to by | |
261 | .IR addr . | |
262 | The | |
263 | .I dqb_valid | |
264 | field of the | |
265 | .I dqblk | |
266 | structure indicates which entries in the structure have been set by the caller. | |
267 | This operation supersedes the | |
268 | .B Q_SETQLIM | |
269 | and | |
270 | .B Q_SETUSE | |
271 | operations in the previous quota interfaces. | |
272 | This operation requires privilege | |
273 | .RB ( CAP_SYS_ADMIN ). | |
274 | .TP | |
4c8a2e1d | 275 | .BR Q_GETINFO " (since Linux 2.4.22)" |
1eeddf25 JK |
276 | Get information (like grace times) about quotafile. |
277 | The | |
fea681da | 278 | .I addr |
1eeddf25 JK |
279 | argument should be a pointer to a |
280 | .I dqinfo | |
281 | structure. | |
282 | This structure is defined in | |
283 | .IR <sys/quota.h> | |
284 | as follows: | |
e646a1ba | 285 | .IP |
1eeddf25 | 286 | .in +4n |
e646a1ba | 287 | .EX |
72da9ef1 MK |
288 | /* uint64_t is an unsigned 64\-bit integer; |
289 | uint32_t is an unsigned 32\-bit integer */ | |
1eeddf25 JK |
290 | |
291 | struct dqinfo { /* Defined since kernel 2.4.22 */ | |
d38f98b6 MK |
292 | uint64_t dqi_bgrace; /* Time before block soft limit |
293 | becomes hard limit */ | |
294 | uint64_t dqi_igrace; /* Time before inode soft limit | |
295 | becomes hard limit */ | |
296 | uint32_t dqi_flags; /* Flags for quotafile | |
297 | (DQF_*) */ | |
1eeddf25 JK |
298 | uint32_t dqi_valid; |
299 | }; | |
300 | ||
301 | /* Bits for dqi_flags */ | |
302 | ||
b09639d9 MK |
303 | /* Quota format QFMT_VFS_OLD */ |
304 | ||
d38f98b6 MK |
305 | #define DQF_ROOT_SQUASH (1 << 0) /* Root squash enabled */ |
306 | /* Before Linux v4.0, this had been defined | |
307 | privately as V1_DQF_RSQUASH */ | |
b09639d9 | 308 | |
2219bd3f ES |
309 | /* Quota format QFMT_VFS_V0 / QFMT_VFS_V1 */ |
310 | ||
093b6f20 MK |
311 | #define DQF_SYS_FILE (1 << 16) /* Quota stored in |
312 | a system file */ | |
1eeddf25 JK |
313 | |
314 | /* Flags in dqi_valid that indicate which fields in | |
315 | dqinfo structure are valid. */ | |
316 | ||
d38f98b6 MK |
317 | #define IIF_BGRACE 1 |
318 | #define IIF_IGRACE 2 | |
319 | #define IIF_FLAGS 4 | |
320 | #define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS) | |
e646a1ba | 321 | .EE |
1eeddf25 | 322 | .in |
e646a1ba | 323 | .IP |
1eeddf25 JK |
324 | The |
325 | .I dqi_valid | |
326 | field in the | |
327 | .I dqinfo | |
328 | structure indicates the entries in the structure that are valid. | |
329 | Currently, the kernel fills in all entries of the | |
330 | .I dqinfo | |
331 | structure and marks them all as valid in the | |
332 | .I dqi_valid | |
333 | field. | |
334 | The | |
335 | .I id | |
336 | argument is ignored. | |
fea681da | 337 | .TP |
4c8a2e1d | 338 | .BR Q_SETINFO " (since Linux 2.4.22)" |
1eeddf25 JK |
339 | Set information about quotafile. |
340 | The | |
fea681da | 341 | .I addr |
1eeddf25 JK |
342 | argument should be a pointer to a |
343 | .I dqinfo | |
344 | structure. | |
345 | The | |
346 | .I dqi_valid | |
347 | field of the | |
348 | .I dqinfo | |
349 | structure indicates the entries in the structure | |
350 | that have been set by the caller. | |
351 | This operation supersedes the | |
352 | .B Q_SETGRACE | |
353 | and | |
354 | .B Q_SETFLAGS | |
355 | operations in the previous quota interfaces. | |
356 | The | |
357 | .I id | |
358 | argument is ignored. | |
359 | This operation requires privilege | |
360 | .RB ( CAP_SYS_ADMIN ). | |
fea681da | 361 | .TP |
4c8a2e1d | 362 | .BR Q_GETFMT " (since Linux 2.4.22)" |
9ee4a2b6 | 363 | Get quota format used on the specified filesystem. |
1eeddf25 JK |
364 | The |
365 | .I addr | |
366 | argument should be a pointer to a 4-byte buffer | |
367 | where the format number will be stored. | |
fea681da MK |
368 | .TP |
369 | .B Q_SYNC | |
9ee4a2b6 | 370 | Update the on-disk copy of quota usages for a filesystem. |
1eeddf25 JK |
371 | If |
372 | .I special | |
9ee4a2b6 | 373 | is NULL, then all filesystems with active quotas are sync'ed. |
1eeddf25 JK |
374 | The |
375 | .I addr | |
376 | and | |
377 | .I id | |
378 | arguments are ignored. | |
fea681da | 379 | .TP |
3cf5ae17 | 380 | .BR Q_GETSTATS " (supported up to Linux 2.4.21)" |
1eeddf25 JK |
381 | Get statistics and other generic information about the quota subsystem. |
382 | The | |
383 | .I addr | |
384 | argument should be a pointer to a | |
385 | .I dqstats | |
386 | structure in which data should be stored. | |
387 | This structure is defined in | |
c367cd59 | 388 | .IR <sys/quota.h> . |
1eeddf25 JK |
389 | The |
390 | .I special | |
391 | and | |
392 | .I id | |
393 | arguments are ignored. | |
efeece04 | 394 | .IP |
3cf5ae17 | 395 | This operation is obsolete and was removed in Linux 2.4.22. |
1eeddf25 JK |
396 | Files in |
397 | .I /proc/sys/fs/quota/ | |
398 | carry the information instead. | |
399 | .PP | |
9ee4a2b6 | 400 | For XFS filesystems making use of the XFS Quota Manager (XQM), |
96e60ae5 | 401 | the above operations are bypassed and the following operations are used: |
0019177e | 402 | .TP |
1eeddf25 | 403 | .B Q_XQUOTAON |
9ee4a2b6 | 404 | Turn on quotas for an XFS filesystem. |
1eeddf25 JK |
405 | XFS provides the ability to turn on/off quota limit enforcement |
406 | with quota accounting. | |
407 | Therefore, XFS expects | |
408 | .I addr | |
409 | to be a pointer to an | |
410 | .I "unsigned int" | |
36a35d67 | 411 | that contains a bit-wise combination of the following flags (defined in |
90d79b64 | 412 | .IR <xfs/xqm.h> ): |
efeece04 | 413 | .IP |
90d79b64 | 414 | .in +4n |
b8302363 | 415 | .EX |
36a35d67 MK |
416 | XFS_QUOTA_UDQ_ACCT /* User quota accounting */ |
417 | XFS_QUOTA_UDQ_ENFD /* User quota limits enforcement */ | |
418 | XFS_QUOTA_GDQ_ACCT /* Group quota accounting */ | |
419 | XFS_QUOTA_GDQ_ENFD /* Group quota limits enforcement */ | |
420 | XFS_QUOTA_PDQ_ACCT /* Project quota accounting */ | |
421 | XFS_QUOTA_PDQ_ENFD /* Project quota limits enforcement */ | |
b8302363 | 422 | .EE |
e646a1ba | 423 | .in |
efeece04 | 424 | .IP |
1eeddf25 JK |
425 | This operation requires privilege |
426 | .RB ( CAP_SYS_ADMIN ). | |
90d79b64 ES |
427 | The |
428 | .I id | |
429 | argument is ignored. | |
1eeddf25 JK |
430 | .TP |
431 | .B Q_XQUOTAOFF | |
9ee4a2b6 | 432 | Turn off quotas for an XFS filesystem. |
1eeddf25 JK |
433 | As with |
434 | .BR Q_QUOTAON , | |
9ee4a2b6 | 435 | XFS filesystems expect a pointer to an |
1eeddf25 JK |
436 | .I "unsigned int" |
437 | that specifies whether quota accounting and/or limit enforcement need | |
90d79b64 | 438 | to be turned off (using the same flags as for |
093b6f20 | 439 | .B Q_XQUOTAON |
96e60ae5 | 440 | operation). |
1eeddf25 JK |
441 | This operation requires privilege |
442 | .RB ( CAP_SYS_ADMIN ). | |
90d79b64 ES |
443 | The |
444 | .I id | |
445 | argument is ignored. | |
1eeddf25 JK |
446 | .TP |
447 | .B Q_XGETQUOTA | |
448 | Get disk quota limits and current usage for user | |
449 | .IR id . | |
450 | The | |
451 | .I addr | |
452 | argument is a pointer to an | |
453 | .I fs_disk_quota | |
093b6f20 | 454 | structure, which is defined in |
90d79b64 ES |
455 | .I <xfs/xqm.h> |
456 | as follows: | |
efeece04 | 457 | .IP |
90d79b64 | 458 | .in +4n |
b8302363 | 459 | .EX |
093b6f20 MK |
460 | /* All the blk units are in BBs (Basic Blocks) of |
461 | 512 bytes. */ | |
90d79b64 | 462 | |
d38f98b6 | 463 | #define FS_DQUOT_VERSION 1 /* fs_disk_quota.d_version */ |
90d79b64 | 464 | |
d38f98b6 MK |
465 | #define XFS_USER_QUOTA (1<<0) /* User quota type */ |
466 | #define XFS_PROJ_QUOTA (1<<1) /* Project quota type */ | |
467 | #define XFS_GROUP_QUOTA (1<<2) /* Group quota type */ | |
90d79b64 ES |
468 | |
469 | struct fs_disk_quota { | |
d38f98b6 MK |
470 | int8_t d_version; /* Version of this structure */ |
471 | int8_t d_flags; /* XFS_{USER,PROJ,GROUP}_QUOTA */ | |
472 | uint16_t d_fieldmask; /* Field specifier */ | |
473 | uint32_t d_id; /* User, project, or group ID */ | |
093b6f20 MK |
474 | uint64_t d_blk_hardlimit; /* Absolute limit on |
475 | disk blocks */ | |
476 | uint64_t d_blk_softlimit; /* Preferred limit on | |
477 | disk blocks */ | |
478 | uint64_t d_ino_hardlimit; /* Maximum # allocated | |
479 | inodes */ | |
480 | uint64_t d_ino_softlimit; /* Preferred inode limit */ | |
d38f98b6 MK |
481 | uint64_t d_bcount; /* # disk blocks owned by |
482 | the user */ | |
483 | uint64_t d_icount; /* # inodes owned by the user */ | |
484 | int32_t d_itimer; /* Zero if within inode limits */ | |
485 | /* If not, we refuse service */ | |
486 | int32_t d_btimer; /* Similar to above; for | |
487 | disk blocks */ | |
488 | uint16_t d_iwarns; /* # warnings issued with | |
489 | respect to # of inodes */ | |
490 | uint16_t d_bwarns; /* # warnings issued with | |
491 | respect to disk blocks */ | |
492 | int32_t d_padding2; /* Padding - for future use */ | |
093b6f20 MK |
493 | uint64_t d_rtb_hardlimit; /* Absolute limit on realtime |
494 | (RT) disk blocks */ | |
495 | uint64_t d_rtb_softlimit; /* Preferred limit on RT | |
496 | disk blocks */ | |
d38f98b6 MK |
497 | uint64_t d_rtbcount; /* # realtime blocks owned */ |
498 | int32_t d_rtbtimer; /* Similar to above; for RT | |
499 | disk blocks */ | |
500 | uint16_t d_rtbwarns; /* # warnings issued with | |
501 | respect to RT disk blocks */ | |
502 | int16_t d_padding3; /* Padding - for future use */ | |
503 | char d_padding4[8]; /* Yet more padding */ | |
90d79b64 | 504 | }; |
b8302363 | 505 | .EE |
e646a1ba | 506 | .in |
efeece04 | 507 | .IP |
1eeddf25 JK |
508 | Unprivileged users may retrieve only their own quotas; |
509 | a privileged user | |
510 | .RB ( CAP_SYS_ADMIN ) | |
511 | may retrieve the quotas of any user. | |
3b177104 MK |
512 | .TP |
513 | .BR Q_XGETNEXTQUOTA " (since Linux 4.6)" | |
8d03f12c MK |
514 | .\" commit 8b37524962b9c54423374717786198f5c0820a28 |
515 | This operation is the same as | |
516 | .BR Q_XGETQUOTA , | |
90d79b64 ES |
517 | but it returns (in the |
518 | .I fs_disk_quota | |
519 | structure pointed by | |
520 | .IR addr ) | |
521 | quota information for the next ID greater than or equal to | |
8d03f12c | 522 | .IR id |
093b6f20 MK |
523 | that has a quota set. |
524 | Note that since | |
90d79b64 ES |
525 | .I fs_disk_quota |
526 | already has | |
527 | .I q_id | |
528 | field, no separate structure type is needed (in contrast with | |
529 | .B Q_GETQUOTA | |
530 | and | |
531 | .B Q_GETNEXTQUOTA | |
96e60ae5 | 532 | operations) |
1eeddf25 JK |
533 | .TP |
534 | .B Q_XSETQLIM | |
535 | Set disk quota limits for user | |
536 | .IR id . | |
537 | The | |
538 | .I addr | |
539 | argument is a pointer to an | |
540 | .I fs_disk_quota | |
90d79b64 | 541 | structure. |
1eeddf25 JK |
542 | This operation requires privilege |
543 | .RB ( CAP_SYS_ADMIN ). | |
544 | .TP | |
545 | .B Q_XGETQSTAT | |
869c706f | 546 | Returns XFS filesystem-specific quota information in the |
1eeddf25 | 547 | .I fs_quota_stat |
869c706f MK |
548 | structure pointed by |
549 | .IR addr . | |
1eeddf25 | 550 | This is useful for finding out how much space is used to store quota |
093b6f20 MK |
551 | information, and also to get the quota on/off status of a given local XFS |
552 | filesystem. | |
553 | The | |
90d79b64 ES |
554 | .I fs_quota_stat |
555 | structure itself is defined as follows: | |
efeece04 | 556 | .IP |
90d79b64 | 557 | .in +4n |
b8302363 | 558 | .EX |
90d79b64 ES |
559 | #define FS_QSTAT_VERSION 1 /* fs_quota_stat.qs_version */ |
560 | ||
561 | struct fs_qfilestat { | |
093b6f20 MK |
562 | uint64_t qfs_ino; /* Inode number */ |
563 | uint64_t qfs_nblks; /* Number of BBs | |
564 | 512-byte-blocks */ | |
565 | uint32_t qfs_nextents; /* Number of extents */ | |
90d79b64 ES |
566 | }; |
567 | ||
568 | struct fs_quota_stat { | |
d38f98b6 MK |
569 | int8_t qs_version; /* Version number for |
570 | future changes */ | |
571 | uint16_t qs_flags; /* XFS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */ | |
572 | int8_t qs_pad; /* Unused */ | |
573 | struct fs_qfilestat qs_uquota; /* User quota storage | |
574 | information */ | |
575 | struct fs_qfilestat qs_gquota; /* Group quota storage | |
576 | information */ | |
577 | uint32_t qs_incoredqs; /* Number of dquots in core */ | |
578 | int32_t qs_btimelimit; /* Limit for blocks timer */ | |
579 | int32_t qs_itimelimit; /* Limit for inodes timer */ | |
580 | int32_t qs_rtbtimelimit;/* Limit for RT | |
581 | blocks timer */ | |
582 | uint16_t qs_bwarnlimit; /* Limit for # of warnings */ | |
583 | uint16_t qs_iwarnlimit; /* Limit for # of warnings */ | |
90d79b64 | 584 | }; |
b8302363 | 585 | .EE |
e646a1ba | 586 | .in |
efeece04 | 587 | .IP |
90d79b64 ES |
588 | The |
589 | .I id | |
590 | argument is ignored. | |
591 | .TP | |
592 | .B Q_XGETQSTATV | |
869c706f | 593 | Returns XFS filesystem-specific quota information in the |
90d79b64 | 594 | .I fs_quota_statv |
869c706f MK |
595 | pointed to by |
596 | .IR addr . | |
96e60ae5 | 597 | This version of the operation uses a structure with proper versioning support, |
093b6f20 MK |
598 | along with appropriate layout (all fields are naturally aligned) and |
599 | padding to avoiding special compat handling; | |
600 | it also provides the ability to get statistics regarding | |
601 | the project quota file. | |
602 | The | |
90d79b64 ES |
603 | .I fs_quota_statv |
604 | structure itself is defined as follows: | |
efeece04 | 605 | .IP |
90d79b64 | 606 | .in +4n |
b8302363 | 607 | .EX |
90d79b64 ES |
608 | #define FS_QSTATV_VERSION1 1 /* fs_quota_statv.qs_version */ |
609 | ||
610 | struct fs_qfilestatv { | |
d38f98b6 MK |
611 | uint64_t qfs_ino; /* Inode number */ |
612 | uint64_t qfs_nblks; /* Number of BBs | |
613 | 512-byte-blocks */ | |
614 | uint32_t qfs_nextents; /* Number of extents */ | |
615 | uint32_t qfs_pad; /* Pad for 8-byte alignment */ | |
90d79b64 ES |
616 | }; |
617 | ||
618 | struct fs_quota_statv { | |
d38f98b6 MK |
619 | int8_t qs_version; /* Version for future |
620 | changes */ | |
621 | uint8_t qs_pad1; /* Pad for 16-bit alignment */ | |
622 | uint16_t qs_flags; /* XFS_QUOTA_.* flags */ | |
623 | uint32_t qs_incoredqs; /* Number of dquots incore */ | |
624 | struct fs_qfilestatv qs_uquota; /* User quota | |
625 | information */ | |
626 | struct fs_qfilestatv qs_gquota; /* Group quota | |
627 | information */ | |
628 | struct fs_qfilestatv qs_pquota; /* Project quota | |
629 | information */ | |
093b6f20 MK |
630 | int32_t qs_btimelimit; /* Limit for blocks timer */ |
631 | int32_t qs_itimelimit; /* Limit for inodes timer */ | |
d38f98b6 MK |
632 | int32_t qs_rtbtimelimit; /* Limit for RT blocks |
633 | timer */ | |
093b6f20 MK |
634 | uint16_t qs_bwarnlimit; /* Limit for # of warnings */ |
635 | uint16_t qs_iwarnlimit; /* Limit for # of warnings */ | |
636 | uint64_t qs_pad2[8]; /* For future proofing */ | |
90d79b64 | 637 | }; |
b8302363 | 638 | .EE |
e646a1ba | 639 | .in |
efeece04 | 640 | .IP |
90d79b64 ES |
641 | The |
642 | .I qs_version | |
643 | field of the structure should be filled with the version of the structure | |
644 | supported by the callee (for now, only | |
645 | .I FS_QSTAT_VERSION1 | |
093b6f20 MK |
646 | is supported). |
647 | The kernel will fill the structure in accordance with | |
90d79b64 ES |
648 | version provided. |
649 | The | |
650 | .I id | |
651 | argument is ignored. | |
1eeddf25 | 652 | .TP |
06744370 | 653 | .B Q_XQUOTARM " (since Linux 3.16)" |
ae848b1d | 654 | .\" 9da93f9b7cdf8ab28da6b364cdc1fafc8670b4dc |
fcd4007b MK |
655 | Free the disk space taken by disk quotas. |
656 | The | |
90d79b64 ES |
657 | .I addr |
658 | argument should be a pointer to an | |
659 | .I "unsigned int" | |
660 | value containing flags (the same as in | |
661 | .I d_flags | |
662 | field of | |
663 | .I fs_disk_quota | |
64e4eac9 | 664 | structure) |
ef9e5be0 | 665 | which identify what types of quota |
64e4eac9 MK |
666 | should be removed. |
667 | (Note that the quota type passed in the | |
90d79b64 ES |
668 | .I cmd |
669 | argument is ignored, but should remain valid in order to pass preliminary | |
64e4eac9 | 670 | quotactl syscall handler checks.) |
efeece04 | 671 | .IP |
093b6f20 MK |
672 | Quotas must have already been turned off. |
673 | The | |
90d79b64 ES |
674 | .I id |
675 | argument is ignored. | |
942627c9 | 676 | .TP |
721381be | 677 | .BR Q_XQUOTASYNC " (since Linux 2.6.15; no-op since Linux 3.4)" |
d38be90d | 678 | .\" Added in commit ee34807a65aa0c5911dc27682863afca780a003e |
96e60ae5 | 679 | This operation was an XFS quota equivalent to |
a5394cba | 680 | .BR Q_SYNC , |
d38be90d | 681 | but it is no-op since Linux 3.4, |
942627c9 | 682 | .\" 4b217ed9e30f94b6e8e5e262020ef0ceab6113af |
d38be90d | 683 | as |
1eeddf25 | 684 | .BR sync (1) |
d38be90d MK |
685 | writes quota information to disk now |
686 | (in addition to the other filesystem metadata that it writes out). | |
687 | The | |
942627c9 ES |
688 | .IR special ", " id " and " addr |
689 | arguments are ignored. | |
6acbcbc6 | 690 | .SH RETURN VALUE |
dd3568a1 | 691 | .PP |
fea681da | 692 | On success, |
e511ffb6 | 693 | .BR quotactl () |
1eeddf25 JK |
694 | returns 0; on error \-1 |
695 | is returned, and | |
fea681da | 696 | .I errno |
1eeddf25 | 697 | is set to indicate the error. |
fea681da | 698 | .SH ERRORS |
fea681da | 699 | .TP |
3b177104 MK |
700 | .B EACCES |
701 | .I cmd | |
702 | is | |
703 | .BR Q_QUOTAON , | |
704 | and the quota file pointed to by | |
705 | .I addr | |
706 | exists, but is not a regular file or | |
707 | is not on the filesystem pointed to by | |
708 | .IR special . | |
709 | .TP | |
710 | .B EBUSY | |
711 | .I cmd | |
712 | is | |
713 | .BR Q_QUOTAON , | |
714 | but another | |
715 | .B Q_QUOTAON | |
716 | had already been performed. | |
717 | .TP | |
fea681da | 718 | .B EFAULT |
fea681da | 719 | .I addr |
1eeddf25 JK |
720 | or |
721 | .I special | |
722 | is invalid. | |
fea681da MK |
723 | .TP |
724 | .B EINVAL | |
1eeddf25 JK |
725 | .I cmd |
726 | or | |
fea681da | 727 | .I type |
1eeddf25 | 728 | is invalid. |
fea681da | 729 | .TP |
3b177104 MK |
730 | .B EINVAL |
731 | .I cmd | |
732 | is | |
733 | .BR Q_QUOTAON , | |
734 | but the specified quota file is corrupted. | |
735 | .TP | |
64e4eac9 MK |
736 | .BR EINVAL " (since Linux 5.5)" |
737 | .\" 3dd4d40b420846dd35869ccc8f8627feef2cff32 | |
ef9e5be0 YX |
738 | .I cmd |
739 | is | |
740 | .BR Q_XQUOTARM , | |
64e4eac9 MK |
741 | but |
742 | .I addr | |
743 | does not point to valid quota types. | |
ef9e5be0 | 744 | .TP |
1eeddf25 JK |
745 | .B ENOENT |
746 | The file specified by | |
fea681da | 747 | .I special |
1eeddf25 JK |
748 | or |
749 | .I addr | |
750 | does not exist. | |
fea681da | 751 | .TP |
1eeddf25 JK |
752 | .B ENOSYS |
753 | The kernel has not been compiled with the | |
754 | .B CONFIG_QUOTA | |
755 | option. | |
fea681da MK |
756 | .TP |
757 | .B ENOTBLK | |
758 | .I special | |
1eeddf25 | 759 | is not a block device. |
fea681da MK |
760 | .TP |
761 | .B EPERM | |
1eeddf25 JK |
762 | The caller lacked the required privilege |
763 | .RB ( CAP_SYS_ADMIN ) | |
764 | for the specified operation. | |
fea681da | 765 | .TP |
3b177104 | 766 | .B ERANGE |
1eeddf25 JK |
767 | .I cmd |
768 | is | |
769 | .BR Q_SETQUOTA , | |
3b177104 | 770 | but the specified limits are out of the range allowed by the quota format. |
1eeddf25 | 771 | .TP |
3b177104 MK |
772 | .B ESRCH |
773 | No disk quota is found for the indicated user. | |
774 | Quotas have not been turned on for this filesystem. | |
775 | .TP | |
776 | .B ESRCH | |
1eeddf25 JK |
777 | .I cmd |
778 | is | |
779 | .BR Q_QUOTAON , | |
3b177104 | 780 | but the specified quota format was not found. |
8d03f12c MK |
781 | .TP |
782 | .B ESRCH | |
783 | .I cmd | |
784 | is | |
785 | .B Q_GETNEXTQUOTA | |
786 | or | |
787 | .BR Q_XGETNEXTQUOTA , | |
788 | but there is no ID greater than or equal to | |
789 | .IR id | |
790 | that has an active quota. | |
90d79b64 ES |
791 | .SH NOTES |
792 | Instead of | |
793 | .I <xfs/xqm.h> | |
794 | one can use | |
795 | .IR <linux/dqblk_xfs.h> , | |
796 | taking into account that there are several naming discrepancies: | |
797 | .IP \(bu 3 | |
798 | Quota enabling flags (of format | |
799 | .BR XFS_QUOTA_[UGP]DQ_{ACCT,ENFD} ) | |
093b6f20 | 800 | are defined without a leading "X", as |
90d79b64 ES |
801 | .BR FS_QUOTA_[UGP]DQ_{ACCT,ENFD} . |
802 | .IP \(bu | |
093b6f20 | 803 | The same is true for |
90d79b64 | 804 | .B XFS_{USER,GROUP,PROJ}_QUOTA |
093b6f20 | 805 | quota type flags, which are defined as |
90d79b64 ES |
806 | .BR FS_{USER,GROUP,PROJ}_QUOTA . |
807 | .IP \(bu | |
808 | The | |
809 | .I dqblk_xfs.h | |
093b6f20 | 810 | header file defines its own |
90d79b64 ES |
811 | .BR XQM_USRQUOTA , |
812 | .BR XQM_GRPQUOTA , | |
813 | and | |
814 | .B XQM_PRJQUOTA | |
815 | constants for the available quota types, but their values are the same as for | |
816 | constants without the | |
817 | .B XQM_ | |
818 | prefix. | |
47297adb | 819 | .SH SEE ALSO |
fea681da MK |
820 | .BR quota (1), |
821 | .BR getrlimit (2), | |
fea681da MK |
822 | .BR quotacheck (8), |
823 | .BR quotaon (8) |