18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Definitions of structures for vfsv0 quota format 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#ifndef _LINUX_QUOTAIO_V2_H 78c2ecf20Sopenharmony_ci#define _LINUX_QUOTAIO_V2_H 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include <linux/types.h> 108c2ecf20Sopenharmony_ci#include <linux/quota.h> 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci/* 138c2ecf20Sopenharmony_ci * Definitions of magics and versions of current quota files 148c2ecf20Sopenharmony_ci */ 158c2ecf20Sopenharmony_ci#define V2_INITQMAGICS {\ 168c2ecf20Sopenharmony_ci 0xd9c01f11, /* USRQUOTA */\ 178c2ecf20Sopenharmony_ci 0xd9c01927, /* GRPQUOTA */\ 188c2ecf20Sopenharmony_ci 0xd9c03f14, /* PRJQUOTA */\ 198c2ecf20Sopenharmony_ci} 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#define V2_INITQVERSIONS {\ 228c2ecf20Sopenharmony_ci 1, /* USRQUOTA */\ 238c2ecf20Sopenharmony_ci 1, /* GRPQUOTA */\ 248c2ecf20Sopenharmony_ci 1, /* PRJQUOTA */\ 258c2ecf20Sopenharmony_ci} 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci/* First generic header */ 288c2ecf20Sopenharmony_cistruct v2_disk_dqheader { 298c2ecf20Sopenharmony_ci __le32 dqh_magic; /* Magic number identifying file */ 308c2ecf20Sopenharmony_ci __le32 dqh_version; /* File version */ 318c2ecf20Sopenharmony_ci}; 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci/* 348c2ecf20Sopenharmony_ci * The following structure defines the format of the disk quota file 358c2ecf20Sopenharmony_ci * (as it appears on disk) - the file is a radix tree whose leaves point 368c2ecf20Sopenharmony_ci * to blocks of these structures. 378c2ecf20Sopenharmony_ci */ 388c2ecf20Sopenharmony_cistruct v2r0_disk_dqblk { 398c2ecf20Sopenharmony_ci __le32 dqb_id; /* id this quota applies to */ 408c2ecf20Sopenharmony_ci __le32 dqb_ihardlimit; /* absolute limit on allocated inodes */ 418c2ecf20Sopenharmony_ci __le32 dqb_isoftlimit; /* preferred inode limit */ 428c2ecf20Sopenharmony_ci __le32 dqb_curinodes; /* current # allocated inodes */ 438c2ecf20Sopenharmony_ci __le32 dqb_bhardlimit; /* absolute limit on disk space (in QUOTABLOCK_SIZE) */ 448c2ecf20Sopenharmony_ci __le32 dqb_bsoftlimit; /* preferred limit on disk space (in QUOTABLOCK_SIZE) */ 458c2ecf20Sopenharmony_ci __le64 dqb_curspace; /* current space occupied (in bytes) */ 468c2ecf20Sopenharmony_ci __le64 dqb_btime; /* time limit for excessive disk use */ 478c2ecf20Sopenharmony_ci __le64 dqb_itime; /* time limit for excessive inode use */ 488c2ecf20Sopenharmony_ci}; 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_cistruct v2r1_disk_dqblk { 518c2ecf20Sopenharmony_ci __le32 dqb_id; /* id this quota applies to */ 528c2ecf20Sopenharmony_ci __le32 dqb_pad; 538c2ecf20Sopenharmony_ci __le64 dqb_ihardlimit; /* absolute limit on allocated inodes */ 548c2ecf20Sopenharmony_ci __le64 dqb_isoftlimit; /* preferred inode limit */ 558c2ecf20Sopenharmony_ci __le64 dqb_curinodes; /* current # allocated inodes */ 568c2ecf20Sopenharmony_ci __le64 dqb_bhardlimit; /* absolute limit on disk space (in QUOTABLOCK_SIZE) */ 578c2ecf20Sopenharmony_ci __le64 dqb_bsoftlimit; /* preferred limit on disk space (in QUOTABLOCK_SIZE) */ 588c2ecf20Sopenharmony_ci __le64 dqb_curspace; /* current space occupied (in bytes) */ 598c2ecf20Sopenharmony_ci __le64 dqb_btime; /* time limit for excessive disk use */ 608c2ecf20Sopenharmony_ci __le64 dqb_itime; /* time limit for excessive inode use */ 618c2ecf20Sopenharmony_ci}; 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci/* Header with type and version specific information */ 648c2ecf20Sopenharmony_cistruct v2_disk_dqinfo { 658c2ecf20Sopenharmony_ci __le32 dqi_bgrace; /* Time before block soft limit becomes hard limit */ 668c2ecf20Sopenharmony_ci __le32 dqi_igrace; /* Time before inode soft limit becomes hard limit */ 678c2ecf20Sopenharmony_ci __le32 dqi_flags; /* Flags for quotafile (DQF_*) */ 688c2ecf20Sopenharmony_ci __le32 dqi_blocks; /* Number of blocks in file */ 698c2ecf20Sopenharmony_ci __le32 dqi_free_blk; /* Number of first free block in the list */ 708c2ecf20Sopenharmony_ci __le32 dqi_free_entry; /* Number of block with at least one free entry */ 718c2ecf20Sopenharmony_ci}; 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci#define V2_DQINFOOFF sizeof(struct v2_disk_dqheader) /* Offset of info header in file */ 748c2ecf20Sopenharmony_ci#define V2_DQBLKSIZE_BITS 10 /* Size of leaf block in tree */ 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci#endif /* _LINUX_QUOTAIO_V2_H */ 77