diff options
author | 2001-09-17 23:25:04 +0000 | |
---|---|---|
committer | 2001-09-17 23:25:04 +0000 | |
commit | f5ff774d026e168d849b3ca3761ac8d27a80e8c4 (patch) | |
tree | 5ec67973fe09fa84292e450c123cbb2e6b834a11 /sys | |
parent | document flags for cu (diff) | |
download | wireguard-openbsd-f5ff774d026e168d849b3ca3761ac8d27a80e8c4.tar.xz wireguard-openbsd-f5ff774d026e168d849b3ca3761ac8d27a80e8c4.zip |
Cleanups. Mostly from NetBSD.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_alloc.c | 104 |
1 files changed, 51 insertions, 53 deletions
diff --git a/sys/ufs/ext2fs/ext2fs_alloc.c b/sys/ufs/ext2fs/ext2fs_alloc.c index a92a896e68d..17e0ced02a0 100644 --- a/sys/ufs/ext2fs/ext2fs_alloc.c +++ b/sys/ufs/ext2fs/ext2fs_alloc.c @@ -1,5 +1,5 @@ -/* $OpenBSD: ext2fs_alloc.c,v 1.6 2001/06/23 02:07:50 csapuntz Exp $ */ -/* $NetBSD: ext2fs_alloc.c,v 1.1 1997/06/11 09:33:41 bouyer Exp $ */ +/* $OpenBSD: ext2fs_alloc.c,v 1.7 2001/09/17 23:25:04 art Exp $ */ +/* $NetBSD: ext2fs_alloc.c,v 1.10 2001/07/05 08:38:27 toshii Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -47,8 +47,6 @@ #include <sys/kernel.h> #include <sys/syslog.h> -#include <vm/vm.h> - #include <ufs/ufs/quota.h> #include <ufs/ufs/inode.h> #include <ufs/ufs/ufs_extern.h> @@ -58,14 +56,14 @@ u_long ext2gennumber; -static daddr_t ext2fs_alloccg __P((struct inode *, int, daddr_t, int)); +static ufs_daddr_t ext2fs_alloccg __P((struct inode *, int, ufs_daddr_t, int)); static u_long ext2fs_dirpref __P((struct m_ext2fs *)); static void ext2fs_fserr __P((struct m_ext2fs *, u_int, char *)); static u_long ext2fs_hashalloc __P((struct inode *, int, long, int, - daddr_t (*)(struct inode *, int, daddr_t, + ufs_daddr_t (*)(struct inode *, int, ufs_daddr_t, int))); -static daddr_t ext2fs_nodealloccg __P((struct inode *, int, daddr_t, int)); -static daddr_t ext2fs_mapsearch __P((struct m_ext2fs *, char *, daddr_t)); +static ufs_daddr_t ext2fs_nodealloccg __P((struct inode *, int, ufs_daddr_t, int)); +static ufs_daddr_t ext2fs_mapsearch __P((struct m_ext2fs *, char *, ufs_daddr_t)); /* * Allocate a block in the file system. @@ -86,13 +84,13 @@ static daddr_t ext2fs_mapsearch __P((struct m_ext2fs *, char *, daddr_t)); */ int ext2fs_alloc(ip, lbn, bpref, cred, bnp) - register struct inode *ip; - daddr_t lbn, bpref; + struct inode *ip; + ufs_daddr_t lbn, bpref; struct ucred *cred; - daddr_t *bnp; + ufs_daddr_t *bnp; { - register struct m_ext2fs *fs; - daddr_t bno; + struct m_ext2fs *fs; + ufs_daddr_t bno; int cg; *bnp = 0; @@ -111,7 +109,7 @@ ext2fs_alloc(ip, lbn, bpref, cred, bnp) cg = ino_to_cg(fs, ip->i_number); else cg = dtog(fs, bpref); - bno = (daddr_t)ext2fs_hashalloc(ip, cg, bpref, fs->e2fs_bsize, + bno = (ufs_daddr_t)ext2fs_hashalloc(ip, cg, bpref, fs->e2fs_bsize, ext2fs_alloccg); if (bno > 0) { ip->i_e2fs_nblock += btodb(fs->e2fs_bsize); @@ -200,7 +198,7 @@ noinodes: */ static u_long ext2fs_dirpref(fs) - register struct m_ext2fs *fs; + struct m_ext2fs *fs; { int cg, maxspace, mincg, avgifree; @@ -225,18 +223,18 @@ ext2fs_dirpref(fs) * If no blocks have been allocated in the first section, the policy is to * request a block in the same cylinder group as the inode that describes * the file. Otherwise, the policy is to try to allocate the blocks - * contigously. The two fields of the ext2 inode extention (see + * contigously. The two fields of the ext2 inode extension (see * ufs/ufs/inode.h) help this. */ -daddr_t +ufs_daddr_t ext2fs_blkpref(ip, lbn, indx, bap) struct inode *ip; - daddr_t lbn; + ufs_daddr_t lbn; int indx; - daddr_t *bap; + ufs_daddr_t *bap; { - register struct m_ext2fs *fs; - register int cg, i; + struct m_ext2fs *fs; + int cg, i; fs = ip->i_e2fs; /* @@ -281,9 +279,9 @@ ext2fs_hashalloc(ip, cg, pref, size, allocator) int cg; long pref; int size; /* size for data blocks, mode for inodes */ - daddr_t (*allocator) __P((struct inode *, int, daddr_t, int)); + ufs_daddr_t (*allocator) __P((struct inode *, int, ufs_daddr_t, int)); { - register struct m_ext2fs *fs; + struct m_ext2fs *fs; long result; int i, icg = cg; @@ -319,7 +317,7 @@ ext2fs_hashalloc(ip, cg, pref, size, allocator) if (cg == fs->e2fs_ncg) cg = 0; } - return (NULL); + return (0); } /* @@ -329,27 +327,27 @@ ext2fs_hashalloc(ip, cg, pref, size, allocator) * and if it is, allocate it. */ -static daddr_t +static ufs_daddr_t ext2fs_alloccg(ip, cg, bpref, size) struct inode *ip; int cg; - daddr_t bpref; + ufs_daddr_t bpref; int size; { - register struct m_ext2fs *fs; - register char *bbp; + struct m_ext2fs *fs; + char *bbp; struct buf *bp; int error, bno, start, end, loc; fs = ip->i_e2fs; if (fs->e2fs_gd[cg].ext2bgd_nbfree == 0) - return (NULL); - error = bread(ip->i_devvp, fsbtodb(fs, - fs->e2fs_gd[cg].ext2bgd_b_bitmap), + return (0); + error = bread(ip->i_devvp, fsbtodb(fs, + fs->e2fs_gd[cg].ext2bgd_b_bitmap), (int)fs->e2fs_bsize, NOCRED, &bp); if (error) { brelse(bp); - return (NULL); + return (0); } bbp = (char *)bp->b_data; @@ -391,13 +389,13 @@ ext2fs_alloccg(ip, cg, bpref, size) bno = ext2fs_mapsearch(fs, bbp, bpref); if (bno < 0) - return (NULL); + return (0); 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_valloc: dup alloc"); + panic("ext2fs_alloccg: dup alloc"); } #endif setbit(bbp, (long)bno); @@ -417,28 +415,28 @@ gotit: * 2) allocate the next available inode after the requested * inode in the specified cylinder group. */ -static daddr_t +static ufs_daddr_t ext2fs_nodealloccg(ip, cg, ipref, mode) struct inode *ip; int cg; - daddr_t ipref; + ufs_daddr_t ipref; int mode; { - register struct m_ext2fs *fs; - register char *ibp; + struct m_ext2fs *fs; + char *ibp; struct buf *bp; int error, start, len, loc, map, i; ipref--; /* to avoid a lot of (ipref -1) */ fs = ip->i_e2fs; if (fs->e2fs_gd[cg].ext2bgd_nifree == 0) - return (NULL); - error = bread(ip->i_devvp, fsbtodb(fs, - fs->e2fs_gd[cg].ext2bgd_i_bitmap), + return (0); + error = bread(ip->i_devvp, fsbtodb(fs, + fs->e2fs_gd[cg].ext2bgd_i_bitmap), (int)fs->e2fs_bsize, NOCRED, &bp); if (error) { brelse(bp); - return (NULL); + return (0); } ibp = (char *)bp->b_data; if (ipref) { @@ -491,11 +489,11 @@ gotit: */ void ext2fs_blkfree(ip, bno) - register struct inode *ip; - daddr_t bno; + struct inode *ip; + ufs_daddr_t bno; { - register struct m_ext2fs *fs; - register char *bbp; + struct m_ext2fs *fs; + char *bbp; struct buf *bp; int error, cg; @@ -506,8 +504,8 @@ ext2fs_blkfree(ip, bno) ext2fs_fserr(fs, ip->i_e2fs_uid, "bad block"); return; } - error = bread(ip->i_devvp, fsbtodb(fs, - fs->e2fs_gd[cg].ext2bgd_b_bitmap), + error = bread(ip->i_devvp, + fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_b_bitmap), (int)fs->e2fs_bsize, NOCRED, &bp); if (error) { brelse(bp); @@ -579,13 +577,13 @@ ext2fs_inode_free(struct inode *pip, ino_t ino, int mode) * available. */ -static daddr_t +static ufs_daddr_t ext2fs_mapsearch(fs, bbp, bpref) - register struct m_ext2fs *fs; - register char *bbp; - daddr_t bpref; + struct m_ext2fs *fs; + char *bbp; + ufs_daddr_t bpref; { - daddr_t bno; + ufs_daddr_t bno; int start, len, loc, i, map; /* |