From 5970a65fa5c1fd475265e85aa46bb13725c19733 Mon Sep 17 00:00:00 2001 From: pelikan Date: Mon, 14 Jul 2014 08:54:13 +0000 Subject: [PATCH] better type safety and KNF. Because ext2fs has only 32-bit inode numbers, use ufsino_t as in FFS. Disk blocks are u_int32_t as well, because we don't support the 64BIT flag. When we do, there's going to be a lot more going on than just daddr_t. While there, add some journaling-related bits into the superblock to play with. ok guenther --- sys/ufs/ext2fs/ext2fs.h | 24 +++++- sys/ufs/ext2fs/ext2fs_alloc.c | 107 +++++++++++++------------- sys/ufs/ext2fs/ext2fs_balloc.c | 18 ++--- sys/ufs/ext2fs/ext2fs_bmap.c | 11 +-- sys/ufs/ext2fs/ext2fs_bswap.c | 12 ++- sys/ufs/ext2fs/ext2fs_extern.h | 136 ++++++++++++++++----------------- sys/ufs/ufs/inode.h | 6 +- 7 files changed, 165 insertions(+), 149 deletions(-) diff --git a/sys/ufs/ext2fs/ext2fs.h b/sys/ufs/ext2fs/ext2fs.h index cbf68e25f98..778645a7c79 100644 --- a/sys/ufs/ext2fs/ext2fs.h +++ b/sys/ufs/ext2fs/ext2fs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs.h,v 1.20 2014/07/13 16:59:35 pelikan Exp $ */ +/* $OpenBSD: ext2fs.h,v 1.21 2014/07/14 08:54:13 pelikan Exp $ */ /* $NetBSD: ext2fs.h,v 1.10 2000/01/28 16:00:23 bouyer Exp $ */ /* @@ -59,8 +59,11 @@ #define SBLOCK ((daddr_t)(BBLOCK + BBSIZE / DEV_BSIZE)) /* - * Addresses stored in inodes are capable of addressing blocks - * XXX + * Inodes are, like in UFS, 32-bit unsigned integers and therefore ufsino_t. + * Disk blocks are 32-bit, if the filesystem isn't operating in 64-bit mode + * (the incompatible ext4 64BIT flag). More work is needed to properly use + * daddr_t as the disk block data type on both BE and LE architectures. + * XXX disk blocks are simply u_int32_t for now. */ /* @@ -140,7 +143,20 @@ struct ext2fs { u_int8_t e2fs_prealloc; /* # of blocks to preallocate */ u_int8_t e2fs_dir_prealloc; /* # of blocks to preallocate for dir */ u_int16_t e2fs_reserved_ngdb; /* # of reserved gd blocks for resize */ - u_int32_t reserved2[204]; + /* Ext3 JBD2 journaling. */ + u_int8_t e2fs_journal_uuid[16]; + u_int32_t e2fs_journal_ino; + u_int32_t e2fs_journal_dev; + u_int32_t e2fs_last_orphan; /* start of list of inodes to delete */ + u_int32_t e2fs_hash_seed[4]; /* htree hash seed */ + u_int8_t e2fs_def_hash_version; + u_int8_t e2fs_journal_backup_type; + u_int16_t e2fs_gdesc_size; + u_int32_t e2fs_default_mount_opts; + u_int32_t e2fs_first_meta_bg; + u_int32_t e2fs_mkfs_time; + u_int32_t e2fs_journal_backup[17]; + u_int32_t reserved2[76]; }; diff --git a/sys/ufs/ext2fs/ext2fs_alloc.c b/sys/ufs/ext2fs/ext2fs_alloc.c index 0a77b5e45a1..308b25fb768 100644 --- a/sys/ufs/ext2fs/ext2fs_alloc.c +++ b/sys/ufs/ext2fs/ext2fs_alloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_alloc.c,v 1.32 2014/07/13 16:59:35 pelikan Exp $ */ +/* $OpenBSD: ext2fs_alloc.c,v 1.33 2014/07/14 08:54:13 pelikan Exp $ */ /* $NetBSD: ext2fs_alloc.c,v 1.10 2001/07/05 08:38:27 toshii Exp $ */ /* @@ -53,13 +53,13 @@ u_long ext2gennumber; -static int32_t ext2fs_alloccg(struct inode *, int, int32_t, int); -static u_long ext2fs_dirpref(struct m_ext2fs *); -static void ext2fs_fserr(struct m_ext2fs *, uid_t, char *); -static u_long ext2fs_hashalloc(struct inode *, int, long, int, - int32_t (*)(struct inode *, int, int32_t, int)); -static int32_t ext2fs_nodealloccg(struct inode *, int, int32_t, int); -static int32_t ext2fs_mapsearch(struct m_ext2fs *, char *, int32_t); +static u_int32_t ext2fs_alloccg(struct inode *, int, u_int32_t, int); +static int ext2fs_dirpref(struct m_ext2fs *); +static void ext2fs_fserr(struct m_ext2fs *, uid_t, char *); +static u_int32_t ext2fs_hashalloc(struct inode *, int, u_int32_t, int, + u_int32_t (*)(struct inode *, int, u_int32_t, int)); +static ufsino_t ext2fs_nodealloccg(struct inode *, int, ufsino_t, int); +static u_int32_t ext2fs_mapsearch(struct m_ext2fs *, char *, u_int32_t); /* * Allocate a block in the file system. @@ -79,11 +79,11 @@ static int32_t ext2fs_mapsearch(struct m_ext2fs *, char *, int32_t); * available block is located. */ int -ext2fs_alloc(struct inode *ip, int32_t lbn, int32_t bpref, - struct ucred *cred, int32_t *bnp) +ext2fs_alloc(struct inode *ip, u_int32_t lbn, u_int32_t bpref, + struct ucred *cred, u_int32_t *bnp) { struct m_ext2fs *fs; - int32_t bno; + u_int32_t bno; int cg; *bnp = 0; @@ -102,8 +102,7 @@ ext2fs_alloc(struct inode *ip, int32_t lbn, int32_t bpref, cg = ino_to_cg(fs, ip->i_number); else cg = dtog(fs, bpref); - bno = (int32_t)ext2fs_hashalloc(ip, cg, bpref, fs->e2fs_bsize, - ext2fs_alloccg); + bno = ext2fs_hashalloc(ip, cg, bpref, fs->e2fs_bsize, ext2fs_alloccg); if (bno > 0) { ip->i_e2fs_nblock += btodb(fs->e2fs_bsize); ip->i_flag |= IN_CHANGE | IN_UPDATE; @@ -152,7 +151,7 @@ ext2fs_inode_alloc(struct inode *pip, mode_t mode, struct ucred *cred, else cg = ino_to_cg(fs, pip->i_number); ipref = cg * fs->e2fs.e2fs_ipg + 1; - ino = (ufsino_t)ext2fs_hashalloc(pip, cg, (long)ipref, mode, ext2fs_nodealloccg); + ino = ext2fs_hashalloc(pip, cg, ipref, mode, ext2fs_nodealloccg); if (ino == 0) goto noinodes; error = VFS_VGET(pvp->v_mount, ino, vpp); @@ -177,7 +176,7 @@ ext2fs_inode_alloc(struct inode *pip, mode_t mode, struct ucred *cred, ext2gennumber = time_second; ip->i_e2fs_gen = ext2gennumber; return (0); -noinodes: + noinodes: ext2fs_fserr(fs, cred->cr_uid, "out of inodes"); uprintf("\n%s: create/symlink failed, no inodes free\n", fs->e2fs_fsmnt); return (ENOSPC); @@ -190,7 +189,7 @@ noinodes: * among those cylinder groups with above the average number of * free inodes, the one with the smallest number of directories. */ -static u_long +static int ext2fs_dirpref(struct m_ext2fs *fs) { int cg, maxspace, mincg, avgifree; @@ -220,7 +219,7 @@ ext2fs_dirpref(struct m_ext2fs *fs) * ufs/ufs/inode.h) help this. */ daddr_t -ext2fs_blkpref(struct inode *ip, int32_t lbn, int indx, int32_t *bap) +ext2fs_blkpref(struct inode *ip, u_int32_t lbn, int baps, u_int32_t *bap) { struct m_ext2fs *fs; int cg, i; @@ -241,7 +240,7 @@ ext2fs_blkpref(struct inode *ip, int32_t lbn, int indx, int32_t *bap) */ if (bap) { - for (i = indx; i >= 0 ; i--) { + for (i = baps; i >= 0 ; i--) { if (bap[i]) { return letoh32(bap[i]) + 1; } @@ -262,9 +261,9 @@ ext2fs_blkpref(struct inode *ip, int32_t lbn, int indx, int32_t *bap) * 2) quadratically rehash on the cylinder group number. * 3) brute force search for a free block. */ -static u_long -ext2fs_hashalloc(struct inode *ip, int cg, long pref, int size, - int32_t (*allocator)(struct inode *, int, int32_t, int)) +static u_int32_t +ext2fs_hashalloc(struct inode *ip, int cg, u_int32_t pref, int size, + u_int32_t (*allocator)(struct inode *, int, u_int32_t, int)) { struct m_ext2fs *fs; long result; @@ -311,14 +310,14 @@ ext2fs_hashalloc(struct inode *ip, int cg, long pref, int size, * Check to see if a block of the appropriate size is available, * and if it is, allocate it. */ - -static int32_t -ext2fs_alloccg(struct inode *ip, int cg, int32_t bpref, int size) +static u_int32_t +ext2fs_alloccg(struct inode *ip, int cg, u_int32_t bpref, int size) { struct m_ext2fs *fs; char *bbp; struct buf *bp; - int error, bno, start, end, loc; + u_int32_t bno; + int error, start, end, loc; fs = ip->i_e2fs; if (fs->e2fs_gd[cg].ext2bgd_nbfree == 0) @@ -370,15 +369,14 @@ ext2fs_alloccg(struct inode *ip, int cg, int32_t bpref, int size) bno = ext2fs_mapsearch(fs, bbp, bpref); if (bno < 0) return (0); -gotit: + gotit: #ifdef DIAGNOSTIC - if (isset(bbp, (long)bno)) { - printf("ext2fs_alloccgblk: cg=%d bno=%d fs=%s\n", - cg, bno, fs->e2fs_fsmnt); - panic("ext2fs_alloccg: dup alloc"); + if (isset(bbp, bno)) { + panic("%s: dup alloc: cg=%d bno=%u fs=%s\n", + __func__, cg, bno, fs->e2fs_fsmnt); } #endif - setbit(bbp, (long)bno); + setbit(bbp, bno); fs->e2fs.e2fs_fbcount--; fs->e2fs_gd[cg].ext2bgd_nbfree--; fs->e2fs_fmod = 1; @@ -395,8 +393,8 @@ gotit: * 2) allocate the next available inode after the requested * inode in the specified cylinder group. */ -static int32_t -ext2fs_nodealloccg(struct inode *ip, int cg, int32_t ipref, int mode) +static ufsino_t +ext2fs_nodealloccg(struct inode *ip, int cg, ufsino_t ipref, int mode) { struct m_ext2fs *fs; char *ibp; @@ -427,8 +425,8 @@ ext2fs_nodealloccg(struct inode *ip, int cg, int32_t ipref, int mode) start = 0; loc = skpc(0xff, len, &ibp[0]); if (loc == 0) { - printf("cg = %d, ipref = %d, fs = %s\n", - cg, ipref, fs->e2fs_fsmnt); + printf("cg = %d, ipref = %u, fs = %s\n", + cg, ipref, fs->e2fs_fsmnt); panic("ext2fs_nodealloccg: map corrupted"); /* NOTREACHED */ } @@ -444,7 +442,7 @@ ext2fs_nodealloccg(struct inode *ip, int cg, int32_t ipref, int mode) printf("fs = %s\n", fs->e2fs_fsmnt); panic("ext2fs_nodealloccg: block not in map"); /* NOTREACHED */ -gotit: + gotit: setbit(ibp, ipref); fs->e2fs.e2fs_ficount--; fs->e2fs_gd[cg].ext2bgd_nifree--; @@ -453,7 +451,7 @@ gotit: fs->e2fs_gd[cg].ext2bgd_ndirs++; } bdwrite(bp); - return (cg * fs->e2fs.e2fs_ipg + ipref +1); + return (cg * fs->e2fs.e2fs_ipg + ipref + 1); } /* @@ -463,7 +461,7 @@ gotit: * free map. */ void -ext2fs_blkfree(struct inode *ip, int32_t bno) +ext2fs_blkfree(struct inode *ip, u_int32_t bno) { struct m_ext2fs *fs; char *bbp; @@ -472,25 +470,24 @@ ext2fs_blkfree(struct inode *ip, int32_t bno) fs = ip->i_e2fs; cg = dtog(fs, bno); - if ((u_int)bno >= fs->e2fs.e2fs_bcount) { - printf("bad block %d, ino %u\n", bno, ip->i_number); + if (bno >= fs->e2fs.e2fs_bcount) { + printf("bad block %u, ino %u\n", bno, ip->i_number); ext2fs_fserr(fs, ip->i_e2fs_uid, "bad block"); return; } error = bread(ip->i_devvp, - fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_b_bitmap), - (int)fs->e2fs_bsize, &bp); + fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_b_bitmap), + (int)fs->e2fs_bsize, &bp); if (error) { brelse(bp); return; } bbp = (char *)bp->b_data; bno = dtogd(fs, bno); - if (isclr(bbp, bno)) { - printf("dev = 0x%x, block = %d, fs = %s\n", - ip->i_dev, bno, fs->e2fs_fsmnt); - panic("blkfree: freeing free block"); - } + if (isclr(bbp, bno)) + panic("%s: freeing free block: dev = 0x%x, block = %u, fs = %s\n", + __func__, ip->i_dev, bno, fs->e2fs_fsmnt); + clrbit(bbp, bno); fs->e2fs.e2fs_fbcount++; fs->e2fs_gd[cg].ext2bgd_nbfree++; @@ -504,7 +501,7 @@ ext2fs_blkfree(struct inode *ip, int32_t bno) * * The specified inode is placed back in the free map. */ -int +void ext2fs_inode_free(struct inode *pip, ufsino_t ino, mode_t mode) { struct m_ext2fs *fs; @@ -513,8 +510,8 @@ ext2fs_inode_free(struct inode *pip, ufsino_t ino, mode_t mode) int error, cg; fs = pip->i_e2fs; - if ((u_int)ino > fs->e2fs.e2fs_icount || (u_int)ino < EXT2_FIRSTINO) - panic("ifree: range: dev = 0x%x, ino = %d, fs = %s", + if (ino > fs->e2fs.e2fs_icount || ino < EXT2_FIRSTINO) + panic("ifree: range: dev = 0x%x, ino = %u, fs = %s", pip->i_dev, ino, fs->e2fs_fsmnt); cg = ino_to_cg(fs, ino); error = bread(pip->i_devvp, @@ -522,7 +519,7 @@ ext2fs_inode_free(struct inode *pip, ufsino_t ino, mode_t mode) (int)fs->e2fs_bsize, &bp); if (error) { brelse(bp); - return (0); + return; } ibp = (char *)bp->b_data; ino = (ino - 1) % fs->e2fs.e2fs_ipg; @@ -540,7 +537,6 @@ ext2fs_inode_free(struct inode *pip, ufsino_t ino, mode_t mode) } fs->e2fs_fmod = 1; bdwrite(bp); - return (0); } /* @@ -550,10 +546,10 @@ ext2fs_inode_free(struct inode *pip, ufsino_t ino, mode_t mode) * available. */ -static int32_t -ext2fs_mapsearch(struct m_ext2fs *fs, char *bbp, int32_t bpref) +static u_int32_t +ext2fs_mapsearch(struct m_ext2fs *fs, char *bbp, u_int32_t bpref) { - int32_t bno; + u_int32_t bno; int start, len, loc, i, map; /* @@ -598,6 +594,5 @@ ext2fs_mapsearch(struct m_ext2fs *fs, char *bbp, int32_t bpref) static void ext2fs_fserr(struct m_ext2fs *fs, uid_t uid, char *cp) { - log(LOG_ERR, "uid %u on %s: %s\n", uid, fs->e2fs_fsmnt, cp); } diff --git a/sys/ufs/ext2fs/ext2fs_balloc.c b/sys/ufs/ext2fs/ext2fs_balloc.c index dcd6cab908f..5932c19d81e 100644 --- a/sys/ufs/ext2fs/ext2fs_balloc.c +++ b/sys/ufs/ext2fs/ext2fs_balloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_balloc.c,v 1.22 2014/07/13 16:59:35 pelikan Exp $ */ +/* $OpenBSD: ext2fs_balloc.c,v 1.23 2014/07/14 08:54:13 pelikan Exp $ */ /* $NetBSD: ext2fs_balloc.c,v 1.10 2001/07/04 21:16:01 chs Exp $ */ /* @@ -54,17 +54,17 @@ * the inode and the logical block number in a file. */ int -ext2fs_buf_alloc(struct inode *ip, daddr_t bn, int size, struct ucred *cred, +ext2fs_buf_alloc(struct inode *ip, u_int32_t bn, int size, struct ucred *cred, struct buf **bpp, int flags) { struct m_ext2fs *fs; struct buf *bp, *nbp; struct vnode *vp = ITOV(ip); struct indir indirs[NIADDR + 2]; - int32_t nb, newb, *bap; + u_int32_t nb, newb, *bap; int num, i, error; u_int deallocated; - int32_t *allocib, *blkp, *allocblk, allociblk[NIADDR + 1]; + u_int32_t *allocib, *blkp, *allocblk, allociblk[NIADDR + 1]; int unwindidx = -1; daddr_t lbn, pref; @@ -126,7 +126,7 @@ ext2fs_buf_alloc(struct inode *ip, daddr_t bn, int size, struct ucred *cred, allocib = NULL; allocblk = allociblk; if (nb == 0) { - pref = ext2fs_blkpref(ip, lbn, 0, (int32_t *)0); + pref = ext2fs_blkpref(ip, lbn, 0, NULL); error = ext2fs_alloc(ip, lbn, pref, cred, &newb); if (error) return (error); @@ -156,7 +156,7 @@ ext2fs_buf_alloc(struct inode *ip, daddr_t bn, int size, struct ucred *cred, brelse(bp); goto fail; } - bap = (int32_t *)bp->b_data; + bap = (u_int32_t *)bp->b_data; nb = letoh32(bap[indirs[i].in_off]); if (i == num) break; @@ -165,7 +165,7 @@ ext2fs_buf_alloc(struct inode *ip, daddr_t bn, int size, struct ucred *cred, brelse(bp); continue; } - pref = ext2fs_blkpref(ip, lbn, 0, (int32_t *)0); + pref = ext2fs_blkpref(ip, lbn, 0, NULL); error = ext2fs_alloc(ip, lbn, pref, cred, &newb); if (error) { brelse(bp); @@ -202,7 +202,7 @@ ext2fs_buf_alloc(struct inode *ip, daddr_t bn, int size, struct ucred *cred, * Get the data block, allocating if necessary. */ if (nb == 0) { - pref = ext2fs_blkpref(ip, lbn, indirs[num].in_off, &bap[0]); + pref = ext2fs_blkpref(ip, lbn, indirs[num].in_off, bap); error = ext2fs_alloc(ip, lbn, pref, cred, &newb); if (error) { brelse(bp); @@ -263,7 +263,7 @@ fail: if (r) { panic("Could not unwind indirect block, error %d", r); } else { - bap = (int32_t *)bp->b_data; + bap = (u_int32_t *)bp->b_data; bap[indirs[unwindidx].in_off] = 0; if (flags & B_SYNC) bwrite(bp); diff --git a/sys/ufs/ext2fs/ext2fs_bmap.c b/sys/ufs/ext2fs/ext2fs_bmap.c index 364a030bd3b..fa4e722f001 100644 --- a/sys/ufs/ext2fs/ext2fs_bmap.c +++ b/sys/ufs/ext2fs/ext2fs_bmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_bmap.c,v 1.24 2014/07/13 16:59:35 pelikan Exp $ */ +/* $OpenBSD: ext2fs_bmap.c,v 1.25 2014/07/14 08:54:13 pelikan Exp $ */ /* $NetBSD: ext2fs_bmap.c,v 1.5 2000/03/30 12:41:11 augustss Exp $ */ /* @@ -239,10 +239,11 @@ ext2fs_bmaparray(struct vnode *vp, daddr_t bn, daddr_t *bnp, daddr = letoh32(((int32_t *)bp->b_data)[xap->in_off]); if (num == 1 && daddr && runp) for (bn = xap->in_off + 1; - bn < MNINDIR(ump) && *runp < maxrun && - is_sequential(ump, ((int32_t *)bp->b_data)[bn - 1], - ((int32_t *)bp->b_data)[bn]); - ++bn, ++*runp); + bn < MNINDIR(ump) && *runp < maxrun && + is_sequential(ump, ((u_int32_t *)bp->b_data)[bn - 1], + ((u_int32_t *)bp->b_data)[bn]); + ++bn, ++*runp) + /* nothing */; } if (bp) brelse(bp); diff --git a/sys/ufs/ext2fs/ext2fs_bswap.c b/sys/ufs/ext2fs/ext2fs_bswap.c index 232d746e5e1..720310cee7f 100644 --- a/sys/ufs/ext2fs/ext2fs_bswap.c +++ b/sys/ufs/ext2fs/ext2fs_bswap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_bswap.c,v 1.6 2014/07/13 13:28:26 pelikan Exp $ */ +/* $OpenBSD: ext2fs_bswap.c,v 1.7 2014/07/14 08:54:13 pelikan Exp $ */ /* $NetBSD: ext2fs_bswap.c,v 1.6 2000/07/24 00:23:10 mycroft Exp $ */ /* @@ -37,6 +37,7 @@ #if defined(_KERNEL) #include #endif + #include #include @@ -83,6 +84,15 @@ e2fs_sb_bswap(struct ext2fs *old, struct ext2fs *new) new->e2fs_features_incompat = swap32(old->e2fs_features_incompat); new->e2fs_features_rocompat = swap32(old->e2fs_features_rocompat); new->e2fs_algo = swap32(old->e2fs_algo); + + /* SOME journaling-related fields. */ + new->e2fs_journal_ino = swap32(old->e2fs_journal_ino); + new->e2fs_journal_dev = swap32(old->e2fs_journal_dev); + new->e2fs_last_orphan = swap32(old->e2fs_last_orphan); + new->e2fs_gdesc_size = swap16(old->e2fs_gdesc_size); + new->e2fs_default_mount_opts = swap32(old->e2fs_default_mount_opts); + new->e2fs_first_meta_bg = swap32(old->e2fs_first_meta_bg); + new->e2fs_mkfs_time = swap32(old->e2fs_mkfs_time); } void diff --git a/sys/ufs/ext2fs/ext2fs_extern.h b/sys/ufs/ext2fs/ext2fs_extern.h index 0b566e0071f..a8c41721c49 100644 --- a/sys/ufs/ext2fs/ext2fs_extern.h +++ b/sys/ufs/ext2fs/ext2fs_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_extern.h,v 1.34 2014/05/27 14:31:24 krw Exp $ */ +/* $OpenBSD: ext2fs_extern.h,v 1.35 2014/07/14 08:54:13 pelikan Exp $ */ /* $NetBSD: ext2fs_extern.h,v 1.1 1997/06/11 09:33:55 bouyer Exp $ */ /*- @@ -57,95 +57,89 @@ extern struct pool ext2fs_dinode_pool; /* memory pool for dinodes */ __BEGIN_DECLS /* ext2fs_alloc.c */ -int ext2fs_alloc(struct inode *, int32_t, int32_t , struct ucred *, - int32_t *); -int ext2fs_realloccg(struct inode *, int32_t, int32_t, int, int, - struct ucred *, struct buf **); -int ext2fs_reallocblks(void *); -int ext2fs_inode_alloc(struct inode *pip, mode_t mode, struct ucred *, - struct vnode **); -daddr_t ext2fs_blkpref(struct inode *, int32_t, int, int32_t *); -void ext2fs_blkfree(struct inode *, int32_t); -int ext2fs_inode_free(struct inode *pip, ufsino_t ino, mode_t mode); +int ext2fs_alloc(struct inode *, u_int32_t, u_int32_t , struct ucred *, + u_int32_t *); +int ext2fs_inode_alloc(struct inode *, mode_t mode, struct ucred *, + struct vnode **); +daddr_t ext2fs_blkpref(struct inode *, u_int32_t, int, u_int32_t *); +void ext2fs_blkfree(struct inode *, u_int32_t); +void ext2fs_inode_free(struct inode *, ufsino_t, mode_t); /* ext2fs_balloc.c */ -int ext2fs_buf_alloc(struct inode *, daddr_t, int, struct ucred *, - struct buf **, int); +int ext2fs_buf_alloc(struct inode *, u_int32_t, int, struct ucred *, + struct buf **, int); /* ext2fs_bmap.c */ -int ext2fs_bmap(void *); +int ext2fs_bmap(void *); /* ext2fs_inode.c */ -int ext2fs_init(struct vfsconf *); -u_int64_t ext2fs_size(struct inode *); -int ext2fs_setsize(struct inode *, u_int64_t); -int ext2fs_update(struct inode *ip, int waitfor); -int ext2fs_truncate(struct inode *, off_t, int, struct ucred *); -int ext2fs_inactive(void *); +u_int64_t ext2fs_size(struct inode *); +int ext2fs_init(struct vfsconf *); +int ext2fs_setsize(struct inode *, u_int64_t); +int ext2fs_update(struct inode *ip, int waitfor); +int ext2fs_truncate(struct inode *, off_t, int, struct ucred *); +int ext2fs_inactive(void *); /* ext2fs_lookup.c */ -int ext2fs_readdir(void *); -int ext2fs_lookup(void *); -int ext2fs_direnter(struct inode *, struct vnode *, - struct componentname *); -int ext2fs_dirremove(struct vnode *, struct componentname *); -int ext2fs_dirrewrite(struct inode *, struct inode *, - struct componentname *); -int ext2fs_dirempty(struct inode *, ufsino_t, struct ucred *); -int ext2fs_checkpath(struct inode *, struct inode *, struct ucred *); +int ext2fs_readdir(void *); +int ext2fs_lookup(void *); +int ext2fs_direnter(struct inode *, struct vnode *, struct componentname *); +int ext2fs_dirremove(struct vnode *, struct componentname *); +int ext2fs_dirrewrite(struct inode *, struct inode *, struct componentname *); +int ext2fs_dirempty(struct inode *, ufsino_t, struct ucred *); +int ext2fs_checkpath(struct inode *, struct inode *, struct ucred *); /* ext2fs_subr.c */ -int ext2fs_bufatoff(struct inode *, off_t, char **, struct buf **); -int ext2fs_vinit(struct mount *, struct vops *, struct vops *, - struct vnode **); -void ext2fs_fragacct(struct m_ext2fs *, int, int32_t[], int); +int ext2fs_bufatoff(struct inode *, off_t, char **, struct buf **); +int ext2fs_vinit(struct mount *, struct vops *, struct vops *, + struct vnode **); #ifdef DIAGNOSTIC void ext2fs_checkoverlap(struct buf *, struct inode *); #endif /* ext2fs_vfsops.c */ -int ext2fs_mountroot(void); -int ext2fs_mount(struct mount *, const char *, void *, - struct nameidata *, struct proc *); -int ext2fs_reload(struct mount *, struct ucred *, struct proc *); -int ext2fs_mountfs(struct vnode *, struct mount *, struct proc *); -int ext2fs_unmount(struct mount *, int, struct proc *); -int ext2fs_flushfiles(struct mount *, int, struct proc *); -int ext2fs_statfs(struct mount *, struct statfs *, struct proc *); -int ext2fs_sync(struct mount *, int, struct ucred *, struct proc *); -int ext2fs_vget(struct mount *, ino_t, struct vnode **); -int ext2fs_fhtovp(struct mount *, struct fid *, struct vnode **); -int ext2fs_vptofh(struct vnode *, struct fid *); -int ext2fs_sbupdate(struct ufsmount *, int); -int ext2fs_cgupdate(struct ufsmount *, int); -int ext2fs_sysctl(int *, u_int, void *, size_t *, void *, size_t, - struct proc *); +int ext2fs_mountroot(void); +int ext2fs_mount(struct mount *, const char *, void *, struct nameidata *, + struct proc *); +int ext2fs_reload(struct mount *, struct ucred *, struct proc *); +int ext2fs_mountfs(struct vnode *, struct mount *, struct proc *); +int ext2fs_unmount(struct mount *, int, struct proc *); +int ext2fs_flushfiles(struct mount *, int, struct proc *); +int ext2fs_statfs(struct mount *, struct statfs *, struct proc *); +int ext2fs_sync(struct mount *, int, struct ucred *, struct proc *); +int ext2fs_vget(struct mount *, ino_t, struct vnode **); +int ext2fs_fhtovp(struct mount *, struct fid *, struct vnode **); +int ext2fs_vptofh(struct vnode *, struct fid *); +int ext2fs_sbupdate(struct ufsmount *, int); +int ext2fs_cgupdate(struct ufsmount *, int); +int ext2fs_sysctl(int *, u_int, void *, size_t *, void *, size_t, + struct proc *); /* ext2fs_readwrite.c */ -int ext2fs_read(void *); -int ext2fs_write(void *); +int ext2fs_read(void *); +int ext2fs_write(void *); /* ext2fs_vnops.c */ -int ext2fs_create(void *); -int ext2fs_mknod(void *); -int ext2fs_open(void *); -int ext2fs_access(void *); -int ext2fs_getattr(void *); -int ext2fs_setattr(void *); -int ext2fs_remove(void *); -int ext2fs_link(void *); -int ext2fs_rename(void *); -int ext2fs_mkdir(void *); -int ext2fs_rmdir(void *); -int ext2fs_symlink(void *); -int ext2fs_readlink(void *); -int ext2fs_pathconf(void *); -int ext2fs_advlock(void *); -int ext2fs_makeinode(int, struct vnode *, struct vnode **, - struct componentname *cnp); -int ext2fs_fsync(void *); -int ext2fs_reclaim(void *); -int ext2fsfifo_reclaim(void *); +int ext2fs_create(void *); +int ext2fs_mknod(void *); +int ext2fs_open(void *); +int ext2fs_access(void *); +int ext2fs_getattr(void *); +int ext2fs_setattr(void *); +int ext2fs_remove(void *); +int ext2fs_link(void *); +int ext2fs_rename(void *); +int ext2fs_mkdir(void *); +int ext2fs_rmdir(void *); +int ext2fs_symlink(void *); +int ext2fs_readlink(void *); +int ext2fs_pathconf(void *); +int ext2fs_advlock(void *); +int ext2fs_makeinode(int, struct vnode *, struct vnode **, + struct componentname *cnp); +int ext2fs_fsync(void *); +int ext2fs_reclaim(void *); +int ext2fsfifo_reclaim(void *); __END_DECLS diff --git a/sys/ufs/ufs/inode.h b/sys/ufs/ufs/inode.h index 46e7e53705a..ffa0e5fa4a5 100644 --- a/sys/ufs/ufs/inode.h +++ b/sys/ufs/ufs/inode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: inode.h,v 1.48 2014/07/13 13:28:26 pelikan Exp $ */ +/* $OpenBSD: inode.h,v 1.49 2014/07/14 08:54:13 pelikan Exp $ */ /* $NetBSD: inode.h,v 1.8 1995/06/15 23:22:50 cgd Exp $ */ /* @@ -49,8 +49,8 @@ * Per-filesystem inode extensions. */ struct ext2fs_inode_ext { - int32_t ext2fs_last_lblk; /* last logical block allocated */ - int32_t ext2fs_last_blk; /* last block allocated on disk */ + u_int32_t ext2fs_last_lblk; /* last logical blk allocated */ + u_int32_t ext2fs_last_blk; /* last blk allocated on disk */ u_int32_t ext2fs_effective_uid; /* effective inode uid */ u_int32_t ext2fs_effective_gid; /* effective inode gid */ struct ext4_extent_cache ext2fs_extent_cache; -- 2.20.1