1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2020 Oracle. All Rights Reserved.
* Author: Darrick J. Wong <darrick.wong@oracle.com>
*/
#ifndef __XFS_IMETA_H__
#define __XFS_IMETA_H__
/* How deep can we nest metadata dirs? */
#define XFS_IMETA_MAX_DEPTH 64
/* Form an imeta path from a simple array of strings. */
#define XFS_IMETA_DEFINE_PATH(name, path) \
const struct xfs_imeta_path name = { \
.im_path = (path), \
.im_depth = ARRAY_SIZE(path), \
}
/* Key for looking up metadata inodes. */
struct xfs_imeta_path {
/* Array of string pointers. */
const char **im_path;
/* Number of strings in path. */
unsigned int im_depth;
};
/* Cleanup widget for metadata inode creation and deletion. */
struct xfs_imeta_end {
/* empty for now */
};
/* Lookup keys for static metadata inodes. */
extern const struct xfs_imeta_path XFS_IMETA_RTBITMAP;
extern const struct xfs_imeta_path XFS_IMETA_RTSUMMARY;
extern const struct xfs_imeta_path XFS_IMETA_USRQUOTA;
extern const struct xfs_imeta_path XFS_IMETA_GRPQUOTA;
extern const struct xfs_imeta_path XFS_IMETA_PRJQUOTA;
int xfs_imeta_lookup(struct xfs_mount *mp, const struct xfs_imeta_path *path,
xfs_ino_t *ino);
int xfs_imeta_create(struct xfs_trans **tpp, const struct xfs_imeta_path *path,
umode_t mode, struct xfs_inode **ipp,
struct xfs_imeta_end *cleanup);
int xfs_imeta_unlink(struct xfs_trans **tpp, const struct xfs_imeta_path *path,
struct xfs_inode *ip, struct xfs_imeta_end *cleanup);
int xfs_imeta_zap(struct xfs_trans **tpp, const struct xfs_imeta_path *path,
struct xfs_imeta_end *cleanup);
void xfs_imeta_end_update(struct xfs_mount *mp, struct xfs_imeta_end *cleanup,
int error);
bool xfs_is_static_meta_ino(struct xfs_mount *mp, xfs_ino_t ino);
int xfs_imeta_mount(struct xfs_mount *mp);
unsigned int xfs_imeta_create_space_res(struct xfs_mount *mp);
unsigned int xfs_imeta_unlink_space_res(struct xfs_mount *mp);
/* Must be implemented by the libxfs client */
int xfs_imeta_iget(struct xfs_mount *mp, xfs_ino_t ino, unsigned char ftype,
struct xfs_inode **ipp);
void xfs_imeta_irele(struct xfs_inode *ip);
#endif /* __XFS_IMETA_H__ */
|