• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *
3  * Header file for disk format of new quotafile format
4  *
5  * Copied essential definitions and structures for mkfs.f2fs from quotaio.h
6  *
7  * Aditya Kali <adityakali@google.com>
8  * Jan Kara <jack@suse.cz>
9  * Hyojun Kim <hyojun@google.com> - Ported to f2fs-tools
10  *
11  */
12 #ifndef F2FS_QUOTA_H
13 #define F2FS_QUOTA_H
14 
15 enum quota_type {
16 	USRQUOTA = 0,
17 	GRPQUOTA = 1,
18 	PRJQUOTA = 2,
19 	MAXQUOTAS = 3,
20 };
21 
22 #if MAXQUOTAS > 32
23 #error "cannot have more than 32 quota types to fit in qtype_bits"
24 #endif
25 
26 #define QUOTA_USR_BIT (1 << USRQUOTA)
27 #define QUOTA_GRP_BIT (1 << GRPQUOTA)
28 #define QUOTA_PRJ_BIT (1 << PRJQUOTA)
29 #define QUOTA_ALL_BIT (QUOTA_USR_BIT | QUOTA_GRP_BIT | QUOTA_PRJ_BIT)
30 
31 /*
32  * Definitions of magics and versions of current quota files
33  */
34 #define INITQMAGICS {\
35 	0xd9c01f11,	/* USRQUOTA */\
36 	0xd9c01927,	/* GRPQUOTA */\
37 	0xd9c03f14      /* PRJQUOTA */\
38 }
39 
40 #define V2_DQINFOOFF	sizeof(struct v2_disk_dqheader)	/* Offset of info header in file */
41 
42 #define MAX_IQ_TIME  604800	/* (7*24*60*60) 1 week */
43 #define MAX_DQ_TIME  604800	/* (7*24*60*60) 1 week */
44 
45 #define QT_TREEOFF	1	/* Offset of tree in file in blocks */
46 
47 struct v2_disk_dqheader {
48 	uint32_t dqh_magic;	/* Magic number identifying file */
49 	uint32_t dqh_version;	/* File version */
50 };
51 
52 static_assert(sizeof(struct v2_disk_dqheader) == 8, "");
53 
54 /* Header with type and version specific information */
55 struct v2_disk_dqinfo {
56 	uint32_t dqi_bgrace;	/* Time before block soft limit becomes hard limit */
57 	uint32_t dqi_igrace;	/* Time before inode soft limit becomes hard limit */
58 	uint32_t dqi_flags;	/* Flags for quotafile (DQF_*) */
59 	uint32_t dqi_blocks;	/* Number of blocks in file */
60 	uint32_t dqi_free_blk;	/* Number of first free block in the list */
61 	uint32_t dqi_free_entry;	/* Number of block with at least one free entry */
62 };
63 
64 static_assert(sizeof(struct v2_disk_dqinfo) == 24, "");
65 
66 struct v2r1_disk_dqblk {
67 	__le32 dqb_id;  	/* id this quota applies to */
68 	__le32 dqb_pad;
69 	__le64 dqb_ihardlimit;  /* absolute limit on allocated inodes */
70 	__le64 dqb_isoftlimit;  /* preferred inode limit */
71 	__le64 dqb_curinodes;   /* current # allocated inodes */
72 	__le64 dqb_bhardlimit;  /* absolute limit on disk space
73 				 * (in QUOTABLOCK_SIZE) */
74 	__le64 dqb_bsoftlimit;  /* preferred limit on disk space
75 				 * (in QUOTABLOCK_SIZE) */
76 	__le64 dqb_curspace;    /* current space occupied (in bytes) */
77 	__le64 dqb_btime;       /* time limit for excessive disk use */
78 	__le64 dqb_itime;       /* time limit for excessive inode use */
79 };
80 
81 static_assert(sizeof(struct v2r1_disk_dqblk) == 72, "");
82 
83 #endif
84