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