blob: 7b8b1b97918b5d22d65aee5d75b5fbb2e9251836 [file] [log] [blame]
Dave Chinner1fd71152013-08-12 20:49:35 +10001/*
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
21struct xfs_inode;
22struct xfs_dinode;
Dave Chinnerf8d55aa0522016-02-09 16:54:58 +110023
24/*
Dave Chinner93f958f2016-02-09 16:54:58 +110025 * In memory representation of the XFS inode. This is held in the in-core struct
26 * xfs_inode and represents the current on disk values but the structure is not
27 * in on-disk format. That is, this structure is always translated to on-disk
Dave Chinnerf8d55aa0522016-02-09 16:54:58 +110028 * format specific structures at the appropriate time.
29 */
30struct xfs_icdinode {
Dave Chinnerf8d55aa0522016-02-09 16:54:58 +110031 __uint16_t di_mode; /* mode and type of file */
32 __int8_t di_version; /* inode version */
33 __int8_t di_format; /* format of di_c data */
34 __uint16_t di_onlink; /* old number of links to file */
Dave Chinner93f958f2016-02-09 16:54:58 +110035 __uint16_t di_flushiter; /* incremented on flush */
Dave Chinnerf8d55aa0522016-02-09 16:54:58 +110036 __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 */
Dave Chinnerf8d55aa0522016-02-09 16:54:58 +110041 xfs_fsize_t di_size; /* number of bytes in file */
42 xfs_rfsblock_t di_nblocks; /* # of direct & btree blocks used */
43 xfs_extlen_t di_extsize; /* basic/minimum extent size for file */
44 xfs_extnum_t di_nextents; /* number of extents in data fork */
45 xfs_aextnum_t di_anextents; /* number of extents in attribute fork*/
46 __uint8_t di_forkoff; /* attr fork offs, <<3 for 64b align */
47 __int8_t di_aformat; /* format of attr fork's data */
48 __uint32_t di_dmevmask; /* DMIG event mask */
49 __uint16_t di_dmstate; /* DMIG state info */
50 __uint16_t di_flags; /* random flags, XFS_DIFLAG_... */
51 __uint32_t di_gen; /* generation number */
52
Dave Chinnerf8d55aa0522016-02-09 16:54:58 +110053 __uint64_t di_changecount; /* number of attribute changes */
Dave Chinnerf8d55aa0522016-02-09 16:54:58 +110054 __uint64_t di_flags2; /* more random flags */
Dave Chinnerf8d55aa0522016-02-09 16:54:58 +110055
Dave Chinnerf8d55aa0522016-02-09 16:54:58 +110056 xfs_ictimestamp_t di_crtime; /* time created */
Dave Chinnerf8d55aa0522016-02-09 16:54:58 +110057};
Dave Chinner1fd71152013-08-12 20:49:35 +100058
59/*
60 * Inode location information. Stored in the inode and passed to
61 * xfs_imap_to_bp() to get a buffer and dinode for a given inode.
62 */
63struct xfs_imap {
64 xfs_daddr_t im_blkno; /* starting BB of inode chunk */
65 ushort im_len; /* length in BBs of inode chunk */
66 ushort im_boffset; /* inode offset in block in bytes */
67};
68
Dave Chinner638f44162013-08-30 10:23:45 +100069int xfs_imap_to_bp(struct xfs_mount *, struct xfs_trans *,
70 struct xfs_imap *, struct xfs_dinode **,
71 struct xfs_buf **, uint, uint);
72int xfs_iread(struct xfs_mount *, struct xfs_trans *,
73 struct xfs_inode *, uint);
74void xfs_dinode_calc_crc(struct xfs_mount *, struct xfs_dinode *);
Dave Chinner93f958f2016-02-09 16:54:58 +110075void xfs_inode_to_disk(struct xfs_inode *ip, struct xfs_dinode *to,
76 xfs_lsn_t lsn);
Dave Chinner39878482016-02-09 16:54:58 +110077void xfs_inode_from_disk(struct xfs_inode *ip, struct xfs_dinode *from);
78void xfs_log_dinode_to_disk(struct xfs_log_dinode *from,
79 struct xfs_dinode *to);
Dave Chinner1fd71152013-08-12 20:49:35 +100080
81#if defined(DEBUG)
Dave Chinner638f44162013-08-30 10:23:45 +100082void xfs_inobp_check(struct xfs_mount *, struct xfs_buf *);
Dave Chinner1fd71152013-08-12 20:49:35 +100083#else
84#define xfs_inobp_check(mp, bp)
85#endif /* DEBUG */
86
Dave Chinner1fd71152013-08-12 20:49:35 +100087#endif /* __XFS_INODE_BUF_H__ */