2018-06-06 10:42:14 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2013-08-12 18:49:35 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
|
|
|
|
* All Rights Reserved.
|
|
|
|
*/
|
|
|
|
#ifndef __XFS_INODE_BUF_H__
|
|
|
|
#define __XFS_INODE_BUF_H__
|
|
|
|
|
|
|
|
struct xfs_inode;
|
|
|
|
struct xfs_dinode;
|
2016-02-09 13:54:58 +08:00
|
|
|
|
2013-08-12 18:49:35 +08:00
|
|
|
/*
|
|
|
|
* Inode location information. Stored in the inode and passed to
|
|
|
|
* xfs_imap_to_bp() to get a buffer and dinode for a given inode.
|
|
|
|
*/
|
|
|
|
struct xfs_imap {
|
|
|
|
xfs_daddr_t im_blkno; /* starting BB of inode chunk */
|
2016-11-08 08:55:48 +08:00
|
|
|
unsigned short im_len; /* length in BBs of inode chunk */
|
|
|
|
unsigned short im_boffset; /* inode offset in block in bytes */
|
2013-08-12 18:49:35 +08:00
|
|
|
};
|
|
|
|
|
2021-03-30 02:11:37 +08:00
|
|
|
int xfs_imap_to_bp(struct xfs_mount *mp, struct xfs_trans *tp,
|
|
|
|
struct xfs_imap *imap, struct xfs_buf **bpp);
|
2021-08-19 09:46:57 +08:00
|
|
|
void xfs_dinode_calc_crc(struct xfs_mount *mp, struct xfs_dinode *dip);
|
2016-02-09 13:54:58 +08:00
|
|
|
void xfs_inode_to_disk(struct xfs_inode *ip, struct xfs_dinode *to,
|
|
|
|
xfs_lsn_t lsn);
|
2020-05-15 05:00:02 +08:00
|
|
|
int xfs_inode_from_disk(struct xfs_inode *ip, struct xfs_dinode *from);
|
2013-08-12 18:49:35 +08:00
|
|
|
|
2018-01-09 02:51:03 +08:00
|
|
|
xfs_failaddr_t xfs_dinode_verify(struct xfs_mount *mp, xfs_ino_t ino,
|
|
|
|
struct xfs_dinode *dip);
|
2018-03-24 01:06:55 +08:00
|
|
|
xfs_failaddr_t xfs_inode_validate_extsize(struct xfs_mount *mp,
|
|
|
|
uint32_t extsize, uint16_t mode, uint16_t flags);
|
|
|
|
xfs_failaddr_t xfs_inode_validate_cowextsize(struct xfs_mount *mp,
|
|
|
|
uint32_t cowextsize, uint16_t mode, uint16_t flags,
|
|
|
|
uint64_t flags2);
|
2017-06-17 02:00:07 +08:00
|
|
|
|
2020-08-18 00:59:07 +08:00
|
|
|
static inline uint64_t xfs_inode_encode_bigtime(struct timespec64 tv)
|
|
|
|
{
|
|
|
|
return xfs_unix_to_bigtime(tv.tv_sec) * NSEC_PER_SEC + tv.tv_nsec;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct timespec64 xfs_inode_from_disk_ts(struct xfs_dinode *dip,
|
|
|
|
const xfs_timestamp_t ts);
|
2020-08-25 06:15:46 +08:00
|
|
|
|
2021-08-19 09:46:57 +08:00
|
|
|
static inline bool
|
|
|
|
xfs_dinode_good_version(struct xfs_mount *mp, uint8_t version)
|
|
|
|
{
|
|
|
|
if (xfs_has_v3inodes(mp))
|
|
|
|
return version == 3;
|
|
|
|
return version == 1 || version == 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-08-12 18:49:35 +08:00
|
|
|
#endif /* __XFS_INODE_BUF_H__ */
|