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