Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (c) 1982, 1986 Regents of the University of California.
0003  * All rights reserved.
0004  *
0005  * This code is derived from software contributed to Berkeley by
0006  * Robert Elz at The University of Melbourne.
0007  *
0008  * Redistribution and use in source and binary forms, with or without
0009  * modification, are permitted provided that the following conditions
0010  * are met:
0011  * 1. Redistributions of source code must retain the above copyright
0012  *    notice, this list of conditions and the following disclaimer.
0013  * 2. Redistributions in binary form must reproduce the above copyright
0014  *    notice, this list of conditions and the following disclaimer in the
0015  *    documentation and/or other materials provided with the distribution.
0016  * 3. Neither the name of the University nor the names of its contributors
0017  *    may be used to endorse or promote products derived from this software
0018  *    without specific prior written permission.
0019  *
0020  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
0021  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0022  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0023  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
0024  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0025  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
0026  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0027  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0028  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
0029  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0030  * SUCH DAMAGE.
0031  */
0032 
0033 #ifndef _UAPI_LINUX_QUOTA_
0034 #define _UAPI_LINUX_QUOTA_
0035 
0036 #include <linux/types.h>
0037 
0038 #define __DQUOT_VERSION__   "dquot_6.6.0"
0039 
0040 #define MAXQUOTAS 3
0041 #define USRQUOTA  0     /* element used for user quotas */
0042 #define GRPQUOTA  1     /* element used for group quotas */
0043 #define PRJQUOTA  2     /* element used for project quotas */
0044 
0045 /*
0046  * Definitions for the default names of the quotas files.
0047  */
0048 #define INITQFNAMES { \
0049     "user",    /* USRQUOTA */ \
0050     "group",   /* GRPQUOTA */ \
0051     "project", /* PRJQUOTA */ \
0052     "undefined", \
0053 };
0054 
0055 /*
0056  * Command definitions for the 'quotactl' system call.
0057  * The commands are broken into a main command defined below
0058  * and a subcommand that is used to convey the type of
0059  * quota that is being manipulated (see above).
0060  */
0061 #define SUBCMDMASK  0x00ff
0062 #define SUBCMDSHIFT 8
0063 #define QCMD(cmd, type)  (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
0064 
0065 #define Q_SYNC     0x800001 /* sync disk copy of a filesystems quotas */
0066 #define Q_QUOTAON  0x800002 /* turn quotas on */
0067 #define Q_QUOTAOFF 0x800003 /* turn quotas off */
0068 #define Q_GETFMT   0x800004 /* get quota format used on given filesystem */
0069 #define Q_GETINFO  0x800005 /* get information about quota files */
0070 #define Q_SETINFO  0x800006 /* set information about quota files */
0071 #define Q_GETQUOTA 0x800007 /* get user quota structure */
0072 #define Q_SETQUOTA 0x800008 /* set user quota structure */
0073 #define Q_GETNEXTQUOTA 0x800009 /* get disk limits and usage >= ID */
0074 
0075 /* Quota format type IDs */
0076 #define QFMT_VFS_OLD 1
0077 #define QFMT_VFS_V0 2
0078 #define QFMT_OCFS2 3
0079 #define QFMT_VFS_V1 4
0080 
0081 /* Size of block in which space limits are passed through the quota
0082  * interface */
0083 #define QIF_DQBLKSIZE_BITS 10
0084 #define QIF_DQBLKSIZE (1 << QIF_DQBLKSIZE_BITS)
0085 
0086 /*
0087  * Quota structure used for communication with userspace via quotactl
0088  * Following flags are used to specify which fields are valid
0089  */
0090 enum {
0091     QIF_BLIMITS_B = 0,
0092     QIF_SPACE_B,
0093     QIF_ILIMITS_B,
0094     QIF_INODES_B,
0095     QIF_BTIME_B,
0096     QIF_ITIME_B,
0097 };
0098 
0099 #define QIF_BLIMITS (1 << QIF_BLIMITS_B)
0100 #define QIF_SPACE   (1 << QIF_SPACE_B)
0101 #define QIF_ILIMITS (1 << QIF_ILIMITS_B)
0102 #define QIF_INODES  (1 << QIF_INODES_B)
0103 #define QIF_BTIME   (1 << QIF_BTIME_B)
0104 #define QIF_ITIME   (1 << QIF_ITIME_B)
0105 #define QIF_LIMITS  (QIF_BLIMITS | QIF_ILIMITS)
0106 #define QIF_USAGE   (QIF_SPACE | QIF_INODES)
0107 #define QIF_TIMES   (QIF_BTIME | QIF_ITIME)
0108 #define QIF_ALL     (QIF_LIMITS | QIF_USAGE | QIF_TIMES)
0109 
0110 struct if_dqblk {
0111     __u64 dqb_bhardlimit;
0112     __u64 dqb_bsoftlimit;
0113     __u64 dqb_curspace;
0114     __u64 dqb_ihardlimit;
0115     __u64 dqb_isoftlimit;
0116     __u64 dqb_curinodes;
0117     __u64 dqb_btime;
0118     __u64 dqb_itime;
0119     __u32 dqb_valid;
0120 };
0121 
0122 struct if_nextdqblk {
0123     __u64 dqb_bhardlimit;
0124     __u64 dqb_bsoftlimit;
0125     __u64 dqb_curspace;
0126     __u64 dqb_ihardlimit;
0127     __u64 dqb_isoftlimit;
0128     __u64 dqb_curinodes;
0129     __u64 dqb_btime;
0130     __u64 dqb_itime;
0131     __u32 dqb_valid;
0132     __u32 dqb_id;
0133 };
0134 
0135 /*
0136  * Structure used for setting quota information about file via quotactl
0137  * Following flags are used to specify which fields are valid
0138  */
0139 #define IIF_BGRACE  1
0140 #define IIF_IGRACE  2
0141 #define IIF_FLAGS   4
0142 #define IIF_ALL     (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
0143 
0144 enum {
0145     DQF_ROOT_SQUASH_B = 0,
0146     DQF_SYS_FILE_B = 16,
0147     /* Kernel internal flags invisible to userspace */
0148     DQF_PRIVATE
0149 };
0150 
0151 /* Root squash enabled (for v1 quota format) */
0152 #define DQF_ROOT_SQUASH (1 << DQF_ROOT_SQUASH_B)
0153 /* Quota stored in a system file */
0154 #define DQF_SYS_FILE    (1 << DQF_SYS_FILE_B)
0155 
0156 struct if_dqinfo {
0157     __u64 dqi_bgrace;
0158     __u64 dqi_igrace;
0159     __u32 dqi_flags;    /* DFQ_* */
0160     __u32 dqi_valid;
0161 };
0162 
0163 /*
0164  * Definitions for quota netlink interface
0165  */
0166 #define QUOTA_NL_NOWARN 0
0167 #define QUOTA_NL_IHARDWARN 1        /* Inode hardlimit reached */
0168 #define QUOTA_NL_ISOFTLONGWARN 2    /* Inode grace time expired */
0169 #define QUOTA_NL_ISOFTWARN 3        /* Inode softlimit reached */
0170 #define QUOTA_NL_BHARDWARN 4        /* Block hardlimit reached */
0171 #define QUOTA_NL_BSOFTLONGWARN 5    /* Block grace time expired */
0172 #define QUOTA_NL_BSOFTWARN 6        /* Block softlimit reached */
0173 #define QUOTA_NL_IHARDBELOW 7       /* Usage got below inode hardlimit */
0174 #define QUOTA_NL_ISOFTBELOW 8       /* Usage got below inode softlimit */
0175 #define QUOTA_NL_BHARDBELOW 9       /* Usage got below block hardlimit */
0176 #define QUOTA_NL_BSOFTBELOW 10      /* Usage got below block softlimit */
0177 
0178 enum {
0179     QUOTA_NL_C_UNSPEC,
0180     QUOTA_NL_C_WARNING,
0181     __QUOTA_NL_C_MAX,
0182 };
0183 #define QUOTA_NL_C_MAX (__QUOTA_NL_C_MAX - 1)
0184 
0185 enum {
0186     QUOTA_NL_A_UNSPEC,
0187     QUOTA_NL_A_QTYPE,
0188     QUOTA_NL_A_EXCESS_ID,
0189     QUOTA_NL_A_WARNING,
0190     QUOTA_NL_A_DEV_MAJOR,
0191     QUOTA_NL_A_DEV_MINOR,
0192     QUOTA_NL_A_CAUSED_ID,
0193     QUOTA_NL_A_PAD,
0194     __QUOTA_NL_A_MAX,
0195 };
0196 #define QUOTA_NL_A_MAX (__QUOTA_NL_A_MAX - 1)
0197 
0198 
0199 #endif /* _UAPI_LINUX_QUOTA_ */