]>
Commit | Line | Data |
---|---|---|
959ef981 | 1 | // SPDX-License-Identifier: LGPL-2.1 |
2bd0ea18 | 2 | /* |
f302e9e4 | 3 | * Copyright (c) 1995, 2001, 2004-2005 Silicon Graphics, Inc. |
546bedf4 | 4 | * All Rights Reserved. |
2bd0ea18 | 5 | */ |
53f8ad6d NS |
6 | #ifndef __XQM_H__ |
7 | #define __XQM_H__ | |
2bd0ea18 | 8 | |
f8d94331 | 9 | #include <xfs/xfs.h> |
2bd0ea18 NS |
10 | |
11 | /* | |
275ae71f | 12 | * Disk quota - quotactl(2) commands for the XFS Quota Manager (XQM). |
2bd0ea18 | 13 | */ |
275ae71f | 14 | |
e242fec8 | 15 | #define XQM_CMD(x) (('X'<<8)+(x)) /* note: forms first QCMD argument */ |
20db5fec NS |
16 | #define Q_XQUOTAON XQM_CMD(1) /* enable accounting/enforcement */ |
17 | #define Q_XQUOTAOFF XQM_CMD(2) /* disable accounting/enforcement */ | |
18 | #define Q_XGETQUOTA XQM_CMD(3) /* get disk limits and usage */ | |
19 | #define Q_XSETQLIM XQM_CMD(4) /* set disk limits */ | |
20 | #define Q_XGETQSTAT XQM_CMD(5) /* get quota subsystem status */ | |
21 | #define Q_XQUOTARM XQM_CMD(6) /* free disk space used by dquots */ | |
546bedf4 | 22 | #define Q_XQUOTASYNC XQM_CMD(7) /* delalloc flush, updates dquots */ |
bb92709f | 23 | #define Q_XGETQSTATV XQM_CMD(8) /* newer version of get quota */ |
513fc424 | 24 | #define Q_XGETNEXTQUOTA XQM_CMD(9) /* get disk limits and usage */ |
2bd0ea18 NS |
25 | |
26 | /* | |
27 | * fs_disk_quota structure: | |
28 | * | |
29 | * This contains the current quota information regarding a user/proj/group. | |
30 | * It is 64-bit aligned, and all the blk units are in BBs (Basic Blocks) of | |
31 | * 512 bytes. | |
32 | */ | |
33 | #define FS_DQUOT_VERSION 1 /* fs_disk_quota.d_version */ | |
34 | typedef struct fs_disk_quota { | |
35 | __s8 d_version; /* version of this structure */ | |
36 | __s8 d_flags; /* XFS_{USER,PROJ,GROUP}_QUOTA */ | |
37 | __u16 d_fieldmask; /* field specifier */ | |
38 | __u32 d_id; /* user, project, or group ID */ | |
39 | __u64 d_blk_hardlimit;/* absolute limit on disk blks */ | |
40 | __u64 d_blk_softlimit;/* preferred limit on disk blks */ | |
41 | __u64 d_ino_hardlimit;/* maximum # allocated inodes */ | |
42 | __u64 d_ino_softlimit;/* preferred inode limit */ | |
43 | __u64 d_bcount; /* # disk blocks owned by the user */ | |
44 | __u64 d_icount; /* # inodes owned by the user */ | |
45 | __s32 d_itimer; /* zero if within inode limits */ | |
46 | /* if not, we refuse service */ | |
47 | __s32 d_btimer; /* similar to above; for disk blocks */ | |
feb3d9cd CM |
48 | __u16 d_iwarns; /* # warnings issued wrt num inodes */ |
49 | __u16 d_bwarns; /* # warnings issued wrt disk blocks */ | |
2bd0ea18 NS |
50 | __s32 d_padding2; /* padding2 - for future use */ |
51 | __u64 d_rtb_hardlimit;/* absolute limit on realtime blks */ | |
52 | __u64 d_rtb_softlimit;/* preferred limit on RT disk blks */ | |
53 | __u64 d_rtbcount; /* # realtime blocks owned */ | |
54 | __s32 d_rtbtimer; /* similar to above; for RT disk blks */ | |
feb3d9cd | 55 | __u16 d_rtbwarns; /* # warnings issued wrt RT disk blks */ |
f302e9e4 | 56 | __s16 d_padding3; /* padding3 - for future use */ |
2bd0ea18 NS |
57 | char d_padding4[8]; /* yet more padding */ |
58 | } fs_disk_quota_t; | |
59 | ||
60 | /* | |
61 | * These fields are sent to Q_XSETQLIM to specify fields that need to change. | |
62 | */ | |
63 | #define FS_DQ_ISOFT (1<<0) | |
64 | #define FS_DQ_IHARD (1<<1) | |
65 | #define FS_DQ_BSOFT (1<<2) | |
feb3d9cd | 66 | #define FS_DQ_BHARD (1<<3) |
2bd0ea18 NS |
67 | #define FS_DQ_RTBSOFT (1<<4) |
68 | #define FS_DQ_RTBHARD (1<<5) | |
69 | #define FS_DQ_LIMIT_MASK (FS_DQ_ISOFT | FS_DQ_IHARD | FS_DQ_BSOFT | \ | |
70 | FS_DQ_BHARD | FS_DQ_RTBSOFT | FS_DQ_RTBHARD) | |
71 | /* | |
72 | * These timers can only be set in super user's dquot. For others, timers are | |
73 | * automatically started and stopped. Superusers timer values set the limits | |
74 | * for the rest. In case these values are zero, the DQ_{F,B}TIMELIMIT values | |
f302e9e4 | 75 | * defined below are used. |
2bd0ea18 NS |
76 | * These values also apply only to the d_fieldmask field for Q_XSETQLIM. |
77 | */ | |
78 | #define FS_DQ_BTIMER (1<<6) | |
79 | #define FS_DQ_ITIMER (1<<7) | |
feb3d9cd | 80 | #define FS_DQ_RTBTIMER (1<<8) |
2bd0ea18 NS |
81 | #define FS_DQ_TIMER_MASK (FS_DQ_BTIMER | FS_DQ_ITIMER | FS_DQ_RTBTIMER) |
82 | ||
83 | /* | |
20db5fec NS |
84 | * Warning counts are set in both super user's dquot and others. For others, |
85 | * warnings are set/cleared by the administrators (or automatically by going | |
86 | * below the soft limit). Superusers warning values set the warning limits | |
87 | * for the rest. In case these values are zero, the DQ_{F,B}WARNLIMIT values | |
f302e9e4 | 88 | * defined below are used. |
20db5fec | 89 | * These values also apply only to the d_fieldmask field for Q_XSETQLIM. |
2bd0ea18 | 90 | */ |
20db5fec NS |
91 | #define FS_DQ_BWARNS (1<<9) |
92 | #define FS_DQ_IWARNS (1<<10) | |
93 | #define FS_DQ_RTBWARNS (1<<11) | |
94 | #define FS_DQ_WARNS_MASK (FS_DQ_BWARNS | FS_DQ_IWARNS | FS_DQ_RTBWARNS) | |
2bd0ea18 NS |
95 | |
96 | /* | |
97 | * Various flags related to quotactl(2). Only relevant to XFS filesystems. | |
98 | */ | |
99 | #define XFS_QUOTA_UDQ_ACCT (1<<0) /* user quota accounting */ | |
100 | #define XFS_QUOTA_UDQ_ENFD (1<<1) /* user quota limits enforcement */ | |
b36eef04 NS |
101 | #define XFS_QUOTA_GDQ_ACCT (1<<2) /* group quota accounting */ |
102 | #define XFS_QUOTA_GDQ_ENFD (1<<3) /* group quota limits enforcement */ | |
1bdd986b NS |
103 | #define XFS_QUOTA_PDQ_ACCT (1<<4) /* project quota accounting */ |
104 | #define XFS_QUOTA_PDQ_ENFD (1<<5) /* project quota limits enforcement */ | |
2bd0ea18 NS |
105 | |
106 | #define XFS_USER_QUOTA (1<<0) /* user quota type */ | |
20db5fec | 107 | #define XFS_PROJ_QUOTA (1<<1) /* project quota type */ |
2bd0ea18 NS |
108 | #define XFS_GROUP_QUOTA (1<<2) /* group quota type */ |
109 | ||
110 | /* | |
111 | * fs_quota_stat is the struct returned in Q_XGETQSTAT for a given file system. | |
ff1f79a7 | 112 | * Provides a centralized way to get meta information about the quota subsystem. |
b36eef04 | 113 | * eg. space taken up for user and group quotas, number of dquots currently |
2bd0ea18 NS |
114 | * incore. |
115 | */ | |
116 | #define FS_QSTAT_VERSION 1 /* fs_quota_stat.qs_version */ | |
117 | ||
118 | /* | |
ff1f79a7 | 119 | * Some basic information about 'quota files'. |
2bd0ea18 NS |
120 | */ |
121 | typedef struct fs_qfilestat { | |
122 | __u64 qfs_ino; /* inode number */ | |
123 | __u64 qfs_nblks; /* number of BBs 512-byte-blks */ | |
124 | __u32 qfs_nextents; /* number of extents */ | |
125 | } fs_qfilestat_t; | |
126 | ||
127 | typedef struct fs_quota_stat { | |
128 | __s8 qs_version; /* version number for future changes */ | |
129 | __u16 qs_flags; /* XFS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */ | |
130 | __s8 qs_pad; /* unused */ | |
131 | fs_qfilestat_t qs_uquota; /* user quota storage information */ | |
b36eef04 | 132 | fs_qfilestat_t qs_gquota; /* group quota storage information */ |
2bd0ea18 | 133 | __u32 qs_incoredqs; /* number of dquots incore */ |
f302e9e4 NS |
134 | __s32 qs_btimelimit; /* limit for blks timer */ |
135 | __s32 qs_itimelimit; /* limit for inodes timer */ | |
136 | __s32 qs_rtbtimelimit;/* limit for rt blks timer */ | |
2bd0ea18 NS |
137 | __u16 qs_bwarnlimit; /* limit for num warnings */ |
138 | __u16 qs_iwarnlimit; /* limit for num warnings */ | |
139 | } fs_quota_stat_t; | |
140 | ||
bb92709f ES |
141 | |
142 | #ifndef FS_QSTATV_VERSION1 | |
143 | #define FS_QSTATV_VERSION1 1 /* fs_quota_statv.qs_version */ | |
144 | #endif | |
145 | ||
146 | /* | |
147 | * Some basic information about 'quota files' for Q_XGETQSTATV command | |
148 | */ | |
149 | struct fs_qfilestatv { | |
150 | __u64 qfs_ino; /* inode number */ | |
151 | __u64 qfs_nblks; /* number of BBs 512-byte-blks */ | |
152 | __u32 qfs_nextents; /* number of extents */ | |
153 | __u32 qfs_pad; /* pad for 8-byte alignment */ | |
154 | }; | |
155 | ||
156 | struct fs_quota_statv { | |
157 | __s8 qs_version; /* version for future changes */ | |
158 | __u8 qs_pad1; /* pad for 16bit alignment */ | |
159 | __u16 qs_flags; /* FS_QUOTA_.* flags */ | |
160 | __u32 qs_incoredqs; /* number of dquots incore */ | |
161 | struct fs_qfilestatv qs_uquota; /* user quota information */ | |
162 | struct fs_qfilestatv qs_gquota; /* group quota information */ | |
163 | struct fs_qfilestatv qs_pquota; /* project quota information */ | |
164 | __s32 qs_btimelimit; /* limit for blks timer */ | |
165 | __s32 qs_itimelimit; /* limit for inodes timer */ | |
166 | __s32 qs_rtbtimelimit;/* limit for rt blks timer */ | |
167 | __u16 qs_bwarnlimit; /* limit for num warnings */ | |
168 | __u16 qs_iwarnlimit; /* limit for num warnings */ | |
169 | __u64 qs_pad2[8]; /* for future proofing */ | |
170 | }; | |
171 | ||
53f8ad6d | 172 | #endif /* __XQM_H__ */ |