Android-cuttlefish cvd tool
quotaio_tree.h
Go to the documentation of this file.
1/*
2 * Definitions of structures for vfsv0 quota format
3 */
4
5#ifndef _LINUX_QUOTA_TREE_H
6#define _LINUX_QUOTA_TREE_H
7
8#include <inttypes.h>
9#ifdef HAVE_LINUX_TYPES_H
10#include <linux/types.h>
11#endif
12#include <sys/types.h>
13
14#include <f2fs_fs.h>
15
16typedef __u32 qid_t; /* Type in which we store ids in memory */
17
18#define QT_TREEOFF 1 /* Offset of tree in file in blocks */
19#define QT_TREEDEPTH 4 /* Depth of quota tree */
20#define QT_BLKSIZE_BITS 10
21#define QT_BLKSIZE (1 << QT_BLKSIZE_BITS) /* Size of block with quota
22 * structures */
23
24/*
25 * Structure of header of block with quota structures. It is padded to 16 bytes
26 * so there will be space for exactly 21 quota-entries in a block
27 */
29 __le32 dqdh_next_free; /* Number of next block with free
30 * entry */
31 __le32 dqdh_prev_free; /* Number of previous block with free
32 * entry */
33 __le16 dqdh_entries; /* Number of valid entries in block */
36};
37
38static_assert(sizeof(struct qt_disk_dqdbheader) == 16, "");
39
40struct dquot;
41struct quota_handle;
42
43/* Operations */
45 /* Convert given entry from in memory format to disk one */
46 void (*mem2disk_dqblk)(void *disk, struct dquot *dquot);
47 /* Convert given entry from disk format to in memory one */
48 void (*disk2mem_dqblk)(struct dquot *dquot, void *disk);
49 /* Is this structure for given id? */
50 int (*is_id)(void *disk, struct dquot *dquot);
51};
52
53/* Inmemory copy of version specific information */
55 unsigned int dqi_blocks; /* # of blocks in quota file */
56 unsigned int dqi_free_blk; /* First block in list of free blocks */
57 unsigned int dqi_free_entry; /* First block with free entry */
58 unsigned int dqi_entry_size; /* Size of quota entry in quota file */
59 struct qtree_fmt_operations *dqi_ops; /* Operations for entry
60 * manipulation */
61};
62
63int qtree_write_dquot(struct dquot *dquot);
64struct dquot *qtree_read_dquot(struct quota_handle *h, qid_t id);
65void qtree_delete_dquot(struct dquot *dquot);
66int qtree_entry_unused(struct qtree_mem_dqinfo *info, char *disk);
68 int (*process_dquot) (struct dquot *, void *), void *data);
69
71
72#endif /* _LINUX_QUOTAIO_TREE_H */
unsigned int __u32
Definition: blkid_types.h:14
__u32 __bitwise __le32
Definition: blkid_types.h:39
__u16 __bitwise __le16
Definition: blkid_types.h:38
#define data
Definition: dict.c:56
struct fs_info info
Definition: ext4_utils.cpp:42
int qtree_dqstr_in_blk(struct qtree_mem_dqinfo *info)
Definition: quotaio_tree.c:45
__u32 qid_t
Definition: quotaio_tree.h:16
void qtree_delete_dquot(struct dquot *dquot)
Definition: quotaio_tree.c:444
int qtree_entry_unused(struct qtree_mem_dqinfo *info, char *disk)
Definition: quotaio_tree.c:35
int qtree_write_dquot(struct dquot *dquot)
Definition: quotaio_tree.c:319
int qtree_scan_dquots(struct quota_handle *h, int(*process_dquot)(struct dquot *, void *), void *data)
Definition: quotaio_tree.c:655
struct dquot * qtree_read_dquot(struct quota_handle *h, qid_t id)
Definition: quotaio_tree.c:515
Definition: quotaio.h:152
Definition: quotaio_tree.h:27
__le16 dqdh_entries
Definition: quotaio_tree.h:32
__le32 dqdh_next_free
Definition: quotaio_tree.h:28
__le16 dqdh_pad1
Definition: quotaio_tree.h:33
__le32 dqdh_prev_free
Definition: quotaio_tree.h:30
__le32 dqdh_pad2
Definition: quotaio_tree.h:34
Definition: quotaio_tree.h:43
int(* is_id)(void *disk, struct dquot *dquot)
Definition: quotaio_tree.h:49
void(* disk2mem_dqblk)(struct dquot *dquot, void *disk)
Definition: quotaio_tree.h:47
void(* mem2disk_dqblk)(void *disk, struct dquot *dquot)
Definition: quotaio_tree.h:45
Definition: quotaio_tree.h:53
struct qtree_fmt_operations * dqi_ops
Definition: quotaio_tree.h:58
unsigned int dqi_entry_size
Definition: quotaio_tree.h:57
unsigned int dqi_blocks
Definition: quotaio_tree.h:54
unsigned int dqi_free_blk
Definition: quotaio_tree.h:55
unsigned int dqi_free_entry
Definition: quotaio_tree.h:56
Definition: quotaio.h:122