]>
Commit | Line | Data |
---|---|---|
1d519883 DC |
1 | /* |
2 | * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. | |
3 | * All Rights Reserved. | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or | |
6 | * modify it under the terms of the GNU General Public License as | |
7 | * published by the Free Software Foundation. | |
8 | * | |
9 | * This program is distributed in the hope that it would be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write the Free Software Foundation, | |
16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
17 | */ | |
18 | #ifndef __XFS_INODE_BUF_H__ | |
19 | #define __XFS_INODE_BUF_H__ | |
20 | ||
21 | struct xfs_inode; | |
22 | struct xfs_dinode; | |
138659f1 DC |
23 | |
24 | /* | |
25 | * In memory representation of the XFS inode. This is held in the in-core | |
26 | * struct xfs_inode to represent the on disk values, but no longer needs to be | |
27 | * identical to the on-disk structure as it is always translated to on-disk | |
28 | * format specific structures at the appropriate time. | |
29 | */ | |
30 | struct xfs_icdinode { | |
31 | __uint16_t di_magic; /* inode magic # = XFS_DINODE_MAGIC */ | |
32 | __uint16_t di_mode; /* mode and type of file */ | |
33 | __int8_t di_version; /* inode version */ | |
34 | __int8_t di_format; /* format of di_c data */ | |
35 | __uint16_t di_onlink; /* old number of links to file */ | |
36 | __uint32_t di_uid; /* owner's user id */ | |
37 | __uint32_t di_gid; /* owner's group id */ | |
38 | __uint32_t di_nlink; /* number of links to file */ | |
39 | __uint16_t di_projid_lo; /* lower part of owner's project id */ | |
40 | __uint16_t di_projid_hi; /* higher part of owner's project id */ | |
41 | __uint8_t di_pad[6]; /* unused, zeroed space */ | |
42 | __uint16_t di_flushiter; /* incremented on flush */ | |
138659f1 DC |
43 | xfs_fsize_t di_size; /* number of bytes in file */ |
44 | xfs_rfsblock_t di_nblocks; /* # of direct & btree blocks used */ | |
45 | xfs_extlen_t di_extsize; /* basic/minimum extent size for file */ | |
46 | xfs_extnum_t di_nextents; /* number of extents in data fork */ | |
47 | xfs_aextnum_t di_anextents; /* number of extents in attribute fork*/ | |
48 | __uint8_t di_forkoff; /* attr fork offs, <<3 for 64b align */ | |
49 | __int8_t di_aformat; /* format of attr fork's data */ | |
50 | __uint32_t di_dmevmask; /* DMIG event mask */ | |
51 | __uint16_t di_dmstate; /* DMIG state info */ | |
52 | __uint16_t di_flags; /* random flags, XFS_DIFLAG_... */ | |
53 | __uint32_t di_gen; /* generation number */ | |
54 | ||
55 | /* di_next_unlinked is the only non-core field in the old dinode */ | |
56 | xfs_agino_t di_next_unlinked;/* agi unlinked list ptr */ | |
57 | ||
58 | /* start of the extended dinode, writable fields */ | |
59 | __uint32_t di_crc; /* CRC of the inode */ | |
60 | __uint64_t di_changecount; /* number of attribute changes */ | |
61 | xfs_lsn_t di_lsn; /* flush sequence */ | |
62 | __uint64_t di_flags2; /* more random flags */ | |
63 | __uint8_t di_pad2[16]; /* more padding for future expansion */ | |
64 | ||
65 | /* fields only written to during inode creation */ | |
66 | xfs_ictimestamp_t di_crtime; /* time created */ | |
67 | xfs_ino_t di_ino; /* inode number */ | |
68 | uuid_t di_uuid; /* UUID of the filesystem */ | |
69 | ||
70 | /* structure must be padded to 64 bit alignment */ | |
71 | }; | |
1d519883 DC |
72 | |
73 | /* | |
74 | * Inode location information. Stored in the inode and passed to | |
75 | * xfs_imap_to_bp() to get a buffer and dinode for a given inode. | |
76 | */ | |
77 | struct xfs_imap { | |
78 | xfs_daddr_t im_blkno; /* starting BB of inode chunk */ | |
919dbc78 TT |
79 | unsigned short im_len; /* length in BBs of inode chunk */ |
80 | unsigned short im_boffset; /* inode offset in block in bytes */ | |
1d519883 DC |
81 | }; |
82 | ||
9c6ebc42 DC |
83 | int xfs_imap_to_bp(struct xfs_mount *, struct xfs_trans *, |
84 | struct xfs_imap *, struct xfs_dinode **, | |
85 | struct xfs_buf **, uint, uint); | |
86 | int xfs_iread(struct xfs_mount *, struct xfs_trans *, | |
87 | struct xfs_inode *, uint); | |
88 | void xfs_dinode_calc_crc(struct xfs_mount *, struct xfs_dinode *); | |
1bc6cbe3 DC |
89 | void xfs_inode_to_disk(struct xfs_inode *ip, struct xfs_dinode *to); |
90 | void xfs_inode_from_disk(struct xfs_inode *ip, struct xfs_dinode *from); | |
91 | void xfs_log_dinode_to_disk(struct xfs_log_dinode *from, | |
92 | struct xfs_dinode *to); | |
e515cca1 DC |
93 | bool xfs_dinode_verify(struct xfs_mount *mp, xfs_ino_t ino, |
94 | struct xfs_dinode *dip); | |
1d519883 | 95 | |
307ae950 RW |
96 | bool xfs_dinode_good_version(struct xfs_mount *mp, __u8 version); |
97 | ||
1d519883 | 98 | #if defined(DEBUG) |
9c6ebc42 | 99 | void xfs_inobp_check(struct xfs_mount *, struct xfs_buf *); |
1d519883 DC |
100 | #else |
101 | #define xfs_inobp_check(mp, bp) | |
102 | #endif /* DEBUG */ | |
103 | ||
1d519883 | 104 | #endif /* __XFS_INODE_BUF_H__ */ |