1/*
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 17 unchanged lines hidden (view full) ---
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)ffs_subr.c 8.5 (Berkeley) 3/21/95
34 * $FreeBSD: head/sys/ufs/ffs/ffs_subr.c 101018 2002-07-31 07:01:18Z phk $
35 */
36
37#include <sys/param.h>
38
39#ifndef _KERNEL
40#include <ufs/ufs/dinode.h>
41#include <ufs/ffs/fs.h>
42#include "fsck.h"
--- 57 unchanged lines hidden (view full) ---
100 return (0);
101}
102
103/*
104 * Load up the contents of an inode and copy the appropriate pieces
105 * to the incore copy.
106 */
107void
108ffs_load_inode(bp, ip, mtype, fs, ino)
109 struct buf *bp;
110 struct inode *ip;
111 struct malloc_type *mtype;
112 struct fs *fs;
113 ino_t ino;
114{
115
116 if (ip->i_ump->um_fstype == UFS1) {
117 if (mtype != NULL)
118 MALLOC(ip->i_din1, struct ufs1_dinode *,
119 sizeof(struct ufs1_dinode), mtype, M_WAITOK);
120 *ip->i_din1 =
121 *((struct ufs1_dinode *)bp->b_data + ino_to_fsbo(fs, ino));
122 ip->i_mode = ip->i_din1->di_mode;
123 ip->i_nlink = ip->i_din1->di_nlink;
124 ip->i_size = ip->i_din1->di_size;
125 ip->i_flags = ip->i_din1->di_flags;
126 ip->i_gen = ip->i_din1->di_gen;
127 ip->i_uid = ip->i_din1->di_uid;
128 ip->i_gid = ip->i_din1->di_gid;
129 } else {
130 if (mtype != NULL)
131 MALLOC(ip->i_din2, struct ufs2_dinode *,
132 sizeof(struct ufs2_dinode), mtype, M_WAITOK);
133 *ip->i_din2 =
134 *((struct ufs2_dinode *)bp->b_data + ino_to_fsbo(fs, ino));
135 ip->i_mode = ip->i_din2->di_mode;
136 ip->i_nlink = ip->i_din2->di_nlink;
137 ip->i_size = ip->i_din2->di_size;
138 ip->i_flags = ip->i_din2->di_flags;
139 ip->i_gen = ip->i_din2->di_gen;
140 ip->i_uid = ip->i_din2->di_uid;
--- 158 unchanged lines hidden ---
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 17 unchanged lines hidden (view full) ---
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)ffs_subr.c 8.5 (Berkeley) 3/21/95
34 * $FreeBSD: head/sys/ufs/ffs/ffs_subr.c 101018 2002-07-31 07:01:18Z phk $
35 */
36
37#include <sys/param.h>
38
39#ifndef _KERNEL
40#include <ufs/ufs/dinode.h>
41#include <ufs/ffs/fs.h>
42#include "fsck.h"
--- 57 unchanged lines hidden (view full) ---
100 return (0);
101}
102
103/*
104 * Load up the contents of an inode and copy the appropriate pieces
105 * to the incore copy.
106 */
107void
108ffs_load_inode(bp, ip, mtype, fs, ino)
109 struct buf *bp;
110 struct inode *ip;
111 struct malloc_type *mtype;
112 struct fs *fs;
113 ino_t ino;
114{
115
116 if (ip->i_ump->um_fstype == UFS1) {
117 if (mtype != NULL)
118 MALLOC(ip->i_din1, struct ufs1_dinode *,
119 sizeof(struct ufs1_dinode), mtype, M_WAITOK);
120 *ip->i_din1 =
121 *((struct ufs1_dinode *)bp->b_data + ino_to_fsbo(fs, ino));
122 ip->i_mode = ip->i_din1->di_mode;
123 ip->i_nlink = ip->i_din1->di_nlink;
124 ip->i_size = ip->i_din1->di_size;
125 ip->i_flags = ip->i_din1->di_flags;
126 ip->i_gen = ip->i_din1->di_gen;
127 ip->i_uid = ip->i_din1->di_uid;
128 ip->i_gid = ip->i_din1->di_gid;
129 } else {
130 if (mtype != NULL)
131 MALLOC(ip->i_din2, struct ufs2_dinode *,
132 sizeof(struct ufs2_dinode), mtype, M_WAITOK);
133 *ip->i_din2 =
134 *((struct ufs2_dinode *)bp->b_data + ino_to_fsbo(fs, ino));
135 ip->i_mode = ip->i_din2->di_mode;
136 ip->i_nlink = ip->i_din2->di_nlink;
137 ip->i_size = ip->i_din2->di_size;
138 ip->i_flags = ip->i_din2->di_flags;
139 ip->i_gen = ip->i_din2->di_gen;
140 ip->i_uid = ip->i_din2->di_uid;
--- 158 unchanged lines hidden ---