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