diff options
author | Kirk McKusick <mckusick@FreeBSD.org> | 2018-11-13 21:40:56 +0000 |
---|---|---|
committer | Kirk McKusick <mckusick@FreeBSD.org> | 2018-11-13 21:40:56 +0000 |
commit | 9fc5d538fc57f438ca860e07db191b946b4768c9 (patch) | |
tree | 0f73178df156f836c4d9dde3af92b526b95c4e72 /sys/ufs/ffs/ffs_subr.c | |
parent | f183fb162c1dbc58cc3f7e2c27891bd881db2bf2 (diff) | |
download | src-9fc5d538fc57f438ca860e07db191b946b4768c9.tar.gz src-9fc5d538fc57f438ca860e07db191b946b4768c9.zip |
In preparation for adding inode check-hashes, clean up and
document the libufs interface for fetching and storing inodes.
The undocumented getino / putino interface has been replaced
with a new getinode / putinode interface.
Convert the utilities that had been using the undocumented
interface to use the new documented interface.
No functional change (as for now the libufs library does not
do inode check-hashes).
Reviewed by: kib
Tested by: Peter Holm
Sponsored by: Netflix
Notes
Notes:
svn path=/head/; revision=340411
Diffstat (limited to 'sys/ufs/ffs/ffs_subr.c')
-rw-r--r-- | sys/ufs/ffs/ffs_subr.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c index de70a3f84283..541d44c887db 100644 --- a/sys/ufs/ffs/ffs_subr.c +++ b/sys/ufs/ffs/ffs_subr.c @@ -108,31 +108,35 @@ ffs_blkatoff(struct vnode *vp, off_t offset, char **res, struct buf **bpp) * Load up the contents of an inode and copy the appropriate pieces * to the incore copy. */ -void +int ffs_load_inode(struct buf *bp, struct inode *ip, struct fs *fs, ino_t ino) { + struct ufs1_dinode *dip1; + struct ufs2_dinode *dip2; if (I_IS_UFS1(ip)) { - *ip->i_din1 = + dip1 = ip->i_din1; + *dip1 = *((struct ufs1_dinode *)bp->b_data + ino_to_fsbo(fs, ino)); - ip->i_mode = ip->i_din1->di_mode; - ip->i_nlink = ip->i_din1->di_nlink; - ip->i_size = ip->i_din1->di_size; - ip->i_flags = ip->i_din1->di_flags; - ip->i_gen = ip->i_din1->di_gen; - ip->i_uid = ip->i_din1->di_uid; - ip->i_gid = ip->i_din1->di_gid; - } else { - *ip->i_din2 = - *((struct ufs2_dinode *)bp->b_data + ino_to_fsbo(fs, ino)); - ip->i_mode = ip->i_din2->di_mode; - ip->i_nlink = ip->i_din2->di_nlink; - ip->i_size = ip->i_din2->di_size; - ip->i_flags = ip->i_din2->di_flags; - ip->i_gen = ip->i_din2->di_gen; - ip->i_uid = ip->i_din2->di_uid; - ip->i_gid = ip->i_din2->di_gid; + ip->i_mode = dip1->di_mode; + ip->i_nlink = dip1->di_nlink; + ip->i_size = dip1->di_size; + ip->i_flags = dip1->di_flags; + ip->i_gen = dip1->di_gen; + ip->i_uid = dip1->di_uid; + ip->i_gid = dip1->di_gid; + return (0); } + dip2 = ip->i_din2; + *dip2 = *((struct ufs2_dinode *)bp->b_data + ino_to_fsbo(fs, ino)); + ip->i_mode = dip2->di_mode; + ip->i_nlink = dip2->di_nlink; + ip->i_size = dip2->di_size; + ip->i_flags = dip2->di_flags; + ip->i_gen = dip2->di_gen; + ip->i_uid = dip2->di_uid; + ip->i_gid = dip2->di_gid; + return (0); } #endif /* KERNEL */ |