]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - include/xqm.h
Keep packaging scripts in sync across all of the packages were maintaining here
[thirdparty/xfsprogs-dev.git] / include / xqm.h
CommitLineData
2bd0ea18 1/*
546bedf4
NS
2 * Copyright (c) 1995, 2001, 2004, 2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
2bd0ea18
NS
4 *
5 * This program is free software; you can redistribute it and/or modify it
cdafca58
NS
6 * under the terms of version 2.1 of the GNU Lesser General Public License
7 * as published by the Free Software Foundation.
2bd0ea18
NS
8 *
9 * This program is distributed in the hope that it would be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 *
13 * Further, this software is distributed without any warranty that it is
14 * free of the rightful claim of any third person regarding infringement
15 * or the like. Any license provided herein, whether implied or
16 * otherwise, applies only to this software file. Patent licenses, if
17 * any, provided herein do not apply to combinations of this program with
18 * other software, or any other product whatsoever.
19 *
cdafca58
NS
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this program; if not, write the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307,
23 * USA.
2bd0ea18
NS
24 *
25 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
26 * Mountain View, CA 94043, or:
27 *
28 * http://www.sgi.com
29 *
30 * For further information regarding this notice, see:
31 *
32 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
33 */
53f8ad6d
NS
34#ifndef __XQM_H__
35#define __XQM_H__
2bd0ea18 36
1bdd986b 37#include <xfs/xfs.h>
2bd0ea18
NS
38
39/*
275ae71f 40 * Disk quota - quotactl(2) commands for the XFS Quota Manager (XQM).
2bd0ea18 41 */
275ae71f 42
e242fec8 43#define XQM_CMD(x) (('X'<<8)+(x)) /* note: forms first QCMD argument */
20db5fec
NS
44#define Q_XQUOTAON XQM_CMD(1) /* enable accounting/enforcement */
45#define Q_XQUOTAOFF XQM_CMD(2) /* disable accounting/enforcement */
46#define Q_XGETQUOTA XQM_CMD(3) /* get disk limits and usage */
47#define Q_XSETQLIM XQM_CMD(4) /* set disk limits */
48#define Q_XGETQSTAT XQM_CMD(5) /* get quota subsystem status */
49#define Q_XQUOTARM XQM_CMD(6) /* free disk space used by dquots */
546bedf4 50#define Q_XQUOTASYNC XQM_CMD(7) /* delalloc flush, updates dquots */
2bd0ea18
NS
51
52/*
53 * fs_disk_quota structure:
54 *
55 * This contains the current quota information regarding a user/proj/group.
56 * It is 64-bit aligned, and all the blk units are in BBs (Basic Blocks) of
57 * 512 bytes.
58 */
59#define FS_DQUOT_VERSION 1 /* fs_disk_quota.d_version */
60typedef struct fs_disk_quota {
61 __s8 d_version; /* version of this structure */
62 __s8 d_flags; /* XFS_{USER,PROJ,GROUP}_QUOTA */
63 __u16 d_fieldmask; /* field specifier */
64 __u32 d_id; /* user, project, or group ID */
65 __u64 d_blk_hardlimit;/* absolute limit on disk blks */
66 __u64 d_blk_softlimit;/* preferred limit on disk blks */
67 __u64 d_ino_hardlimit;/* maximum # allocated inodes */
68 __u64 d_ino_softlimit;/* preferred inode limit */
69 __u64 d_bcount; /* # disk blocks owned by the user */
70 __u64 d_icount; /* # inodes owned by the user */
71 __s32 d_itimer; /* zero if within inode limits */
72 /* if not, we refuse service */
73 __s32 d_btimer; /* similar to above; for disk blocks */
546bedf4
NS
74 __u16 d_iwarns; /* # warnings issued wrt num inodes */
75 __u16 d_bwarns; /* # warnings issued wrt disk blocks */
2bd0ea18
NS
76 __s32 d_padding2; /* padding2 - for future use */
77 __u64 d_rtb_hardlimit;/* absolute limit on realtime blks */
78 __u64 d_rtb_softlimit;/* preferred limit on RT disk blks */
79 __u64 d_rtbcount; /* # realtime blocks owned */
80 __s32 d_rtbtimer; /* similar to above; for RT disk blks */
546bedf4
NS
81 __u16 d_rtbwarns; /* # warnings issued wrt RT disk blks */
82 __s16 d_padding3; /* padding3 - for future use */
2bd0ea18
NS
83 char d_padding4[8]; /* yet more padding */
84} fs_disk_quota_t;
85
86/*
87 * These fields are sent to Q_XSETQLIM to specify fields that need to change.
88 */
89#define FS_DQ_ISOFT (1<<0)
90#define FS_DQ_IHARD (1<<1)
91#define FS_DQ_BSOFT (1<<2)
546bedf4 92#define FS_DQ_BHARD (1<<3)
2bd0ea18
NS
93#define FS_DQ_RTBSOFT (1<<4)
94#define FS_DQ_RTBHARD (1<<5)
95#define FS_DQ_LIMIT_MASK (FS_DQ_ISOFT | FS_DQ_IHARD | FS_DQ_BSOFT | \
96 FS_DQ_BHARD | FS_DQ_RTBSOFT | FS_DQ_RTBHARD)
97/*
98 * These timers can only be set in super user's dquot. For others, timers are
99 * automatically started and stopped. Superusers timer values set the limits
100 * for the rest. In case these values are zero, the DQ_{F,B}TIMELIMIT values
546bedf4 101 * defined below are used.
2bd0ea18
NS
102 * These values also apply only to the d_fieldmask field for Q_XSETQLIM.
103 */
104#define FS_DQ_BTIMER (1<<6)
105#define FS_DQ_ITIMER (1<<7)
546bedf4 106#define FS_DQ_RTBTIMER (1<<8)
2bd0ea18
NS
107#define FS_DQ_TIMER_MASK (FS_DQ_BTIMER | FS_DQ_ITIMER | FS_DQ_RTBTIMER)
108
109/*
20db5fec
NS
110 * Warning counts are set in both super user's dquot and others. For others,
111 * warnings are set/cleared by the administrators (or automatically by going
112 * below the soft limit). Superusers warning values set the warning limits
113 * for the rest. In case these values are zero, the DQ_{F,B}WARNLIMIT values
114 * defined below are used.
115 * These values also apply only to the d_fieldmask field for Q_XSETQLIM.
2bd0ea18 116 */
20db5fec
NS
117#define FS_DQ_BWARNS (1<<9)
118#define FS_DQ_IWARNS (1<<10)
119#define FS_DQ_RTBWARNS (1<<11)
120#define FS_DQ_WARNS_MASK (FS_DQ_BWARNS | FS_DQ_IWARNS | FS_DQ_RTBWARNS)
2bd0ea18
NS
121
122/*
123 * Various flags related to quotactl(2). Only relevant to XFS filesystems.
124 */
125#define XFS_QUOTA_UDQ_ACCT (1<<0) /* user quota accounting */
126#define XFS_QUOTA_UDQ_ENFD (1<<1) /* user quota limits enforcement */
b36eef04
NS
127#define XFS_QUOTA_GDQ_ACCT (1<<2) /* group quota accounting */
128#define XFS_QUOTA_GDQ_ENFD (1<<3) /* group quota limits enforcement */
1bdd986b
NS
129#define XFS_QUOTA_PDQ_ACCT (1<<4) /* project quota accounting */
130#define XFS_QUOTA_PDQ_ENFD (1<<5) /* project quota limits enforcement */
2bd0ea18
NS
131
132#define XFS_USER_QUOTA (1<<0) /* user quota type */
20db5fec 133#define XFS_PROJ_QUOTA (1<<1) /* project quota type */
2bd0ea18
NS
134#define XFS_GROUP_QUOTA (1<<2) /* group quota type */
135
136/*
137 * fs_quota_stat is the struct returned in Q_XGETQSTAT for a given file system.
138 * Provides a centralized way to get meta infomation about the quota subsystem.
b36eef04 139 * eg. space taken up for user and group quotas, number of dquots currently
2bd0ea18
NS
140 * incore.
141 */
142#define FS_QSTAT_VERSION 1 /* fs_quota_stat.qs_version */
143
144/*
145 * Some basic infomation about 'quota files'.
146 */
147typedef struct fs_qfilestat {
148 __u64 qfs_ino; /* inode number */
149 __u64 qfs_nblks; /* number of BBs 512-byte-blks */
150 __u32 qfs_nextents; /* number of extents */
151} fs_qfilestat_t;
152
153typedef struct fs_quota_stat {
154 __s8 qs_version; /* version number for future changes */
155 __u16 qs_flags; /* XFS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */
156 __s8 qs_pad; /* unused */
157 fs_qfilestat_t qs_uquota; /* user quota storage information */
b36eef04 158 fs_qfilestat_t qs_gquota; /* group quota storage information */
2bd0ea18 159 __u32 qs_incoredqs; /* number of dquots incore */
546bedf4
NS
160 __s32 qs_btimelimit; /* limit for blks timer */
161 __s32 qs_itimelimit; /* limit for inodes timer */
162 __s32 qs_rtbtimelimit;/* limit for rt blks timer */
2bd0ea18
NS
163 __u16 qs_bwarnlimit; /* limit for num warnings */
164 __u16 qs_iwarnlimit; /* limit for num warnings */
165} fs_quota_stat_t;
166
53f8ad6d 167#endif /* __XQM_H__ */