]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - libxfs/xfs_inode_buf.h
libxfs: refactor manage_zones()
[thirdparty/xfsprogs-dev.git] / libxfs / xfs_inode_buf.h
CommitLineData
37b3b4d6 1// SPDX-License-Identifier: GPL-2.0
1d519883
DC
2/*
3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
4 * All Rights Reserved.
1d519883
DC
5 */
6#ifndef __XFS_INODE_BUF_H__
7#define __XFS_INODE_BUF_H__
8
9struct xfs_inode;
10struct xfs_dinode;
138659f1
DC
11
12/*
db17aebe
DC
13 * In memory representation of the XFS inode. This is held in the in-core struct
14 * xfs_inode and represents the current on disk values but the structure is not
15 * in on-disk format. That is, this structure is always translated to on-disk
138659f1
DC
16 * format specific structures at the appropriate time.
17 */
18struct xfs_icdinode {
4a492e72
DW
19 int8_t di_version; /* inode version */
20 int8_t di_format; /* format of di_c data */
21 uint16_t di_flushiter; /* incremented on flush */
22 uint32_t di_uid; /* owner's user id */
23 uint32_t di_gid; /* owner's group id */
24 uint16_t di_projid_lo; /* lower part of owner's project id */
25 uint16_t di_projid_hi; /* higher part of owner's project id */
138659f1
DC
26 xfs_fsize_t di_size; /* number of bytes in file */
27 xfs_rfsblock_t di_nblocks; /* # of direct & btree blocks used */
28 xfs_extlen_t di_extsize; /* basic/minimum extent size for file */
29 xfs_extnum_t di_nextents; /* number of extents in data fork */
30 xfs_aextnum_t di_anextents; /* number of extents in attribute fork*/
4a492e72
DW
31 uint8_t di_forkoff; /* attr fork offs, <<3 for 64b align */
32 int8_t di_aformat; /* format of attr fork's data */
33 uint32_t di_dmevmask; /* DMIG event mask */
34 uint16_t di_dmstate; /* DMIG state info */
35 uint16_t di_flags; /* random flags, XFS_DIFLAG_... */
138659f1 36
4a492e72
DW
37 uint64_t di_flags2; /* more random flags */
38 uint32_t di_cowextsize; /* basic cow extent size for file */
138659f1 39
138659f1 40 xfs_ictimestamp_t di_crtime; /* time created */
138659f1 41};
1d519883
DC
42
43/*
44 * Inode location information. Stored in the inode and passed to
45 * xfs_imap_to_bp() to get a buffer and dinode for a given inode.
46 */
47struct xfs_imap {
48 xfs_daddr_t im_blkno; /* starting BB of inode chunk */
919dbc78
TT
49 unsigned short im_len; /* length in BBs of inode chunk */
50 unsigned short im_boffset; /* inode offset in block in bytes */
1d519883
DC
51};
52
9c6ebc42
DC
53int xfs_imap_to_bp(struct xfs_mount *, struct xfs_trans *,
54 struct xfs_imap *, struct xfs_dinode **,
55 struct xfs_buf **, uint, uint);
56int xfs_iread(struct xfs_mount *, struct xfs_trans *,
57 struct xfs_inode *, uint);
58void xfs_dinode_calc_crc(struct xfs_mount *, struct xfs_dinode *);
db17aebe
DC
59void xfs_inode_to_disk(struct xfs_inode *ip, struct xfs_dinode *to,
60 xfs_lsn_t lsn);
1bc6cbe3
DC
61void xfs_inode_from_disk(struct xfs_inode *ip, struct xfs_dinode *from);
62void xfs_log_dinode_to_disk(struct xfs_log_dinode *from,
63 struct xfs_dinode *to);
1d519883 64
307ae950
RW
65bool xfs_dinode_good_version(struct xfs_mount *mp, __u8 version);
66
1d519883 67#if defined(DEBUG)
9c6ebc42 68void xfs_inobp_check(struct xfs_mount *, struct xfs_buf *);
1d519883
DC
69#else
70#define xfs_inobp_check(mp, bp)
71#endif /* DEBUG */
72
bc01119d
DW
73xfs_failaddr_t xfs_dinode_verify(struct xfs_mount *mp, xfs_ino_t ino,
74 struct xfs_dinode *dip);
fd0c360d
DW
75xfs_failaddr_t xfs_inode_validate_extsize(struct xfs_mount *mp,
76 uint32_t extsize, uint16_t mode, uint16_t flags);
77xfs_failaddr_t xfs_inode_validate_cowextsize(struct xfs_mount *mp,
78 uint32_t cowextsize, uint16_t mode, uint16_t flags,
79 uint64_t flags2);
50bb67d6 80
1d519883 81#endif /* __XFS_INODE_BUF_H__ */