• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _SYS_QUOTA_H
2 #define _SYS_QUOTA_H
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 #include <stdint.h>
9 
10 #define _LINUX_QUOTA_VERSION 2
11 
12 #define dbtob(num) ((num) << 10)
13 #define btodb(num) ((num) >> 10)
14 #define fs_to_dq_blocks(num, blksize) (((num) * (blksize)) / 1024)
15 
16 #define MAX_IQ_TIME 604800
17 #define MAX_DQ_TIME 604800
18 
19 #define MAXQUOTAS 2
20 #define USRQUOTA  0
21 #define GRPQUOTA  1
22 
23 #define INITQFNAMES { "user", "group", "undefined" };
24 
25 #define QUOTAFILENAME "quota"
26 #define QUOTAGROUP "staff"
27 
28 #define NR_DQHASH 43
29 #define NR_DQUOTS 256
30 
31 #define SUBCMDMASK       0x00ff
32 #define SUBCMDSHIFT      8
33 #define QCMD(cmd, type)  (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
34 
35 #define Q_SYNC     0x800001
36 #define Q_QUOTAON  0x800002
37 #define Q_QUOTAOFF 0x800003
38 #define Q_GETFMT   0x800004
39 #define Q_GETINFO  0x800005
40 #define Q_SETINFO  0x800006
41 #define Q_GETQUOTA 0x800007
42 #define Q_SETQUOTA 0x800008
43 
44 #define	QFMT_VFS_OLD 1
45 #define	QFMT_VFS_V0 2
46 #define QFMT_OCFS2 3
47 #define	QFMT_VFS_V1 4
48 
49 #define QIF_BLIMITS	1
50 #define QIF_SPACE	2
51 #define QIF_ILIMITS	4
52 #define QIF_INODES	8
53 #define QIF_BTIME	16
54 #define QIF_ITIME	32
55 #define QIF_LIMITS	(QIF_BLIMITS | QIF_ILIMITS)
56 #define QIF_USAGE	(QIF_SPACE | QIF_INODES)
57 #define QIF_TIMES	(QIF_BTIME | QIF_ITIME)
58 #define QIF_ALL		(QIF_LIMITS | QIF_USAGE | QIF_TIMES)
59 
60 struct dqblk {
61 	uint64_t dqb_bhardlimit;
62 	uint64_t dqb_bsoftlimit;
63 	uint64_t dqb_curspace;
64 	uint64_t dqb_ihardlimit;
65 	uint64_t dqb_isoftlimit;
66 	uint64_t dqb_curinodes;
67 	uint64_t dqb_btime;
68 	uint64_t dqb_itime;
69 	uint32_t dqb_valid;
70 };
71 
72 #define	dq_bhardlimit	dq_dqb.dqb_bhardlimit
73 #define	dq_bsoftlimit	dq_dqb.dqb_bsoftlimit
74 #define dq_curspace	dq_dqb.dqb_curspace
75 #define dq_valid	dq_dqb.dqb_valid
76 #define	dq_ihardlimit	dq_dqb.dqb_ihardlimit
77 #define	dq_isoftlimit	dq_dqb.dqb_isoftlimit
78 #define	dq_curinodes	dq_dqb.dqb_curinodes
79 #define	dq_btime	dq_dqb.dqb_btime
80 #define	dq_itime	dq_dqb.dqb_itime
81 
82 #define dqoff(UID)      ((long long)(UID) * sizeof (struct dqblk))
83 
84 #define IIF_BGRACE	1
85 #define IIF_IGRACE	2
86 #define IIF_FLAGS	4
87 #define IIF_ALL		(IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
88 
89 struct dqinfo {
90 	uint64_t dqi_bgrace;
91 	uint64_t dqi_igrace;
92 	uint32_t dqi_flags;
93 	uint32_t dqi_valid;
94 };
95 
96 int quotactl(int, const char *, int, char *);
97 
98 #ifdef __cplusplus
99 }
100 #endif
101 
102 #endif
103