Changeset View
Changeset View
Standalone View
Standalone View
head/sys/fs/ext2fs/ext2_inode_cnv.c
Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | |||||
#endif /* EXT2FS_DEBUG */ | #endif /* EXT2FS_DEBUG */ | ||||
/* | /* | ||||
* raw ext2 inode to inode | * raw ext2 inode to inode | ||||
*/ | */ | ||||
int | int | ||||
ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip) | ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip) | ||||
{ | { | ||||
struct m_ext2fs *fs; | |||||
const static struct ext2fs_dinode ei_zero; | |||||
fs = ip->i_e2fs; | |||||
ip->i_nlink = ei->e2di_nlink; | ip->i_nlink = ei->e2di_nlink; | ||||
/* | /* | ||||
* Godmar thinks - if the link count is zero, then the inode is | * Godmar thinks - if the link count is zero, then the inode is | ||||
* unused - according to ext2 standards. Ufs marks this fact by | * unused - according to ext2 standards. Ufs marks this fact by | ||||
* setting i_mode to zero - why ? I can see that this might lead to | * setting i_mode to zero - why ? I can see that this might lead to | ||||
* problems in an undelete. | * problems in an undelete. | ||||
*/ | */ | ||||
ip->i_mode = ei->e2di_nlink ? ei->e2di_mode : 0; | ip->i_mode = ei->e2di_nlink ? ei->e2di_mode : 0; | ||||
Show All 27 Lines | ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip) | ||||
ip->i_gen = ei->e2di_gen; | ip->i_gen = ei->e2di_gen; | ||||
ip->i_uid = ei->e2di_uid; | ip->i_uid = ei->e2di_uid; | ||||
ip->i_gid = ei->e2di_gid; | ip->i_gid = ei->e2di_gid; | ||||
ip->i_uid |= (uint32_t)ei->e2di_uid_high << 16; | ip->i_uid |= (uint32_t)ei->e2di_uid_high << 16; | ||||
ip->i_gid |= (uint32_t)ei->e2di_gid_high << 16; | ip->i_gid |= (uint32_t)ei->e2di_gid_high << 16; | ||||
memcpy(ip->i_data, ei->e2di_blocks, sizeof(ei->e2di_blocks)); | memcpy(ip->i_data, ei->e2di_blocks, sizeof(ei->e2di_blocks)); | ||||
if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_METADATA_CKSUM) && | |||||
memcmp(ei, &ei_zero, EXT2_INODE_SIZE(fs))) | |||||
return (ext2_ei_csum_verify(ip, ei)); | return (ext2_ei_csum_verify(ip, ei)); | ||||
return (0); | |||||
} | } | ||||
/* | /* | ||||
* inode to raw ext2 inode | * inode to raw ext2 inode | ||||
*/ | */ | ||||
int | int | ||||
ext2_i2ei(struct inode *ip, struct ext2fs_dinode *ei) | ext2_i2ei(struct inode *ip, struct ext2fs_dinode *ei) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines |