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 #pragma pack(push, 1) 48 struct v2_disk_dqheader { 49 u_int32_t dqh_magic; /* Magic number identifying file */ 50 u_int32_t dqh_version; /* File version */ 51 } __attribute__ ((packed)); 52 53 /* Header with type and version specific information */ 54 struct v2_disk_dqinfo { 55 u_int32_t dqi_bgrace; /* Time before block soft limit becomes hard limit */ 56 u_int32_t dqi_igrace; /* Time before inode soft limit becomes hard limit */ 57 u_int32_t dqi_flags; /* Flags for quotafile (DQF_*) */ 58 u_int32_t dqi_blocks; /* Number of blocks in file */ 59 u_int32_t dqi_free_blk; /* Number of first free block in the list */ 60 u_int32_t dqi_free_entry; /* Number of block with at least one free entry */ 61 } __attribute__ ((packed)); 62 63 struct v2r1_disk_dqblk { 64 __le32 dqb_id; /* id this quota applies to */ 65 __le32 dqb_pad; 66 __le64 dqb_ihardlimit; /* absolute limit on allocated inodes */ 67 __le64 dqb_isoftlimit; /* preferred inode limit */ 68 __le64 dqb_curinodes; /* current # allocated inodes */ 69 __le64 dqb_bhardlimit; /* absolute limit on disk space 70 * (in QUOTABLOCK_SIZE) */ 71 __le64 dqb_bsoftlimit; /* preferred limit on disk space 72 * (in QUOTABLOCK_SIZE) */ 73 __le64 dqb_curspace; /* current space occupied (in bytes) */ 74 __le64 dqb_btime; /* time limit for excessive disk use */ 75 __le64 dqb_itime; /* time limit for excessive inode use */ 76 } __attribute__ ((packed)); 77 #pragma pack(pop) 78 79 #endif 80