2017-10-30 23:21:09 +00:00
|
|
|
/*
|
|
|
|
* Definitions of structures for vfsv0 quota format
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _LINUX_QUOTA_TREE_H
|
|
|
|
#define _LINUX_QUOTA_TREE_H
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
2017-11-14 18:53:32 +00:00
|
|
|
#ifdef HAVE_LINUX_TYPES_H
|
2017-10-30 23:21:09 +00:00
|
|
|
#include <linux/types.h>
|
2017-11-14 18:53:32 +00:00
|
|
|
#endif
|
2017-10-30 23:21:09 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
|
2017-11-14 18:53:32 +00:00
|
|
|
#include <f2fs_fs.h>
|
|
|
|
|
2017-10-30 23:21:09 +00:00
|
|
|
typedef __u32 qid_t; /* Type in which we store ids in memory */
|
|
|
|
|
|
|
|
#define QT_TREEOFF 1 /* Offset of tree in file in blocks */
|
|
|
|
#define QT_TREEDEPTH 4 /* Depth of quota tree */
|
|
|
|
#define QT_BLKSIZE_BITS 10
|
|
|
|
#define QT_BLKSIZE (1 << QT_BLKSIZE_BITS) /* Size of block with quota
|
|
|
|
* structures */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Structure of header of block with quota structures. It is padded to 16 bytes
|
|
|
|
* so there will be space for exactly 21 quota-entries in a block
|
|
|
|
*/
|
|
|
|
struct qt_disk_dqdbheader {
|
|
|
|
__le32 dqdh_next_free; /* Number of next block with free
|
|
|
|
* entry */
|
|
|
|
__le32 dqdh_prev_free; /* Number of previous block with free
|
|
|
|
* entry */
|
|
|
|
__le16 dqdh_entries; /* Number of valid entries in block */
|
|
|
|
__le16 dqdh_pad1;
|
|
|
|
__le32 dqdh_pad2;
|
2022-04-21 22:18:18 +00:00
|
|
|
};
|
2017-10-30 23:21:09 +00:00
|
|
|
|
2022-04-21 22:18:15 +00:00
|
|
|
static_assert(sizeof(struct qt_disk_dqdbheader) == 16, "");
|
|
|
|
|
2017-10-30 23:21:09 +00:00
|
|
|
struct dquot;
|
|
|
|
struct quota_handle;
|
|
|
|
|
|
|
|
/* Operations */
|
|
|
|
struct qtree_fmt_operations {
|
|
|
|
/* Convert given entry from in memory format to disk one */
|
|
|
|
void (*mem2disk_dqblk)(void *disk, struct dquot *dquot);
|
|
|
|
/* Convert given entry from disk format to in memory one */
|
|
|
|
void (*disk2mem_dqblk)(struct dquot *dquot, void *disk);
|
|
|
|
/* Is this structure for given id? */
|
|
|
|
int (*is_id)(void *disk, struct dquot *dquot);
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Inmemory copy of version specific information */
|
|
|
|
struct qtree_mem_dqinfo {
|
|
|
|
unsigned int dqi_blocks; /* # of blocks in quota file */
|
|
|
|
unsigned int dqi_free_blk; /* First block in list of free blocks */
|
|
|
|
unsigned int dqi_free_entry; /* First block with free entry */
|
|
|
|
unsigned int dqi_entry_size; /* Size of quota entry in quota file */
|
|
|
|
struct qtree_fmt_operations *dqi_ops; /* Operations for entry
|
|
|
|
* manipulation */
|
|
|
|
};
|
|
|
|
|
2018-10-01 01:16:38 +00:00
|
|
|
int qtree_write_dquot(struct dquot *dquot);
|
2017-10-30 23:21:09 +00:00
|
|
|
struct dquot *qtree_read_dquot(struct quota_handle *h, qid_t id);
|
|
|
|
void qtree_delete_dquot(struct dquot *dquot);
|
|
|
|
int qtree_entry_unused(struct qtree_mem_dqinfo *info, char *disk);
|
|
|
|
int qtree_scan_dquots(struct quota_handle *h,
|
|
|
|
int (*process_dquot) (struct dquot *, void *), void *data);
|
|
|
|
|
|
|
|
int qtree_dqstr_in_blk(struct qtree_mem_dqinfo *info);
|
|
|
|
|
|
|
|
#endif /* _LINUX_QUOTAIO_TREE_H */
|