1
2
3
4
5
6 #ifndef __XFS_QUOTA_DEFS_H__
7 #define __XFS_QUOTA_DEFS_H__
8
9
10
11
12
13
14
15
16
17
18 typedef uint64_t xfs_qcnt_t;
19 typedef uint16_t xfs_qwarncnt_t;
20
21
22
23
24 #define XFS_DQ_USER 0x0001
25 #define XFS_DQ_PROJ 0x0002
26 #define XFS_DQ_GROUP 0x0004
27 #define XFS_DQ_DIRTY 0x0008
28 #define XFS_DQ_FREEING 0x0010
29
30 #define XFS_DQ_ALLTYPES (XFS_DQ_USER|XFS_DQ_PROJ|XFS_DQ_GROUP)
31
32 #define XFS_DQ_FLAGS \
33 { XFS_DQ_USER, "USER" }, \
34 { XFS_DQ_PROJ, "PROJ" }, \
35 { XFS_DQ_GROUP, "GROUP" }, \
36 { XFS_DQ_DIRTY, "DIRTY" }, \
37 { XFS_DQ_FREEING, "FREEING" }
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60 #define XFS_DQUOT_LOGRES(mp) \
61 ((sizeof(struct xfs_dq_logformat) + sizeof(struct xfs_disk_dquot)) * 6)
62
63 #define XFS_IS_QUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_ALL_QUOTA_ACCT)
64 #define XFS_IS_UQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_UQUOTA_ACCT)
65 #define XFS_IS_PQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_PQUOTA_ACCT)
66 #define XFS_IS_GQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_GQUOTA_ACCT)
67 #define XFS_IS_UQUOTA_ENFORCED(mp) ((mp)->m_qflags & XFS_UQUOTA_ENFD)
68 #define XFS_IS_GQUOTA_ENFORCED(mp) ((mp)->m_qflags & XFS_GQUOTA_ENFD)
69 #define XFS_IS_PQUOTA_ENFORCED(mp) ((mp)->m_qflags & XFS_PQUOTA_ENFD)
70
71
72
73
74
75
76 #define XFS_UQUOTA_ACTIVE 0x1000
77 #define XFS_GQUOTA_ACTIVE 0x2000
78 #define XFS_PQUOTA_ACTIVE 0x4000
79 #define XFS_ALL_QUOTA_ACTIVE \
80 (XFS_UQUOTA_ACTIVE | XFS_GQUOTA_ACTIVE | XFS_PQUOTA_ACTIVE)
81
82
83
84
85
86 #define XFS_IS_QUOTA_ON(mp) ((mp)->m_qflags & (XFS_UQUOTA_ACTIVE | \
87 XFS_GQUOTA_ACTIVE | \
88 XFS_PQUOTA_ACTIVE))
89 #define XFS_IS_UQUOTA_ON(mp) ((mp)->m_qflags & XFS_UQUOTA_ACTIVE)
90 #define XFS_IS_GQUOTA_ON(mp) ((mp)->m_qflags & XFS_GQUOTA_ACTIVE)
91 #define XFS_IS_PQUOTA_ON(mp) ((mp)->m_qflags & XFS_PQUOTA_ACTIVE)
92
93
94
95
96
97
98 #define XFS_QMOPT_UQUOTA 0x0000004
99 #define XFS_QMOPT_PQUOTA 0x0000008
100 #define XFS_QMOPT_FORCE_RES 0x0000010
101 #define XFS_QMOPT_SBVERSION 0x0000040
102 #define XFS_QMOPT_GQUOTA 0x0002000
103 #define XFS_QMOPT_ENOSPC 0x0004000
104
105
106
107
108
109 #define XFS_QMOPT_RES_REGBLKS 0x0010000
110 #define XFS_QMOPT_RES_RTBLKS 0x0020000
111 #define XFS_QMOPT_BCOUNT 0x0040000
112 #define XFS_QMOPT_ICOUNT 0x0080000
113 #define XFS_QMOPT_RTBCOUNT 0x0100000
114 #define XFS_QMOPT_DELBCOUNT 0x0200000
115 #define XFS_QMOPT_DELRTBCOUNT 0x0400000
116 #define XFS_QMOPT_RES_INOS 0x0800000
117
118
119
120
121 #define XFS_QMOPT_INHERIT 0x1000000
122
123
124
125
126 #define XFS_TRANS_DQ_RES_BLKS XFS_QMOPT_RES_REGBLKS
127 #define XFS_TRANS_DQ_RES_RTBLKS XFS_QMOPT_RES_RTBLKS
128 #define XFS_TRANS_DQ_RES_INOS XFS_QMOPT_RES_INOS
129 #define XFS_TRANS_DQ_BCOUNT XFS_QMOPT_BCOUNT
130 #define XFS_TRANS_DQ_DELBCOUNT XFS_QMOPT_DELBCOUNT
131 #define XFS_TRANS_DQ_ICOUNT XFS_QMOPT_ICOUNT
132 #define XFS_TRANS_DQ_RTBCOUNT XFS_QMOPT_RTBCOUNT
133 #define XFS_TRANS_DQ_DELRTBCOUNT XFS_QMOPT_DELRTBCOUNT
134
135
136 #define XFS_QMOPT_QUOTALL \
137 (XFS_QMOPT_UQUOTA | XFS_QMOPT_PQUOTA | XFS_QMOPT_GQUOTA)
138 #define XFS_QMOPT_RESBLK_MASK (XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_RES_RTBLKS)
139
140 extern xfs_failaddr_t xfs_dquot_verify(struct xfs_mount *mp,
141 struct xfs_disk_dquot *ddq, xfs_dqid_t id, uint type);
142 extern xfs_failaddr_t xfs_dqblk_verify(struct xfs_mount *mp,
143 struct xfs_dqblk *dqb, xfs_dqid_t id, uint type);
144 extern int xfs_calc_dquots_per_chunk(unsigned int nbblks);
145 extern void xfs_dqblk_repair(struct xfs_mount *mp, struct xfs_dqblk *dqb,
146 xfs_dqid_t id, uint type);
147
148 #endif