]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/quotactl.2
pow.3: Minor tweak to BUGS
[thirdparty/man-pages.git] / man2 / quotactl.2
CommitLineData
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 29quotactl \- 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 40The quota system can be used to set per-user, per-group, and per-project limits
b5b42cc5 41on the amount of disk space used on a filesystem.
1eeddf25 42For each user and/or group,
9ee4a2b6 43a soft limit and a hard limit can be set for each filesystem.
1eeddf25
JK
44The hard limit can't be exceeded.
45The soft limit can be exceeded, but warnings will ensue.
955ea4e7
ES
46Moreover, the user can't exceed the soft limit for more than grace period
47duration (one week by default) at a time;
48after this, the soft limit counts as a hard limit.
efeece04 49.PP
fea681da 50The
e511ffb6 51.BR quotactl ()
1eeddf25
JK
52call manipulates disk quotas.
53The
54.I cmd
55argument indicates a command to be applied to the user or
56group ID specified in
57.IR id .
58To initialize the
59.IR cmd
60argument, use the
61.IR "QCMD(subcmd, type)"
62macro.
63The
fea681da 64.I type
1eeddf25
JK
65value is either
66.BR USRQUOTA ,
67for user quotas,
1eeddf25 68.BR GRPQUOTA ,
b5b42cc5
ES
69for group quotas, or (since Linux 4.1)
70.\" 847aac644e92e5624f2c153bab409bf713d5ff9a
71.BR PRJQUOTA ,
72for project quotas.
1eeddf25 73The
fea681da 74.I subcmd
1eeddf25 75value is described below.
efeece04 76.PP
1eeddf25 77The
fea681da 78.I special
1eeddf25 79argument is a pointer to a null-terminated string containing the pathname
9ee4a2b6 80of the (mounted) block special device for the filesystem being manipulated.
efeece04 81.PP
1eeddf25 82The
fea681da 83.I addr
1eeddf25
JK
84argument is the address of an optional, command-specific, data structure
85that is copied in or out of the system.
86The interpretation of
87.I addr
96e60ae5 88is given with each operation below.
efeece04 89.PP
fea681da
MK
90The
91.I subcmd
96e60ae5 92value is one of the following operations:
0019177e 93.TP
5a11d358 94.B Q_QUOTAON
9ee4a2b6 95Turn on quotas for a filesystem.
c13182ef 96The
1eeddf25
JK
97.I id
98argument is the identification number of the quota format to be used.
99Currently, there are three supported quota formats:
100.RS
101.TP 13
102.BR QFMT_VFS_OLD
103The original quota format.
fea681da 104.TP
1eeddf25
JK
105.BR QFMT_VFS_V0
106The standard VFS v0 quota format, which can handle 32-bit UIDs and GIDs
107and quota limits up to 2^42 bytes and 2^32 inodes.
108.TP
109.BR QFMT_VFS_V1
110A quota format that can handle 32-bit UIDs and GIDs
111and quota limits of 2^64 bytes and 2^64 inodes.
112.RE
113.IP
114The
115.IR addr
116argument points to the pathname of a file containing the quotas for
9ee4a2b6 117the filesystem.
1eeddf25
JK
118The quota file must exist; it is normally created with the
119.BR quotacheck (8)
f5fd82cc
MK
120program
121.IP
122Quota information can be also stored in hidden system inodes
123for ext4, XFS, and other filesystems if the filesystem is configured so.
ae848b1d
YX
124In this case, there are no visible quota files and there is no need to
125use
126.BR quotacheck (8).
f5fd82cc
MK
127Quota information is always kept consistent by the filesystem and the
128.B Q_QUOTAON
129operation serves only to enable enforcement of quota limits.
130The presence of hidden
131system inodes with quota information is indicated by the
132.B DQF_SYS_FILE
133flag in the
134.I dqi_flags
135field returned by the
136.B Q_GETINFO
137operation.
138.IP
1eeddf25
JK
139This operation requires privilege
140.RB ( CAP_SYS_ADMIN ).
0019177e 141.TP
fea681da 142.B Q_QUOTAOFF
9ee4a2b6 143Turn off quotas for a filesystem.
1eeddf25
JK
144The
145.I addr
146and
147.I id
148arguments are ignored.
149This operation requires privilege
150.RB ( CAP_SYS_ADMIN ).
fea681da
MK
151.TP
152.B Q_GETQUOTA
1eeddf25
JK
153Get disk quota limits and current usage for user or group
154.IR id .
c13182ef 155The
fea681da 156.I addr
1eeddf25
JK
157argument is a pointer to a
158.I dqblk
159structure defined in
160.IR <sys/quota.h>
161as 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
168struct 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
204The
205.I dqb_valid
206field is a bit mask that is set to indicate the entries in the
207.I dqblk
208structure that are valid.
209Currently, the kernel fills in all entries of the
210.I dqblk
211structure and marks them as valid in the
212.I dqb_valid
213field.
214Unprivileged users may retrieve only their own quotas;
215a privileged user
216.RB ( CAP_SYS_ADMIN )
217can retrieve the quotas of any user.
fea681da 218.TP
8d03f12c
MK
219.BR Q_GETNEXTQUOTA " (since Linux 4.6)"
220.\" commit 926132c0257a5a8d149a6a395cc3405e55420566
221This operation is the same as
222.BR Q_GETQUOTA ,
223but it returns quota information for the next ID greater than or equal to
224.IR id
225that has a quota set.
efeece04 226.IP
8d03f12c
MK
227The
228.I addr
229argument is a pointer to a
230.I nextdqblk
231structure whose fields are as for the
232.IR dqblk ,
233except for the addition of a
234.I dqb_id
235field that is used to return the ID for which
236quota information is being returned:
efeece04 237.IP
8d03f12c 238.in +4n
b8302363 239.EX
8d03f12c
MK
240struct 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
256Set quota information for user or group
257.IR id ,
258using the information supplied in the
259.I dqblk
260structure pointed to by
261.IR addr .
262The
263.I dqb_valid
264field of the
265.I dqblk
266structure indicates which entries in the structure have been set by the caller.
267This operation supersedes the
268.B Q_SETQLIM
269and
270.B Q_SETUSE
271operations in the previous quota interfaces.
272This operation requires privilege
273.RB ( CAP_SYS_ADMIN ).
274.TP
4c8a2e1d 275.BR Q_GETINFO " (since Linux 2.4.22)"
1eeddf25
JK
276Get information (like grace times) about quotafile.
277The
fea681da 278.I addr
1eeddf25
JK
279argument should be a pointer to a
280.I dqinfo
281structure.
282This structure is defined in
283.IR <sys/quota.h>
284as 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
291struct 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
324The
325.I dqi_valid
326field in the
327.I dqinfo
328structure indicates the entries in the structure that are valid.
329Currently, the kernel fills in all entries of the
330.I dqinfo
331structure and marks them all as valid in the
332.I dqi_valid
333field.
334The
335.I id
336argument is ignored.
fea681da 337.TP
4c8a2e1d 338.BR Q_SETINFO " (since Linux 2.4.22)"
1eeddf25
JK
339Set information about quotafile.
340The
fea681da 341.I addr
1eeddf25
JK
342argument should be a pointer to a
343.I dqinfo
344structure.
345The
346.I dqi_valid
347field of the
348.I dqinfo
349structure indicates the entries in the structure
350that have been set by the caller.
351This operation supersedes the
352.B Q_SETGRACE
353and
354.B Q_SETFLAGS
355operations in the previous quota interfaces.
356The
357.I id
358argument is ignored.
359This operation requires privilege
360.RB ( CAP_SYS_ADMIN ).
fea681da 361.TP
4c8a2e1d 362.BR Q_GETFMT " (since Linux 2.4.22)"
9ee4a2b6 363Get quota format used on the specified filesystem.
1eeddf25
JK
364The
365.I addr
366argument should be a pointer to a 4-byte buffer
367where the format number will be stored.
fea681da
MK
368.TP
369.B Q_SYNC
9ee4a2b6 370Update the on-disk copy of quota usages for a filesystem.
1eeddf25
JK
371If
372.I special
9ee4a2b6 373is NULL, then all filesystems with active quotas are sync'ed.
1eeddf25
JK
374The
375.I addr
376and
377.I id
378arguments are ignored.
fea681da 379.TP
3cf5ae17 380.BR Q_GETSTATS " (supported up to Linux 2.4.21)"
1eeddf25
JK
381Get statistics and other generic information about the quota subsystem.
382The
383.I addr
384argument should be a pointer to a
385.I dqstats
386structure in which data should be stored.
387This structure is defined in
c367cd59 388.IR <sys/quota.h> .
1eeddf25
JK
389The
390.I special
391and
392.I id
393arguments are ignored.
efeece04 394.IP
3cf5ae17 395This operation is obsolete and was removed in Linux 2.4.22.
1eeddf25
JK
396Files in
397.I /proc/sys/fs/quota/
398carry the information instead.
399.PP
9ee4a2b6 400For XFS filesystems making use of the XFS Quota Manager (XQM),
96e60ae5 401the above operations are bypassed and the following operations are used:
0019177e 402.TP
1eeddf25 403.B Q_XQUOTAON
9ee4a2b6 404Turn on quotas for an XFS filesystem.
1eeddf25
JK
405XFS provides the ability to turn on/off quota limit enforcement
406with quota accounting.
407Therefore, XFS expects
408.I addr
409to be a pointer to an
410.I "unsigned int"
36a35d67 411that 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
416XFS_QUOTA_UDQ_ACCT /* User quota accounting */
417XFS_QUOTA_UDQ_ENFD /* User quota limits enforcement */
418XFS_QUOTA_GDQ_ACCT /* Group quota accounting */
419XFS_QUOTA_GDQ_ENFD /* Group quota limits enforcement */
420XFS_QUOTA_PDQ_ACCT /* Project quota accounting */
421XFS_QUOTA_PDQ_ENFD /* Project quota limits enforcement */
b8302363 422.EE
e646a1ba 423.in
efeece04 424.IP
1eeddf25
JK
425This operation requires privilege
426.RB ( CAP_SYS_ADMIN ).
90d79b64
ES
427The
428.I id
429argument is ignored.
1eeddf25
JK
430.TP
431.B Q_XQUOTAOFF
9ee4a2b6 432Turn off quotas for an XFS filesystem.
1eeddf25
JK
433As with
434.BR Q_QUOTAON ,
9ee4a2b6 435XFS filesystems expect a pointer to an
1eeddf25
JK
436.I "unsigned int"
437that specifies whether quota accounting and/or limit enforcement need
90d79b64 438to be turned off (using the same flags as for
093b6f20 439.B Q_XQUOTAON
96e60ae5 440operation).
1eeddf25
JK
441This operation requires privilege
442.RB ( CAP_SYS_ADMIN ).
90d79b64
ES
443The
444.I id
445argument is ignored.
1eeddf25
JK
446.TP
447.B Q_XGETQUOTA
448Get disk quota limits and current usage for user
449.IR id .
450The
451.I addr
452argument is a pointer to an
453.I fs_disk_quota
093b6f20 454structure, which is defined in
90d79b64
ES
455.I <xfs/xqm.h>
456as 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
469struct 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
508Unprivileged users may retrieve only their own quotas;
509a privileged user
510.RB ( CAP_SYS_ADMIN )
511may retrieve the quotas of any user.
3b177104
MK
512.TP
513.BR Q_XGETNEXTQUOTA " (since Linux 4.6)"
8d03f12c
MK
514.\" commit 8b37524962b9c54423374717786198f5c0820a28
515This operation is the same as
516.BR Q_XGETQUOTA ,
90d79b64
ES
517but it returns (in the
518.I fs_disk_quota
519structure pointed by
520.IR addr )
521quota information for the next ID greater than or equal to
8d03f12c 522.IR id
093b6f20
MK
523that has a quota set.
524Note that since
90d79b64
ES
525.I fs_disk_quota
526already has
527.I q_id
528field, no separate structure type is needed (in contrast with
529.B Q_GETQUOTA
530and
531.B Q_GETNEXTQUOTA
96e60ae5 532operations)
1eeddf25
JK
533.TP
534.B Q_XSETQLIM
535Set disk quota limits for user
536.IR id .
537The
538.I addr
539argument is a pointer to an
540.I fs_disk_quota
90d79b64 541structure.
1eeddf25
JK
542This operation requires privilege
543.RB ( CAP_SYS_ADMIN ).
544.TP
545.B Q_XGETQSTAT
869c706f 546Returns XFS filesystem-specific quota information in the
1eeddf25 547.I fs_quota_stat
869c706f
MK
548structure pointed by
549.IR addr .
1eeddf25 550This is useful for finding out how much space is used to store quota
093b6f20
MK
551information, and also to get the quota on/off status of a given local XFS
552filesystem.
553The
90d79b64
ES
554.I fs_quota_stat
555structure 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
561struct 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
568struct 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
588The
589.I id
590argument is ignored.
591.TP
592.B Q_XGETQSTATV
869c706f 593Returns XFS filesystem-specific quota information in the
90d79b64 594.I fs_quota_statv
869c706f
MK
595pointed to by
596.IR addr .
96e60ae5 597This version of the operation uses a structure with proper versioning support,
093b6f20
MK
598along with appropriate layout (all fields are naturally aligned) and
599padding to avoiding special compat handling;
600it also provides the ability to get statistics regarding
601the project quota file.
602The
90d79b64
ES
603.I fs_quota_statv
604structure 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
610struct 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
618struct 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
641The
642.I qs_version
643field of the structure should be filled with the version of the structure
644supported by the callee (for now, only
645.I FS_QSTAT_VERSION1
093b6f20
MK
646is supported).
647The kernel will fill the structure in accordance with
90d79b64
ES
648version provided.
649The
650.I id
651argument is ignored.
1eeddf25 652.TP
06744370 653.B Q_XQUOTARM " (since Linux 3.16)"
ae848b1d 654.\" 9da93f9b7cdf8ab28da6b364cdc1fafc8670b4dc
fcd4007b
MK
655Free the disk space taken by disk quotas.
656The
90d79b64
ES
657.I addr
658argument should be a pointer to an
659.I "unsigned int"
660value containing flags (the same as in
661.I d_flags
662field of
663.I fs_disk_quota
64e4eac9 664structure)
ef9e5be0 665which identify what types of quota
64e4eac9
MK
666should be removed.
667(Note that the quota type passed in the
90d79b64
ES
668.I cmd
669argument is ignored, but should remain valid in order to pass preliminary
64e4eac9 670quotactl syscall handler checks.)
efeece04 671.IP
093b6f20
MK
672Quotas must have already been turned off.
673The
90d79b64
ES
674.I id
675argument 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 679This operation was an XFS quota equivalent to
a5394cba 680.BR Q_SYNC ,
d38be90d 681but it is no-op since Linux 3.4,
942627c9 682.\" 4b217ed9e30f94b6e8e5e262020ef0ceab6113af
d38be90d 683as
1eeddf25 684.BR sync (1)
d38be90d
MK
685writes quota information to disk now
686(in addition to the other filesystem metadata that it writes out).
687The
942627c9
ES
688.IR special ", " id " and " addr
689arguments are ignored.
6acbcbc6 690.SH RETURN VALUE
dd3568a1 691.PP
fea681da 692On success,
e511ffb6 693.BR quotactl ()
1eeddf25
JK
694returns 0; on error \-1
695is returned, and
fea681da 696.I errno
1eeddf25 697is set to indicate the error.
fea681da 698.SH ERRORS
fea681da 699.TP
3b177104
MK
700.B EACCES
701.I cmd
702is
703.BR Q_QUOTAON ,
704and the quota file pointed to by
705.I addr
706exists, but is not a regular file or
707is not on the filesystem pointed to by
708.IR special .
709.TP
710.B EBUSY
711.I cmd
712is
713.BR Q_QUOTAON ,
714but another
715.B Q_QUOTAON
716had already been performed.
717.TP
fea681da 718.B EFAULT
fea681da 719.I addr
1eeddf25
JK
720or
721.I special
722is invalid.
fea681da
MK
723.TP
724.B EINVAL
1eeddf25
JK
725.I cmd
726or
fea681da 727.I type
1eeddf25 728is invalid.
fea681da 729.TP
3b177104
MK
730.B EINVAL
731.I cmd
732is
733.BR Q_QUOTAON ,
734but the specified quota file is corrupted.
735.TP
64e4eac9
MK
736.BR EINVAL " (since Linux 5.5)"
737.\" 3dd4d40b420846dd35869ccc8f8627feef2cff32
ef9e5be0
YX
738.I cmd
739is
740.BR Q_XQUOTARM ,
64e4eac9
MK
741but
742.I addr
743does not point to valid quota types.
ef9e5be0 744.TP
1eeddf25
JK
745.B ENOENT
746The file specified by
fea681da 747.I special
1eeddf25
JK
748or
749.I addr
750does not exist.
fea681da 751.TP
1eeddf25
JK
752.B ENOSYS
753The kernel has not been compiled with the
754.B CONFIG_QUOTA
755option.
fea681da
MK
756.TP
757.B ENOTBLK
758.I special
1eeddf25 759is not a block device.
fea681da
MK
760.TP
761.B EPERM
1eeddf25
JK
762The caller lacked the required privilege
763.RB ( CAP_SYS_ADMIN )
764for the specified operation.
fea681da 765.TP
3b177104 766.B ERANGE
1eeddf25
JK
767.I cmd
768is
769.BR Q_SETQUOTA ,
3b177104 770but the specified limits are out of the range allowed by the quota format.
1eeddf25 771.TP
3b177104
MK
772.B ESRCH
773No disk quota is found for the indicated user.
774Quotas have not been turned on for this filesystem.
775.TP
776.B ESRCH
1eeddf25
JK
777.I cmd
778is
779.BR Q_QUOTAON ,
3b177104 780but the specified quota format was not found.
8d03f12c
MK
781.TP
782.B ESRCH
783.I cmd
784is
785.B Q_GETNEXTQUOTA
786or
787.BR Q_XGETNEXTQUOTA ,
788but there is no ID greater than or equal to
789.IR id
790that has an active quota.
90d79b64
ES
791.SH NOTES
792Instead of
793.I <xfs/xqm.h>
794one can use
795.IR <linux/dqblk_xfs.h> ,
796taking into account that there are several naming discrepancies:
797.IP \(bu 3
798Quota enabling flags (of format
799.BR XFS_QUOTA_[UGP]DQ_{ACCT,ENFD} )
093b6f20 800are defined without a leading "X", as
90d79b64
ES
801.BR FS_QUOTA_[UGP]DQ_{ACCT,ENFD} .
802.IP \(bu
093b6f20 803The same is true for
90d79b64 804.B XFS_{USER,GROUP,PROJ}_QUOTA
093b6f20 805quota type flags, which are defined as
90d79b64
ES
806.BR FS_{USER,GROUP,PROJ}_QUOTA .
807.IP \(bu
808The
809.I dqblk_xfs.h
093b6f20 810header file defines its own
90d79b64
ES
811.BR XQM_USRQUOTA ,
812.BR XQM_GRPQUOTA ,
813and
814.B XQM_PRJQUOTA
815constants for the available quota types, but their values are the same as for
816constants without the
817.B XQM_
818prefix.
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)