Blame man2/quotactl.2

Packit 7cfc04
.\" Copyright (c) 2010, Jan Kara
Packit 7cfc04
.\" A few pieces copyright (c) 1996 Andries Brouwer (aeb@cwi.nl)
Packit 7cfc04
.\" and copyright 2010 (c) Michael Kerrisk <mtk.manpages@gmail.com>
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(VERBATIM)
Packit 7cfc04
.\" Permission is granted to make and distribute verbatim copies of this
Packit 7cfc04
.\" manual provided the copyright notice and this permission notice are
Packit 7cfc04
.\" preserved on all copies.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Permission is granted to copy and distribute modified versions of
Packit 7cfc04
.\" this manual under the conditions for verbatim copying, provided that
Packit 7cfc04
.\" the entire resulting derived work is distributed under the terms of
Packit 7cfc04
.\" a permission notice identical to this one.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Since the Linux kernel and libraries are constantly changing, this
Packit 7cfc04
.\" manual page may be incorrect or out-of-date.  The author(s) assume
Packit 7cfc04
.\" no responsibility for errors or omissions, or for damages resulting
Packit 7cfc04
.\" from the use of the information contained herein.  The author(s) may
Packit 7cfc04
.\" not have taken the same level of care in the production of this
Packit 7cfc04
.\" manual, which is licensed free of charge, as they might when working
Packit 7cfc04
.\" professionally.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Formatted or processed versions of this manual, if unaccompanied by
Packit 7cfc04
.\" the source, must acknowledge the copyright and authors of this work.
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.\"
Packit 7cfc04
.TH QUOTACTL 2 2017-09-15 "Linux" "Linux Programmer's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
quotactl \- manipulate disk quotas
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.nf
Packit 7cfc04
.B #include <sys/quota.h>
Packit 7cfc04
.B #include <xfs/xqm.h> /* for XFS quotas */
Packit 7cfc04
.PP
Packit 7cfc04
.BI "int quotactl(int " cmd ", const char *" special ", int " id \
Packit 7cfc04
", caddr_t " addr );
Packit 7cfc04
.fi
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
.PP
Packit 7cfc04
The quota system can be used to set per-user, per-group, and per-project limits
Packit 7cfc04
on the amount of disk space used on a filesystem.
Packit 7cfc04
For each user and/or group,
Packit 7cfc04
a soft limit and a hard limit can be set for each filesystem.
Packit 7cfc04
The hard limit can't be exceeded.
Packit 7cfc04
The soft limit can be exceeded, but warnings will ensue.
Packit 7cfc04
Moreover, the user can't exceed the soft limit for more than grace period
Packit 7cfc04
duration (one week by default) at a time;
Packit 7cfc04
after this, the soft limit counts as a hard limit.
Packit 7cfc04
.PP
Packit 7cfc04
The
Packit 7cfc04
.BR quotactl ()
Packit 7cfc04
call manipulates disk quotas.
Packit 7cfc04
The
Packit 7cfc04
.I cmd
Packit 7cfc04
argument indicates a command to be applied to the user or
Packit 7cfc04
group ID specified in
Packit 7cfc04
.IR id .
Packit 7cfc04
To initialize the
Packit 7cfc04
.IR cmd
Packit 7cfc04
argument, use the
Packit 7cfc04
.IR "QCMD(subcmd, type)"
Packit 7cfc04
macro.
Packit 7cfc04
The
Packit 7cfc04
.I type
Packit 7cfc04
value is either
Packit 7cfc04
.BR USRQUOTA ,
Packit 7cfc04
for user quotas,
Packit 7cfc04
.BR GRPQUOTA ,
Packit 7cfc04
for group quotas, or (since Linux 4.1)
Packit 7cfc04
.\" 847aac644e92e5624f2c153bab409bf713d5ff9a
Packit 7cfc04
.BR PRJQUOTA ,
Packit 7cfc04
for project quotas.
Packit 7cfc04
The
Packit 7cfc04
.I subcmd
Packit 7cfc04
value is described below.
Packit 7cfc04
.PP
Packit 7cfc04
The
Packit 7cfc04
.I special
Packit 7cfc04
argument is a pointer to a null-terminated string containing the pathname
Packit 7cfc04
of the (mounted) block special device for the filesystem being manipulated.
Packit 7cfc04
.PP
Packit 7cfc04
The
Packit 7cfc04
.I addr
Packit 7cfc04
argument is the address of an optional, command-specific, data structure
Packit 7cfc04
that is copied in or out of the system.
Packit 7cfc04
The interpretation of
Packit 7cfc04
.I addr
Packit 7cfc04
is given with each command below.
Packit 7cfc04
.PP
Packit 7cfc04
The
Packit 7cfc04
.I subcmd
Packit 7cfc04
value is one of the following:
Packit 7cfc04
.TP 8
Packit 7cfc04
.B Q_QUOTAON
Packit 7cfc04
Turn on quotas for a filesystem.
Packit 7cfc04
The
Packit 7cfc04
.I id
Packit 7cfc04
argument is the identification number of the quota format to be used.
Packit 7cfc04
Currently, there are three supported quota formats:
Packit 7cfc04
.RS
Packit 7cfc04
.TP 13
Packit 7cfc04
.BR QFMT_VFS_OLD
Packit 7cfc04
The original quota format.
Packit 7cfc04
.TP
Packit 7cfc04
.BR QFMT_VFS_V0
Packit 7cfc04
The standard VFS v0 quota format, which can handle 32-bit UIDs and GIDs
Packit 7cfc04
and quota limits up to 2^42 bytes and 2^32 inodes.
Packit 7cfc04
.TP
Packit 7cfc04
.BR QFMT_VFS_V1
Packit 7cfc04
A quota format that can handle 32-bit UIDs and GIDs
Packit 7cfc04
and quota limits of 2^64 bytes and 2^64 inodes.
Packit 7cfc04
.RE
Packit 7cfc04
.IP
Packit 7cfc04
The
Packit 7cfc04
.IR addr
Packit 7cfc04
argument points to the pathname of a file containing the quotas for
Packit 7cfc04
the filesystem.
Packit 7cfc04
The quota file must exist; it is normally created with the
Packit 7cfc04
.BR quotacheck (8)
Packit 7cfc04
program.
Packit 7cfc04
This operation requires privilege
Packit 7cfc04
.RB ( CAP_SYS_ADMIN ).
Packit 7cfc04
.TP 8
Packit 7cfc04
.B Q_QUOTAOFF
Packit 7cfc04
Turn off quotas for a filesystem.
Packit 7cfc04
The
Packit 7cfc04
.I addr
Packit 7cfc04
and
Packit 7cfc04
.I id
Packit 7cfc04
arguments are ignored.
Packit 7cfc04
This operation requires privilege
Packit 7cfc04
.RB ( CAP_SYS_ADMIN ).
Packit 7cfc04
.TP
Packit 7cfc04
.B Q_GETQUOTA
Packit 7cfc04
Get disk quota limits and current usage for user or group
Packit 7cfc04
.IR id .
Packit 7cfc04
The
Packit 7cfc04
.I addr
Packit 7cfc04
argument is a pointer to a
Packit 7cfc04
.I dqblk
Packit 7cfc04
structure defined in
Packit 7cfc04
.IR <sys/quota.h>
Packit 7cfc04
as follows:
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
/* uint64_t is an unsigned 64\-bit integer;
Packit 7cfc04
   uint32_t is an unsigned 32\-bit integer */
Packit 7cfc04
Packit 7cfc04
struct dqblk {      /* Definition since Linux 2.4.22 */
Packit 7cfc04
    uint64_t dqb_bhardlimit;  /* Absolute limit on disk
Packit 7cfc04
                                 quota blocks alloc */
Packit 7cfc04
    uint64_t dqb_bsoftlimit;  /* Preferred limit on
Packit 7cfc04
                                 disk quota blocks */
Packit 7cfc04
    uint64_t dqb_curspace;    /* Current occupied space
Packit 7cfc04
                                 (in bytes) */
Packit 7cfc04
    uint64_t dqb_ihardlimit;  /* Maximum number of
Packit 7cfc04
                                 allocated inodes */
Packit 7cfc04
    uint64_t dqb_isoftlimit;  /* Preferred inode limit */
Packit 7cfc04
    uint64_t dqb_curinodes;   /* Current number of
Packit 7cfc04
                                 allocated inodes */
Packit 7cfc04
    uint64_t dqb_btime;       /* Time limit for excessive
Packit 7cfc04
                                 disk use */
Packit 7cfc04
    uint64_t dqb_itime;       /* Time limit for excessive
Packit 7cfc04
                                 files */
Packit 7cfc04
    uint32_t dqb_valid;       /* Bit mask of QIF_*
Packit 7cfc04
                                 constants */
Packit 7cfc04
};
Packit 7cfc04
Packit 7cfc04
/* Flags in dqb_valid that indicate which fields in
Packit 7cfc04
   dqblk structure are valid. */
Packit 7cfc04
Packit 7cfc04
#define QIF_BLIMITS   1
Packit 7cfc04
#define QIF_SPACE     2
Packit 7cfc04
#define QIF_ILIMITS   4
Packit 7cfc04
#define QIF_INODES    8
Packit 7cfc04
#define QIF_BTIME     16
Packit 7cfc04
#define QIF_ITIME     32
Packit 7cfc04
#define QIF_LIMITS    (QIF_BLIMITS | QIF_ILIMITS)
Packit 7cfc04
#define QIF_USAGE     (QIF_SPACE | QIF_INODES)
Packit 7cfc04
#define QIF_TIMES     (QIF_BTIME | QIF_ITIME)
Packit 7cfc04
#define QIF_ALL       (QIF_LIMITS | QIF_USAGE | QIF_TIMES)
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
The
Packit 7cfc04
.I dqb_valid
Packit 7cfc04
field is a bit mask that is set to indicate the entries in the
Packit 7cfc04
.I dqblk
Packit 7cfc04
structure that are valid.
Packit 7cfc04
Currently, the kernel fills in all entries of the
Packit 7cfc04
.I dqblk
Packit 7cfc04
structure and marks them as valid in the
Packit 7cfc04
.I dqb_valid
Packit 7cfc04
field.
Packit 7cfc04
Unprivileged users may retrieve only their own quotas;
Packit 7cfc04
a privileged user
Packit 7cfc04
.RB ( CAP_SYS_ADMIN )
Packit 7cfc04
can retrieve the quotas of any user.
Packit 7cfc04
.TP
Packit 7cfc04
.BR Q_GETNEXTQUOTA " (since Linux 4.6)"
Packit 7cfc04
.\" commit 926132c0257a5a8d149a6a395cc3405e55420566
Packit 7cfc04
This operation is the same as
Packit 7cfc04
.BR Q_GETQUOTA ,
Packit 7cfc04
but it returns quota information for the next ID greater than or equal to
Packit 7cfc04
.IR id
Packit 7cfc04
that has a quota set.
Packit 7cfc04
.IP
Packit 7cfc04
The
Packit 7cfc04
.I addr
Packit 7cfc04
argument is a pointer to a
Packit 7cfc04
.I nextdqblk
Packit 7cfc04
structure whose fields are as for the
Packit 7cfc04
.IR dqblk ,
Packit 7cfc04
except for the addition of a
Packit 7cfc04
.I dqb_id
Packit 7cfc04
field that is used to return the ID for which
Packit 7cfc04
quota information is being returned:
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
struct nextdqblk {
Packit 7cfc04
    uint64_t dqb_bhardlimit;
Packit 7cfc04
    uint64_t dqb_bsoftlimit;
Packit 7cfc04
    uint64_t dqb_curspace;
Packit 7cfc04
    uint64_t dqb_ihardlimit;
Packit 7cfc04
    uint64_t dqb_isoftlimit;
Packit 7cfc04
    uint64_t dqb_curinodes;
Packit 7cfc04
    uint64_t dqb_btime;
Packit 7cfc04
    uint64_t dqb_itime;
Packit 7cfc04
    uint32_t dqb_valid;
Packit 7cfc04
    uint32_t dqb_id;
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.TP
Packit 7cfc04
.B Q_SETQUOTA
Packit 7cfc04
Set quota information for user or group
Packit 7cfc04
.IR id ,
Packit 7cfc04
using the information supplied in the
Packit 7cfc04
.I dqblk
Packit 7cfc04
structure pointed to by
Packit 7cfc04
.IR addr .
Packit 7cfc04
The
Packit 7cfc04
.I dqb_valid
Packit 7cfc04
field of the
Packit 7cfc04
.I dqblk
Packit 7cfc04
structure indicates which entries in the structure have been set by the caller.
Packit 7cfc04
This operation supersedes the
Packit 7cfc04
.B Q_SETQLIM
Packit 7cfc04
and
Packit 7cfc04
.B Q_SETUSE
Packit 7cfc04
operations in the previous quota interfaces.
Packit 7cfc04
This operation requires privilege
Packit 7cfc04
.RB ( CAP_SYS_ADMIN ).
Packit 7cfc04
.TP
Packit 7cfc04
.BR Q_GETINFO " (since Linux 2.4.22)"
Packit 7cfc04
Get information (like grace times) about quotafile.
Packit 7cfc04
The
Packit 7cfc04
.I addr
Packit 7cfc04
argument should be a pointer to a
Packit 7cfc04
.I dqinfo
Packit 7cfc04
structure.
Packit 7cfc04
This structure is defined in
Packit 7cfc04
.IR <sys/quota.h>
Packit 7cfc04
as follows:
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
/* uint64_t is an unsigned 64\-bit integer;
Packit 7cfc04
   uint32_t is an unsigned 32\-bit integer */
Packit 7cfc04
Packit 7cfc04
struct dqinfo {         /* Defined since kernel 2.4.22 */
Packit 7cfc04
    uint64_t dqi_bgrace;  /* Time before block soft limit
Packit 7cfc04
                             becomes hard limit */
Packit 7cfc04
    uint64_t dqi_igrace;  /* Time before inode soft limit
Packit 7cfc04
                             becomes hard limit */
Packit 7cfc04
    uint32_t dqi_flags;   /* Flags for quotafile
Packit 7cfc04
                             (DQF_*) */
Packit 7cfc04
    uint32_t dqi_valid;
Packit 7cfc04
};
Packit 7cfc04
Packit 7cfc04
/* Bits for dqi_flags */
Packit 7cfc04
Packit 7cfc04
/* Quota format QFMT_VFS_OLD */
Packit 7cfc04
Packit 7cfc04
#define DQF_ROOT_SQUASH (1 << 0) /* Root squash enabled */
Packit 7cfc04
              /* Before Linux v4.0, this had been defined
Packit 7cfc04
                 privately as V1_DQF_RSQUASH */
Packit 7cfc04
Packit 7cfc04
/* Quota format QFMT_VFS_V0 / QFMT_VFS_V1 */
Packit 7cfc04
Packit 7cfc04
#define DQF_SYS_FILE    (1 << 16)   /* Quota stored in
Packit 7cfc04
                                       a system file */
Packit 7cfc04
Packit 7cfc04
/* Flags in dqi_valid that indicate which fields in
Packit 7cfc04
   dqinfo structure are valid. */
Packit 7cfc04
Packit 7cfc04
#define IIF_BGRACE  1
Packit 7cfc04
#define IIF_IGRACE  2
Packit 7cfc04
#define IIF_FLAGS   4
Packit 7cfc04
#define IIF_ALL     (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
The
Packit 7cfc04
.I dqi_valid
Packit 7cfc04
field in the
Packit 7cfc04
.I dqinfo
Packit 7cfc04
structure indicates the entries in the structure that are valid.
Packit 7cfc04
Currently, the kernel fills in all entries of the
Packit 7cfc04
.I dqinfo
Packit 7cfc04
structure and marks them all as valid in the
Packit 7cfc04
.I dqi_valid
Packit 7cfc04
field.
Packit 7cfc04
The
Packit 7cfc04
.I id
Packit 7cfc04
argument is ignored.
Packit 7cfc04
.TP
Packit 7cfc04
.BR Q_SETINFO " (since Linux 2.4.22)"
Packit 7cfc04
Set information about quotafile.
Packit 7cfc04
The
Packit 7cfc04
.I addr
Packit 7cfc04
argument should be a pointer to a
Packit 7cfc04
.I dqinfo
Packit 7cfc04
structure.
Packit 7cfc04
The
Packit 7cfc04
.I dqi_valid
Packit 7cfc04
field of the
Packit 7cfc04
.I dqinfo
Packit 7cfc04
structure indicates the entries in the structure
Packit 7cfc04
that have been set by the caller.
Packit 7cfc04
This operation supersedes the
Packit 7cfc04
.B Q_SETGRACE
Packit 7cfc04
and
Packit 7cfc04
.B Q_SETFLAGS
Packit 7cfc04
operations in the previous quota interfaces.
Packit 7cfc04
The
Packit 7cfc04
.I id
Packit 7cfc04
argument is ignored.
Packit 7cfc04
This operation requires privilege
Packit 7cfc04
.RB ( CAP_SYS_ADMIN ).
Packit 7cfc04
.TP
Packit 7cfc04
.BR Q_GETFMT " (since Linux 2.4.22)"
Packit 7cfc04
Get quota format used on the specified filesystem.
Packit 7cfc04
The
Packit 7cfc04
.I addr
Packit 7cfc04
argument should be a pointer to a 4-byte buffer
Packit 7cfc04
where the format number will be stored.
Packit 7cfc04
.TP
Packit 7cfc04
.B Q_SYNC
Packit 7cfc04
Update the on-disk copy of quota usages for a filesystem.
Packit 7cfc04
If
Packit 7cfc04
.I special
Packit 7cfc04
is NULL, then all filesystems with active quotas are sync'ed.
Packit 7cfc04
The
Packit 7cfc04
.I addr
Packit 7cfc04
and
Packit 7cfc04
.I id
Packit 7cfc04
arguments are ignored.
Packit 7cfc04
.TP
Packit 7cfc04
.BR Q_GETSTATS " (supported up to Linux 2.4.21)"
Packit 7cfc04
Get statistics and other generic information about the quota subsystem.
Packit 7cfc04
The
Packit 7cfc04
.I addr
Packit 7cfc04
argument should be a pointer to a
Packit 7cfc04
.I dqstats
Packit 7cfc04
structure in which data should be stored.
Packit 7cfc04
This structure is defined in
Packit 7cfc04
.IR <sys/quota.h> .
Packit 7cfc04
The
Packit 7cfc04
.I special
Packit 7cfc04
and
Packit 7cfc04
.I id
Packit 7cfc04
arguments are ignored.
Packit 7cfc04
.IP
Packit 7cfc04
This operation is obsolete and was removed in Linux 2.4.22.
Packit 7cfc04
Files in
Packit 7cfc04
.I /proc/sys/fs/quota/
Packit 7cfc04
carry the information instead.
Packit 7cfc04
.PP
Packit 7cfc04
For XFS filesystems making use of the XFS Quota Manager (XQM),
Packit 7cfc04
the above commands are bypassed and the following commands are used:
Packit 7cfc04
.TP 8
Packit 7cfc04
.B Q_XQUOTAON
Packit 7cfc04
Turn on quotas for an XFS filesystem.
Packit 7cfc04
XFS provides the ability to turn on/off quota limit enforcement
Packit 7cfc04
with quota accounting.
Packit 7cfc04
Therefore, XFS expects
Packit 7cfc04
.I addr
Packit 7cfc04
to be a pointer to an
Packit 7cfc04
.I "unsigned int"
Packit 7cfc04
that contains a combination of the following flags (defined in
Packit 7cfc04
.IR <xfs/xqm.h> ):
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
#define XFS_QUOTA_UDQ_ACCT (1<<0) /* User quota
Packit 7cfc04
                                     accounting */
Packit 7cfc04
#define XFS_QUOTA_UDQ_ENFD (1<<1) /* User quota limits
Packit 7cfc04
                                     enforcement */
Packit 7cfc04
#define XFS_QUOTA_GDQ_ACCT (1<<2) /* Group quota
Packit 7cfc04
                                     accounting */
Packit 7cfc04
#define XFS_QUOTA_GDQ_ENFD (1<<3) /* Group quota limits
Packit 7cfc04
                                     enforcement */
Packit 7cfc04
#define XFS_QUOTA_PDQ_ACCT (1<<4) /* Project quota
Packit 7cfc04
                                     accounting */
Packit 7cfc04
#define XFS_QUOTA_PDQ_ENFD (1<<5) /* Project quota limits
Packit 7cfc04
                                     enforcement */
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
This operation requires privilege
Packit 7cfc04
.RB ( CAP_SYS_ADMIN ).
Packit 7cfc04
The
Packit 7cfc04
.I id
Packit 7cfc04
argument is ignored.
Packit 7cfc04
.TP
Packit 7cfc04
.B Q_XQUOTAOFF
Packit 7cfc04
Turn off quotas for an XFS filesystem.
Packit 7cfc04
As with
Packit 7cfc04
.BR Q_QUOTAON ,
Packit 7cfc04
XFS filesystems expect a pointer to an
Packit 7cfc04
.I "unsigned int"
Packit 7cfc04
that specifies whether quota accounting and/or limit enforcement need
Packit 7cfc04
to be turned off (using the same flags as for
Packit 7cfc04
.B Q_XQUOTAON
Packit 7cfc04
subcommand).
Packit 7cfc04
This operation requires privilege
Packit 7cfc04
.RB ( CAP_SYS_ADMIN ).
Packit 7cfc04
The
Packit 7cfc04
.I id
Packit 7cfc04
argument is ignored.
Packit 7cfc04
.TP
Packit 7cfc04
.B Q_XGETQUOTA
Packit 7cfc04
Get disk quota limits and current usage for user
Packit 7cfc04
.IR id .
Packit 7cfc04
The
Packit 7cfc04
.I addr
Packit 7cfc04
argument is a pointer to an
Packit 7cfc04
.I fs_disk_quota
Packit 7cfc04
structure, which is defined in
Packit 7cfc04
.I <xfs/xqm.h>
Packit 7cfc04
as follows:
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
/* All the blk units are in BBs (Basic Blocks) of
Packit 7cfc04
   512 bytes. */
Packit 7cfc04
Packit 7cfc04
#define FS_DQUOT_VERSION  1  /* fs_disk_quota.d_version */
Packit 7cfc04
Packit 7cfc04
#define XFS_USER_QUOTA    (1<<0)  /* User quota type */
Packit 7cfc04
#define XFS_PROJ_QUOTA    (1<<1)  /* Project quota type */
Packit 7cfc04
#define XFS_GROUP_QUOTA   (1<<2)  /* Group quota type */
Packit 7cfc04
Packit 7cfc04
struct fs_disk_quota {
Packit 7cfc04
    int8_t   d_version;   /* Version of this structure */
Packit 7cfc04
    int8_t   d_flags;     /* XFS_{USER,PROJ,GROUP}_QUOTA */
Packit 7cfc04
    uint16_t d_fieldmask; /* Field specifier */
Packit 7cfc04
    uint32_t d_id;        /* User, project, or group ID */
Packit 7cfc04
    uint64_t d_blk_hardlimit; /* Absolute limit on
Packit 7cfc04
                                 disk blocks */
Packit 7cfc04
    uint64_t d_blk_softlimit; /* Preferred limit on
Packit 7cfc04
                                 disk blocks */
Packit 7cfc04
    uint64_t d_ino_hardlimit; /* Maximum # allocated
Packit 7cfc04
                                 inodes */
Packit 7cfc04
    uint64_t d_ino_softlimit; /* Preferred inode limit */
Packit 7cfc04
    uint64_t d_bcount;    /* # disk blocks owned by
Packit 7cfc04
                             the user */
Packit 7cfc04
    uint64_t d_icount;    /* # inodes owned by the user */
Packit 7cfc04
    int32_t  d_itimer;    /* Zero if within inode limits */
Packit 7cfc04
                          /* If not, we refuse service */
Packit 7cfc04
    int32_t  d_btimer;    /* Similar to above; for
Packit 7cfc04
                             disk blocks */
Packit 7cfc04
    uint16_t d_iwarns;    /* # warnings issued with
Packit 7cfc04
                             respect to # of inodes */
Packit 7cfc04
    uint16_t d_bwarns;    /* # warnings issued with
Packit 7cfc04
                             respect to disk blocks */
Packit 7cfc04
    int32_t  d_padding2;  /* Padding - for future use */
Packit 7cfc04
    uint64_t d_rtb_hardlimit; /* Absolute limit on realtime
Packit 7cfc04
                                 (RT) disk blocks */
Packit 7cfc04
    uint64_t d_rtb_softlimit; /* Preferred limit on RT
Packit 7cfc04
                                 disk blocks */
Packit 7cfc04
    uint64_t d_rtbcount;  /* # realtime blocks owned */
Packit 7cfc04
    int32_t  d_rtbtimer;  /* Similar to above; for RT
Packit 7cfc04
                             disk blocks */
Packit 7cfc04
    uint16_t d_rtbwarns;  /* # warnings issued with
Packit 7cfc04
                             respect to RT disk blocks */
Packit 7cfc04
    int16_t  d_padding3;  /* Padding - for future use */
Packit 7cfc04
    char     d_padding4[8];   /* Yet more padding */
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
Unprivileged users may retrieve only their own quotas;
Packit 7cfc04
a privileged user
Packit 7cfc04
.RB ( CAP_SYS_ADMIN )
Packit 7cfc04
may retrieve the quotas of any user.
Packit 7cfc04
.TP
Packit 7cfc04
.BR Q_XGETNEXTQUOTA " (since Linux 4.6)"
Packit 7cfc04
.\" commit 8b37524962b9c54423374717786198f5c0820a28
Packit 7cfc04
This operation is the same as
Packit 7cfc04
.BR Q_XGETQUOTA ,
Packit 7cfc04
but it returns (in the
Packit 7cfc04
.I fs_disk_quota
Packit 7cfc04
structure pointed by
Packit 7cfc04
.IR addr )
Packit 7cfc04
quota information for the next ID greater than or equal to
Packit 7cfc04
.IR id
Packit 7cfc04
that has a quota set.
Packit 7cfc04
Note that since
Packit 7cfc04
.I fs_disk_quota
Packit 7cfc04
already has
Packit 7cfc04
.I q_id
Packit 7cfc04
field, no separate structure type is needed (in contrast with
Packit 7cfc04
.B Q_GETQUOTA
Packit 7cfc04
and
Packit 7cfc04
.B Q_GETNEXTQUOTA
Packit 7cfc04
commands)
Packit 7cfc04
.TP
Packit 7cfc04
.B Q_XSETQLIM
Packit 7cfc04
Set disk quota limits for user
Packit 7cfc04
.IR id .
Packit 7cfc04
The
Packit 7cfc04
.I addr
Packit 7cfc04
argument is a pointer to an
Packit 7cfc04
.I fs_disk_quota
Packit 7cfc04
structure.
Packit 7cfc04
This operation requires privilege
Packit 7cfc04
.RB ( CAP_SYS_ADMIN ).
Packit 7cfc04
.TP
Packit 7cfc04
.B Q_XGETQSTAT
Packit 7cfc04
Returns XFS filesystem-specific quota information in the
Packit 7cfc04
.I fs_quota_stat
Packit 7cfc04
structure pointed by
Packit 7cfc04
.IR addr .
Packit 7cfc04
This is useful for finding out how much space is used to store quota
Packit 7cfc04
information, and also to get the quota on/off status of a given local XFS
Packit 7cfc04
filesystem.
Packit 7cfc04
The
Packit 7cfc04
.I fs_quota_stat
Packit 7cfc04
structure itself is defined as follows:
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
#define FS_QSTAT_VERSION 1  /* fs_quota_stat.qs_version */
Packit 7cfc04
Packit 7cfc04
struct fs_qfilestat {
Packit 7cfc04
    uint64_t qfs_ino;       /* Inode number */
Packit 7cfc04
    uint64_t qfs_nblks;     /* Number of BBs
Packit 7cfc04
                               512-byte-blocks */
Packit 7cfc04
    uint32_t qfs_nextents;  /* Number of extents */
Packit 7cfc04
};
Packit 7cfc04
Packit 7cfc04
struct fs_quota_stat {
Packit 7cfc04
    int8_t   qs_version; /* Version number for
Packit 7cfc04
                            future changes */
Packit 7cfc04
    uint16_t qs_flags; /* XFS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */
Packit 7cfc04
    int8_t   qs_pad;   /* Unused */
Packit 7cfc04
    struct fs_qfilestat qs_uquota;  /* User quota storage
Packit 7cfc04
                                       information */
Packit 7cfc04
    struct fs_qfilestat qs_gquota;  /* Group quota storage
Packit 7cfc04
                                       information */
Packit 7cfc04
    uint32_t qs_incoredqs;   /* Number of dquots in core */
Packit 7cfc04
    int32_t  qs_btimelimit;  /* Limit for blocks timer */
Packit 7cfc04
    int32_t  qs_itimelimit;  /* Limit for inodes timer */
Packit 7cfc04
    int32_t  qs_rtbtimelimit;/* Limit for RT
Packit 7cfc04
                                blocks timer */
Packit 7cfc04
    uint16_t qs_bwarnlimit;  /* Limit for # of warnings */
Packit 7cfc04
    uint16_t qs_iwarnlimit;  /* Limit for # of warnings */
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
The
Packit 7cfc04
.I id
Packit 7cfc04
argument is ignored.
Packit 7cfc04
.TP
Packit 7cfc04
.B Q_XGETQSTATV
Packit 7cfc04
Returns XFS filesystem-specific quota information in the
Packit 7cfc04
.I fs_quota_statv
Packit 7cfc04
pointed to by
Packit 7cfc04
.IR addr .
Packit 7cfc04
This version of the command uses a structure with proper versioning support,
Packit 7cfc04
along with appropriate layout (all fields are naturally aligned) and
Packit 7cfc04
padding to avoiding special compat handling;
Packit 7cfc04
it also provides the ability to get statistics regarding
Packit 7cfc04
the project quota file.
Packit 7cfc04
The
Packit 7cfc04
.I fs_quota_statv
Packit 7cfc04
structure itself is defined as follows:
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
#define FS_QSTATV_VERSION1 1 /* fs_quota_statv.qs_version */
Packit 7cfc04
Packit 7cfc04
struct fs_qfilestatv {
Packit 7cfc04
    uint64_t qfs_ino;       /* Inode number */
Packit 7cfc04
    uint64_t qfs_nblks;     /* Number of BBs
Packit 7cfc04
                               512-byte-blocks */
Packit 7cfc04
    uint32_t qfs_nextents;  /* Number of extents */
Packit 7cfc04
    uint32_t qfs_pad;       /* Pad for 8-byte alignment */
Packit 7cfc04
};
Packit 7cfc04
Packit 7cfc04
struct fs_quota_statv {
Packit 7cfc04
    int8_t   qs_version;    /* Version for future
Packit 7cfc04
                               changes */
Packit 7cfc04
    uint8_t  qs_pad1;       /* Pad for 16-bit alignment */
Packit 7cfc04
    uint16_t qs_flags;      /* XFS_QUOTA_.* flags */
Packit 7cfc04
    uint32_t qs_incoredqs;  /* Number of dquots incore */
Packit 7cfc04
    struct fs_qfilestatv qs_uquota;  /* User quota
Packit 7cfc04
                                        information */
Packit 7cfc04
    struct fs_qfilestatv qs_gquota;  /* Group quota
Packit 7cfc04
                                        information */
Packit 7cfc04
    struct fs_qfilestatv qs_pquota;  /* Project quota
Packit 7cfc04
                                        information */
Packit 7cfc04
    int32_t  qs_btimelimit;   /* Limit for blocks timer */
Packit 7cfc04
    int32_t  qs_itimelimit;   /* Limit for inodes timer */
Packit 7cfc04
    int32_t  qs_rtbtimelimit; /* Limit for RT blocks
Packit 7cfc04
                                 timer */
Packit 7cfc04
    uint16_t qs_bwarnlimit;   /* Limit for # of warnings */
Packit 7cfc04
    uint16_t qs_iwarnlimit;   /* Limit for # of warnings */
Packit 7cfc04
    uint64_t qs_pad2[8];      /* For future proofing */
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
The
Packit 7cfc04
.I qs_version
Packit 7cfc04
field of the structure should be filled with the version of the structure
Packit 7cfc04
supported by the callee (for now, only
Packit 7cfc04
.I FS_QSTAT_VERSION1
Packit 7cfc04
is supported).
Packit 7cfc04
The kernel will fill the structure in accordance with
Packit 7cfc04
version provided.
Packit 7cfc04
The
Packit 7cfc04
.I id
Packit 7cfc04
argument is ignored.
Packit 7cfc04
.TP
Packit 7cfc04
.B Q_XQUOTARM
Packit 7cfc04
Free the disk space taken by disk quotas. The
Packit 7cfc04
.I addr
Packit 7cfc04
argument should be a pointer to an
Packit 7cfc04
.I "unsigned int"
Packit 7cfc04
value containing flags (the same as in
Packit 7cfc04
.I d_flags
Packit 7cfc04
field of
Packit 7cfc04
.I fs_disk_quota
Packit 7cfc04
structure) which identify what types of quota should be removed
Packit 7cfc04
(note that the quota type passed in the
Packit 7cfc04
.I cmd
Packit 7cfc04
argument is ignored, but should remain valid in order to pass preliminary
Packit 7cfc04
quotactl syscall handler checks).
Packit 7cfc04
.IP
Packit 7cfc04
Quotas must have already been turned off.
Packit 7cfc04
The
Packit 7cfc04
.I id
Packit 7cfc04
argument is ignored.
Packit 7cfc04
.TP
Packit 7cfc04
.BR Q_XQUOTASYNC " (since Linux 2.6.15; no-op since Linux 3.4)"
Packit 7cfc04
.\" Added in commit ee34807a65aa0c5911dc27682863afca780a003e
Packit 7cfc04
This command was an XFS quota equivalent to
Packit 7cfc04
.IR Q_SYNC ,
Packit 7cfc04
but it is no-op since Linux 3.4,
Packit 7cfc04
.\" 4b217ed9e30f94b6e8e5e262020ef0ceab6113af
Packit 7cfc04
as
Packit 7cfc04
.BR sync (1)
Packit 7cfc04
writes quota information to disk now
Packit 7cfc04
(in addition to the other filesystem metadata that it writes out).
Packit 7cfc04
The
Packit 7cfc04
.IR special ", " id " and " addr
Packit 7cfc04
arguments are ignored.
Packit 7cfc04
.SH RETURN VALUE
Packit 7cfc04
.PP
Packit 7cfc04
On success,
Packit 7cfc04
.BR quotactl ()
Packit 7cfc04
returns 0; on error \-1
Packit 7cfc04
is returned, and
Packit 7cfc04
.I errno
Packit 7cfc04
is set to indicate the error.
Packit 7cfc04
.SH ERRORS
Packit 7cfc04
.TP
Packit 7cfc04
.B EACCES
Packit 7cfc04
.I cmd
Packit 7cfc04
is
Packit 7cfc04
.BR Q_QUOTAON ,
Packit 7cfc04
and the quota file pointed to by
Packit 7cfc04
.I addr
Packit 7cfc04
exists, but is not a regular file or
Packit 7cfc04
is not on the filesystem pointed to by
Packit 7cfc04
.IR special .
Packit 7cfc04
.TP
Packit 7cfc04
.B EBUSY
Packit 7cfc04
.I cmd
Packit 7cfc04
is
Packit 7cfc04
.BR Q_QUOTAON ,
Packit 7cfc04
but another
Packit 7cfc04
.B Q_QUOTAON
Packit 7cfc04
had already been performed.
Packit 7cfc04
.TP
Packit 7cfc04
.B EFAULT
Packit 7cfc04
.I addr
Packit 7cfc04
or
Packit 7cfc04
.I special
Packit 7cfc04
is invalid.
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
.I cmd
Packit 7cfc04
or
Packit 7cfc04
.I type
Packit 7cfc04
is invalid.
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
.I cmd
Packit 7cfc04
is
Packit 7cfc04
.BR Q_QUOTAON ,
Packit 7cfc04
but the specified quota file is corrupted.
Packit 7cfc04
.TP
Packit 7cfc04
.B ENOENT
Packit 7cfc04
The file specified by
Packit 7cfc04
.I special
Packit 7cfc04
or
Packit 7cfc04
.I addr
Packit 7cfc04
does not exist.
Packit 7cfc04
.TP
Packit 7cfc04
.B ENOSYS
Packit 7cfc04
The kernel has not been compiled with the
Packit 7cfc04
.B CONFIG_QUOTA
Packit 7cfc04
option.
Packit 7cfc04
.TP
Packit 7cfc04
.B ENOTBLK
Packit 7cfc04
.I special
Packit 7cfc04
is not a block device.
Packit 7cfc04
.TP
Packit 7cfc04
.B EPERM
Packit 7cfc04
The caller lacked the required privilege
Packit 7cfc04
.RB ( CAP_SYS_ADMIN )
Packit 7cfc04
for the specified operation.
Packit 7cfc04
.TP
Packit 7cfc04
.B ERANGE
Packit 7cfc04
.I cmd
Packit 7cfc04
is
Packit 7cfc04
.BR Q_SETQUOTA ,
Packit 7cfc04
but the specified limits are out of the range allowed by the quota format.
Packit 7cfc04
.TP
Packit 7cfc04
.B ESRCH
Packit 7cfc04
No disk quota is found for the indicated user.
Packit 7cfc04
Quotas have not been turned on for this filesystem.
Packit 7cfc04
.TP
Packit 7cfc04
.B ESRCH
Packit 7cfc04
.I cmd
Packit 7cfc04
is
Packit 7cfc04
.BR Q_QUOTAON ,
Packit 7cfc04
but the specified quota format was not found.
Packit 7cfc04
.TP
Packit 7cfc04
.B ESRCH
Packit 7cfc04
.I cmd
Packit 7cfc04
is
Packit 7cfc04
.B Q_GETNEXTQUOTA
Packit 7cfc04
or
Packit 7cfc04
.BR Q_XGETNEXTQUOTA ,
Packit 7cfc04
but there is no ID greater than or equal to
Packit 7cfc04
.IR id
Packit 7cfc04
that has an active quota.
Packit 7cfc04
.SH NOTES
Packit 7cfc04
Instead of
Packit 7cfc04
.I <xfs/xqm.h>
Packit 7cfc04
one can use
Packit 7cfc04
.IR <linux/dqblk_xfs.h> ,
Packit 7cfc04
taking into account that there are several naming discrepancies:
Packit 7cfc04
.IP \(bu 3
Packit 7cfc04
Quota enabling flags (of format
Packit 7cfc04
.BR XFS_QUOTA_[UGP]DQ_{ACCT,ENFD} )
Packit 7cfc04
are defined without a leading "X", as
Packit 7cfc04
.BR FS_QUOTA_[UGP]DQ_{ACCT,ENFD} .
Packit 7cfc04
.IP \(bu
Packit 7cfc04
The same is true for
Packit 7cfc04
.B XFS_{USER,GROUP,PROJ}_QUOTA
Packit 7cfc04
quota type flags, which are defined as
Packit 7cfc04
.BR FS_{USER,GROUP,PROJ}_QUOTA .
Packit 7cfc04
.IP \(bu
Packit 7cfc04
The
Packit 7cfc04
.I dqblk_xfs.h
Packit 7cfc04
header file defines its own
Packit 7cfc04
.BR XQM_USRQUOTA ,
Packit 7cfc04
.BR XQM_GRPQUOTA ,
Packit 7cfc04
and
Packit 7cfc04
.B XQM_PRJQUOTA
Packit 7cfc04
constants for the available quota types, but their values are the same as for
Packit 7cfc04
constants without the
Packit 7cfc04
.B XQM_
Packit 7cfc04
prefix.
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.BR quota (1),
Packit 7cfc04
.BR getrlimit (2),
Packit 7cfc04
.BR quotacheck (8),
Packit 7cfc04
.BR quotaon (8)
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.