3 * Header file for disk format of new quotafile format
10 #include <sys/types.h>
13 #define V2_DQINFOOFF sizeof(struct v2_disk_dqheader) /* Offset of info header in file */
14 #define V2_DQBLKSIZE_BITS 10
15 #define V2_DQBLKSIZE (1 << V2_DQBLKSIZE_BITS) /* Size of block with quota structures */
16 #define V2_DQTREEOFF 1 /* Offset of tree in file in blocks */
17 #define V2_DQTREEDEPTH 4 /* Depth of quota tree */
18 #define V2_DQSTRINBLK ((V2_DQBLKSIZE - sizeof(struct v2_disk_dqdbheader)) / sizeof(struct v2_disk_dqblk)) /* Number of entries in one blocks */
19 #define V2_GETIDINDEX(id, depth) (((id) >> ((V2_DQTREEDEPTH-(depth)-1)*8)) & 0xff)
20 #define V2_GETENTRIES(buf) ((struct v2_disk_dqblk *)(((char *)(buf)) + sizeof(struct v2_disk_dqdbheader)))
21 #define INIT_V2_VERSIONS { 0, 0}
23 struct v2_disk_dqheader {
24 u_int32_t dqh_magic; /* Magic number identifying file */
25 u_int32_t dqh_version; /* File version */
26 } __attribute__ ((packed));
28 /* Flags for version specific files */
29 #define V2_DQF_MASK 0x0000 /* Mask for all valid ondisk flags */
31 /* Header with type and version specific information */
32 struct v2_disk_dqinfo {
33 u_int32_t dqi_bgrace; /* Time before block soft limit becomes hard limit */
34 u_int32_t dqi_igrace; /* Time before inode soft limit becomes hard limit */
35 u_int32_t dqi_flags; /* Flags for quotafile (DQF_*) */
36 u_int32_t dqi_blocks; /* Number of blocks in file */
37 u_int32_t dqi_free_blk; /* Number of first free block in the list */
38 u_int32_t dqi_free_entry; /* Number of block with at least one free entry */
39 } __attribute__ ((packed));
42 * Structure of header of block with quota structures. It is padded to 16 bytes so
43 * there will be space for exactly 18 quota-entries in a block
45 struct v2_disk_dqdbheader {
46 u_int32_t dqdh_next_free; /* Number of next block with free entry */
47 u_int32_t dqdh_prev_free; /* Number of previous block with free entry */
48 u_int16_t dqdh_entries; /* Number of valid entries in block */
51 } __attribute__ ((packed));
53 /* Structure of quota for one user on disk */
54 struct v2_disk_dqblk {
55 u_int32_t dqb_id; /* id this quota applies to */
56 u_int32_t dqb_ihardlimit; /* absolute limit on allocated inodes */
57 u_int32_t dqb_isoftlimit; /* preferred inode limit */
58 u_int32_t dqb_curinodes; /* current # allocated inodes */
59 u_int32_t dqb_bhardlimit; /* absolute limit on disk space (in QUOTABLOCK_SIZE) */
60 u_int32_t dqb_bsoftlimit; /* preferred limit on disk space (in QUOTABLOCK_SIZE) */
61 u_int64_t dqb_curspace; /* current space occupied (in bytes) */
62 u_int64_t dqb_btime; /* time limit for excessive disk use */
63 u_int64_t dqb_itime; /* time limit for excessive inode use */
64 } __attribute__ ((packed));
66 /* Structure of quota for communication with kernel */
67 struct v2_kern_dqblk {
68 unsigned int dqb_ihardlimit;
69 unsigned int dqb_isoftlimit;
70 unsigned int dqb_curinodes;
71 unsigned int dqb_bhardlimit;
72 unsigned int dqb_bsoftlimit;
78 /* Structure of quotafile info for communication with kernel */
79 struct v2_kern_dqinfo {
80 unsigned int dqi_bgrace;
81 unsigned int dqi_igrace;
82 unsigned int dqi_flags;
83 unsigned int dqi_blocks;
84 unsigned int dqi_free_blk;
85 unsigned int dqi_free_entry;
88 /* Structure with gathered statistics from kernel */
95 u_int32_t allocated_dquots;
96 u_int32_t free_dquots;