summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1996-02-27 07:27:42 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1996-02-27 07:27:42 +0000
commite1d50524a19b291d7ddb25c7d05b8086df55b1c0 (patch)
tree6b1fba1880af780494d2e8df73cabcf9d30b36c6
parent6fbea858373322940c41a040e3a5dce6edf08661 (diff)
From NetBSD: update to 960217 sources
-rw-r--r--sys/ufs/ffs/ffs_alloc.c64
-rw-r--r--sys/ufs/ffs/ffs_balloc.c25
-rw-r--r--sys/ufs/ffs/ffs_extern.h97
-rw-r--r--sys/ufs/ffs/ffs_inode.c55
-rw-r--r--sys/ufs/ffs/ffs_subr.c12
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c87
-rw-r--r--sys/ufs/ffs/ffs_vnops.c32
7 files changed, 222 insertions, 150 deletions
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c
index 4b99b553415..8386bd839d1 100644
--- a/sys/ufs/ffs/ffs_alloc.c
+++ b/sys/ufs/ffs/ffs_alloc.c
@@ -1,4 +1,5 @@
-/* $NetBSD: ffs_alloc.c,v 1.8 1995/07/19 15:47:36 cgd Exp $ */
+/* $OpenBSD: ffs_alloc.c,v 1.2 1996/02/27 07:27:34 niklas Exp $ */
+/* $NetBSD: ffs_alloc.c,v 1.9 1996/02/09 22:22:18 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -48,6 +49,7 @@
#include <ufs/ufs/quota.h>
#include <ufs/ufs/inode.h>
+#include <ufs/ufs/ufs_extern.h>
#include <ufs/ffs/fs.h>
#include <ufs/ffs/ffs_extern.h>
@@ -60,9 +62,10 @@ static daddr_t ffs_clusteralloc __P((struct inode *, int, daddr_t, int));
static ino_t ffs_dirpref __P((struct fs *));
static daddr_t ffs_fragextend __P((struct inode *, int, long, int, int));
static void ffs_fserr __P((struct fs *, u_int, char *));
-static u_long ffs_hashalloc
- __P((struct inode *, int, long, int, u_int32_t (*)()));
-static ino_t ffs_nodealloccg __P((struct inode *, int, daddr_t, int));
+static u_long ffs_hashalloc __P((struct inode *, int, long, int,
+ daddr_t (*)(struct inode *, int, daddr_t,
+ int)));
+static daddr_t ffs_nodealloccg __P((struct inode *, int, daddr_t, int));
static daddr_t ffs_mapsearch __P((struct fs *, struct cg *, daddr_t, int));
/*
@@ -84,6 +87,7 @@ static daddr_t ffs_mapsearch __P((struct fs *, struct cg *, daddr_t, int));
* 2) quadradically rehash into other cylinder groups, until an
* available block is located.
*/
+int
ffs_alloc(ip, lbn, bpref, size, cred, bnp)
register struct inode *ip;
daddr_t lbn, bpref;
@@ -93,7 +97,10 @@ ffs_alloc(ip, lbn, bpref, size, cred, bnp)
{
register struct fs *fs;
daddr_t bno;
- int cg, error;
+ int cg;
+#ifdef QUOTA
+ int error;
+#endif
*bnp = 0;
fs = ip->i_fs;
@@ -111,7 +118,7 @@ ffs_alloc(ip, lbn, bpref, size, cred, bnp)
if (cred->cr_uid != 0 && freespace(fs, fs->fs_minfree) <= 0)
goto nospace;
#ifdef QUOTA
- if (error = chkdq(ip, (long)btodb(size), cred, 0))
+ if ((error = chkdq(ip, (long)btodb(size), cred, 0)) != 0)
return (error);
#endif
if (bpref >= fs->fs_size)
@@ -121,7 +128,7 @@ ffs_alloc(ip, lbn, bpref, size, cred, bnp)
else
cg = dtog(fs, bpref);
bno = (daddr_t)ffs_hashalloc(ip, cg, (long)bpref, size,
- (u_int32_t (*)())ffs_alloccg);
+ ffs_alloccg);
if (bno > 0) {
ip->i_blocks += btodb(size);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
@@ -148,6 +155,7 @@ nospace:
* the original block. Failing that, the regular block allocator is
* invoked to get an appropriate block.
*/
+int
ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp)
register struct inode *ip;
daddr_t lbprev;
@@ -184,12 +192,12 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp)
/*
* Allocate the extra space in the buffer.
*/
- if (error = bread(ITOV(ip), lbprev, osize, NOCRED, &bp)) {
+ if ((error = bread(ITOV(ip), lbprev, osize, NOCRED, &bp)) != 0) {
brelse(bp);
return (error);
}
#ifdef QUOTA
- if (error = chkdq(ip, (long)btodb(nsize - osize), cred, 0)) {
+ if ((error = chkdq(ip, (long)btodb(nsize - osize), cred, 0)) != 0) {
brelse(bp);
return (error);
}
@@ -198,7 +206,7 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp)
* Check for extension in the existing location.
*/
cg = dtog(fs, bprev);
- if (bno = ffs_fragextend(ip, cg, (long)bprev, osize, nsize)) {
+ if ((bno = ffs_fragextend(ip, cg, (long)bprev, osize, nsize)) != 0) {
if (bp->b_blkno != fsbtodb(fs, bno))
panic("bad blockno");
ip->i_blocks += btodb(nsize - osize);
@@ -258,7 +266,7 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp)
/* NOTREACHED */
}
bno = (daddr_t)ffs_hashalloc(ip, cg, (long)bpref, request,
- (u_int32_t (*)())ffs_alloccg);
+ ffs_alloccg);
if (bno > 0) {
bp->b_blkno = fsbtodb(fs, bno);
(void) vnode_pager_uncache(ITOV(ip));
@@ -315,19 +323,20 @@ struct ctldebug debug15 = { "prtrealloc", &prtrealloc };
#endif
int
-ffs_reallocblks(ap)
+ffs_reallocblks(v)
+ void *v;
+{
struct vop_reallocblks_args /* {
struct vnode *a_vp;
struct cluster_save *a_buflist;
- } */ *ap;
-{
+ } */ *ap = v;
struct fs *fs;
struct inode *ip;
struct vnode *vp;
struct buf *sbp, *ebp;
- daddr_t *bap, *sbap, *ebap;
+ daddr_t *bap, *sbap, *ebap = NULL;
struct cluster_save *buflist;
- daddr_t start_lbn, end_lbn, soff, eoff, newblk, blkno;
+ daddr_t start_lbn, end_lbn, soff, newblk, blkno;
struct indir start_ap[NIADDR + 1], end_ap[NIADDR + 1], *idp;
int i, len, start_lvl, end_lvl, pref, ssize;
@@ -394,7 +403,7 @@ ffs_reallocblks(ap)
* Search the block map looking for an allocation of the desired size.
*/
if ((newblk = (daddr_t)ffs_hashalloc(ip, dtog(fs, pref), (long)pref,
- len, (u_int32_t (*)())ffs_clusteralloc)) == 0)
+ len, ffs_clusteralloc)) == 0)
goto fail;
/*
* We have found a new contiguous block.
@@ -499,14 +508,16 @@ fail:
* 2) quadradically rehash into other cylinder groups, until an
* available inode is located.
*/
-ffs_valloc(ap)
+int
+ffs_valloc(v)
+ void *v;
+{
struct vop_valloc_args /* {
struct vnode *a_pvp;
int a_mode;
struct ucred *a_cred;
struct vnode **a_vpp;
- } */ *ap;
-{
+ } */ *ap = v;
register struct vnode *pvp = ap->a_pvp;
register struct inode *pip;
register struct fs *fs;
@@ -690,7 +701,7 @@ ffs_hashalloc(ip, cg, pref, size, allocator)
int cg;
long pref;
int size; /* size for data blocks, mode for inodes */
- u_int32_t (*allocator)();
+ daddr_t (*allocator) __P((struct inode *, int, daddr_t, int));
{
register struct fs *fs;
long result;
@@ -1118,7 +1129,7 @@ fail:
* 2) allocate the next available inode after the requested
* inode in the specified cylinder group.
*/
-static ino_t
+static daddr_t
ffs_nodealloccg(ip, cg, ipref, mode)
struct inode *ip;
int cg;
@@ -1198,6 +1209,7 @@ gotit:
* free map. If a fragment is deallocated, a possible
* block reassembly is checked.
*/
+void
ffs_blkfree(ip, bno, size)
register struct inode *ip;
daddr_t bno;
@@ -1303,13 +1315,14 @@ ffs_blkfree(ip, bno, size)
* The specified inode is placed back in the free map.
*/
int
-ffs_vfree(ap)
+ffs_vfree(v)
+ void *v;
+{
struct vop_vfree_args /* {
struct vnode *a_pvp;
ino_t a_ino;
int a_mode;
- } */ *ap;
-{
+ } */ *ap = v;
register struct fs *fs;
register struct cg *cgp;
register struct inode *pip;
@@ -1428,6 +1441,7 @@ ffs_mapsearch(fs, cgp, bpref, allocsiz)
*
* Cnt == 1 means free; cnt == -1 means allocating.
*/
+void
ffs_clusteracct(fs, cgp, blkno, cnt)
struct fs *fs;
struct cg *cgp;
diff --git a/sys/ufs/ffs/ffs_balloc.c b/sys/ufs/ffs/ffs_balloc.c
index 8b6b58576a2..dfd6468d8e7 100644
--- a/sys/ufs/ffs/ffs_balloc.c
+++ b/sys/ufs/ffs/ffs_balloc.c
@@ -1,4 +1,5 @@
-/* $NetBSD: ffs_balloc.c,v 1.2 1994/06/29 06:46:29 cgd Exp $ */
+/* $OpenBSD: ffs_balloc.c,v 1.2 1996/02/27 07:27:35 niklas Exp $ */
+/* $NetBSD: ffs_balloc.c,v 1.3 1996/02/09 22:22:21 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -56,6 +57,7 @@
* by allocating the physical blocks on a device given
* the inode and the logical block number in a file.
*/
+int
ffs_balloc(ip, bn, size, cred, bpp, flags)
register struct inode *ip;
register daddr_t bn;
@@ -159,7 +161,7 @@ ffs_balloc(ip, bn, size, cred, bpp, flags)
* Determine the number of levels of indirection.
*/
pref = 0;
- if (error = ufs_getlbns(vp, bn, indirs, &num))
+ if ((error = ufs_getlbns(vp, bn, indirs, &num)) != 0)
return(error);
#ifdef DIAGNOSTIC
if (num < 1)
@@ -172,8 +174,9 @@ ffs_balloc(ip, bn, size, cred, bpp, flags)
nb = ip->i_ib[indirs[0].in_off];
if (nb == 0) {
pref = ffs_blkpref(ip, lbn, 0, (daddr_t *)0);
- if (error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize,
- cred, &newb))
+ error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize,
+ cred, &newb);
+ if (error)
return (error);
nb = newb;
bp = getblk(vp, indirs[1].in_lbn, fs->fs_bsize, 0, 0);
@@ -183,7 +186,7 @@ ffs_balloc(ip, bn, size, cred, bpp, flags)
* Write synchronously so that indirect blocks
* never point at garbage.
*/
- if (error = bwrite(bp)) {
+ if ((error = bwrite(bp)) != 0) {
ffs_blkfree(ip, nb, fs->fs_bsize);
return (error);
}
@@ -211,8 +214,9 @@ ffs_balloc(ip, bn, size, cred, bpp, flags)
}
if (pref == 0)
pref = ffs_blkpref(ip, lbn, 0, (daddr_t *)0);
- if (error =
- ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, cred, &newb)) {
+ error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, cred,
+ &newb);
+ if (error) {
brelse(bp);
return (error);
}
@@ -224,7 +228,7 @@ ffs_balloc(ip, bn, size, cred, bpp, flags)
* Write synchronously so that indirect blocks
* never point at garbage.
*/
- if (error = bwrite(nbp)) {
+ if ((error = bwrite(nbp)) != 0) {
ffs_blkfree(ip, nb, fs->fs_bsize);
brelse(bp);
return (error);
@@ -245,8 +249,9 @@ ffs_balloc(ip, bn, size, cred, bpp, flags)
*/
if (nb == 0) {
pref = ffs_blkpref(ip, lbn, indirs[i].in_off, &bap[0]);
- if (error = ffs_alloc(ip,
- lbn, pref, (int)fs->fs_bsize, cred, &newb)) {
+ error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, cred,
+ &newb);
+ if (error) {
brelse(bp);
return (error);
}
diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h
index b676e9dd8d9..94ca01ad634 100644
--- a/sys/ufs/ffs/ffs_extern.h
+++ b/sys/ufs/ffs/ffs_extern.h
@@ -1,4 +1,5 @@
-/* $NetBSD: ffs_extern.h,v 1.3 1994/10/20 04:20:57 cgd Exp $ */
+/* $OpenBSD: ffs_extern.h,v 1.2 1996/02/27 07:27:36 niklas Exp $ */
+/* $NetBSD: ffs_extern.h,v 1.4 1996/02/09 22:22:22 christos Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -45,58 +46,74 @@ struct proc;
struct statfs;
struct timeval;
struct ucred;
+struct ufsmount;
struct uio;
struct vnode;
struct mbuf;
+struct cg;
__BEGIN_DECLS
-int ffs_alloc __P((struct inode *,
- daddr_t, daddr_t, int, struct ucred *, daddr_t *));
-int ffs_balloc __P((struct inode *,
- daddr_t, int, struct ucred *, struct buf **, int));
-int ffs_blkatoff __P((struct vop_blkatoff_args *));
-int ffs_blkfree __P((struct inode *, daddr_t, long));
-daddr_t ffs_blkpref __P((struct inode *, daddr_t, int, daddr_t *));
-int ffs_bmap __P((struct vop_bmap_args *));
-void ffs_clrblock __P((struct fs *, u_char *, daddr_t));
-int ffs_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
- struct vnode **, int *, struct ucred **));
-void ffs_fragacct __P((struct fs *, int, int32_t [], int));
-int ffs_fsync __P((struct vop_fsync_args *));
-int ffs_init __P((void));
-int ffs_isblock __P((struct fs *, u_char *, daddr_t));
-int ffs_mount __P((struct mount *,
- char *, caddr_t, struct nameidata *, struct proc *));
-int ffs_mountfs __P((struct vnode *, struct mount *, struct proc *));
-int ffs_mountroot __P((void));
-int ffs_read __P((struct vop_read_args *));
-int ffs_reallocblks __P((struct vop_reallocblks_args *));
-int ffs_realloccg __P((struct inode *,
- daddr_t, daddr_t, int, int, struct ucred *, struct buf **));
-int ffs_reclaim __P((struct vop_reclaim_args *));
-void ffs_setblock __P((struct fs *, u_char *, daddr_t));
-int ffs_statfs __P((struct mount *, struct statfs *, struct proc *));
-int ffs_sync __P((struct mount *, int, struct ucred *, struct proc *));
-int ffs_truncate __P((struct vop_truncate_args *));
-int ffs_unmount __P((struct mount *, int, struct proc *));
-int ffs_update __P((struct vop_update_args *));
-int ffs_valloc __P((struct vop_valloc_args *));
-int ffs_vfree __P((struct vop_vfree_args *));
-int ffs_vget __P((struct mount *, ino_t, struct vnode **));
-int ffs_vptofh __P((struct vnode *, struct fid *));
-int ffs_write __P((struct vop_write_args *));
-int bwrite(); /* FFS needs a bwrite routine. XXX */
+/* ffs_alloc.c */
+int ffs_alloc __P((struct inode *, daddr_t, daddr_t , int, struct ucred *,
+ daddr_t *));
+int ffs_realloccg __P((struct inode *, daddr_t, daddr_t, int, int ,
+ struct ucred *, struct buf **));
+int ffs_reallocblks __P((void *));
+int ffs_valloc __P((void *));
+daddr_t ffs_blkpref __P((struct inode *, daddr_t, int, daddr_t *));
+void ffs_blkfree __P((struct inode *, daddr_t, long));
+int ffs_vfree __P((void *));
+void ffs_clusteracct __P((struct fs *, struct cg *, daddr_t, int));
+/* ffs_balloc.c */
+int ffs_balloc __P((struct inode *, daddr_t, int, struct ucred *,
+ struct buf **, int));
+
+/* ffs_inode.c */
+void ffs_init __P((void));
+int ffs_update __P((void *));
+int ffs_truncate __P((void *));
+
+/* ffs_subr.c */
+int ffs_blkatoff __P((void *));
+void ffs_fragacct __P((struct fs *, int, int32_t[], int));
#ifdef DIAGNOSTIC
void ffs_checkoverlap __P((struct buf *, struct inode *));
#endif
+int ffs_isblock __P((struct fs *, unsigned char *, daddr_t));
+void ffs_clrblock __P((struct fs *, u_char *, daddr_t));
+void ffs_setblock __P((struct fs *, unsigned char *, daddr_t));
+
+/* ffs_vfsops.c */
+int ffs_mountroot __P((void));
+int ffs_mount __P((struct mount *, char *, caddr_t, struct nameidata *,
+ struct proc *));
+int ffs_reload __P((struct mount *, struct ucred *, struct proc *));
+int ffs_mountfs __P((struct vnode *, struct mount *, struct proc *));
+int ffs_oldfscompat __P((struct fs *));
+int ffs_unmount __P((struct mount *, int, struct proc *));
+int ffs_flushfiles __P((struct mount *, int, struct proc *));
+int ffs_statfs __P((struct mount *, struct statfs *, struct proc *));
+int ffs_sync __P((struct mount *, int, struct ucred *, struct proc *));
+int ffs_vget __P((struct mount *, ino_t, struct vnode **));
+int ffs_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
+ struct vnode **, int *, struct ucred **));
+int ffs_vptofh __P((struct vnode *, struct fid *));
+int ffs_sbupdate __P((struct ufsmount *, int));
+int ffs_cgupdate __P((struct ufsmount *, int));
+
+/* ffs_vnops.c */
+int ffs_read __P((void *));
+int ffs_write __P((void *));
+int ffs_fsync __P((void *));
+int ffs_reclaim __P((void *));
__END_DECLS
-extern int (**ffs_vnodeop_p)();
-extern int (**ffs_specop_p)();
+extern int (**ffs_vnodeop_p) __P((void *));
+extern int (**ffs_specop_p) __P((void *));
#ifdef FIFO
-extern int (**ffs_fifoop_p)();
+extern int (**ffs_fifoop_p) __P((void *));
#define FFS_FIFOOPS ffs_fifoop_p
#else
#define FFS_FIFOOPS NULL
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c
index 8c013d8f86b..70f7147cf54 100644
--- a/sys/ufs/ffs/ffs_inode.c
+++ b/sys/ufs/ffs/ffs_inode.c
@@ -1,4 +1,5 @@
-/* $NetBSD: ffs_inode.c,v 1.8 1995/06/15 23:22:41 cgd Exp $ */
+/* $OpenBSD: ffs_inode.c,v 1.2 1996/02/27 07:27:37 niklas Exp $ */
+/* $NetBSD: ffs_inode.c,v 1.9 1996/02/09 22:22:23 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -58,12 +59,12 @@
#include <ufs/ffs/ffs_extern.h>
static int ffs_indirtrunc __P((struct inode *, daddr_t, daddr_t, daddr_t, int,
- long *));
+ long *));
-int
+void
ffs_init()
{
- return (ufs_init());
+ ufs_init();
}
/*
@@ -76,14 +77,15 @@ ffs_init()
* complete.
*/
int
-ffs_update(ap)
+ffs_update(v)
+ void *v;
+{
struct vop_update_args /* {
struct vnode *a_vp;
struct timeval *a_access;
struct timeval *a_modify;
int a_waitfor;
- } */ *ap;
-{
+ } */ *ap = v;
register struct fs *fs;
struct buf *bp;
struct inode *ip;
@@ -116,9 +118,10 @@ ffs_update(ap)
ip->i_din.di_ouid = ip->i_uid; /* XXX */
ip->i_din.di_ogid = ip->i_gid; /* XXX */
} /* XXX */
- if (error = bread(ip->i_devvp,
- fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
- (int)fs->fs_bsize, NOCRED, &bp)) {
+ error = bread(ip->i_devvp,
+ fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
+ (int)fs->fs_bsize, NOCRED, &bp);
+ if (error) {
brelse(bp);
return (error);
}
@@ -139,15 +142,17 @@ ffs_update(ap)
* Truncate the inode oip to at most length size, freeing the
* disk blocks.
*/
-ffs_truncate(ap)
+int
+ffs_truncate(v)
+ void *v;
+{
struct vop_truncate_args /* {
struct vnode *a_vp;
off_t a_length;
int a_flags;
struct ucred *a_cred;
struct proc *a_p;
- } */ *ap;
-{
+ } */ *ap = v;
register struct vnode *ovp = ap->a_vp;
register daddr_t lastblock;
register struct inode *oip;
@@ -185,7 +190,7 @@ ffs_truncate(ap)
return (VOP_UPDATE(ovp, &tv, &tv, 0));
}
#ifdef QUOTA
- if (error = getinoquota(oip))
+ if ((error = getinoquota(oip)) != 0)
return (error);
#endif
vnode_pager_setsize(ovp, (u_long)length);
@@ -204,8 +209,9 @@ ffs_truncate(ap)
aflags = B_CLRBUF;
if (ap->a_flags & IO_SYNC)
aflags |= B_SYNC;
- if (error = ffs_balloc(oip, lbn, offset + 1, ap->a_cred, &bp,
- aflags))
+ error = ffs_balloc(oip, lbn, offset + 1, ap->a_cred, &bp,
+ aflags);
+ if (error)
return (error);
oip->i_size = length;
(void) vnode_pager_uncache(ovp);
@@ -231,8 +237,8 @@ ffs_truncate(ap)
aflags = B_CLRBUF;
if (ap->a_flags & IO_SYNC)
aflags |= B_SYNC;
- if (error = ffs_balloc(oip, lbn, offset, ap->a_cred, &bp,
- aflags))
+ error = ffs_balloc(oip, lbn, offset, ap->a_cred, &bp, aflags);
+ if (error)
return (error);
oip->i_size = length;
size = blksize(fs, oip, lbn);
@@ -270,7 +276,7 @@ ffs_truncate(ap)
for (i = NDADDR - 1; i > lastblock; i--)
oip->i_db[i] = 0;
oip->i_flag |= IN_CHANGE | IN_UPDATE;
- if (error = VOP_UPDATE(ovp, &tv, &tv, MNT_WAIT))
+ if ((error = VOP_UPDATE(ovp, &tv, &tv, MNT_WAIT)) != 0)
allerror = error;
/*
* Having written the new inode to disk, save its new configuration
@@ -468,8 +474,10 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
if (nb == 0)
continue;
if (level > SINGLE) {
- if (error = ffs_indirtrunc(ip, nlbn,
- fsbtodb(fs, nb), (daddr_t)-1, level - 1, &blkcount))
+ error = ffs_indirtrunc(ip, nlbn, fsbtodb(fs, nb),
+ (daddr_t)-1, level - 1,
+ &blkcount);
+ if (error)
allerror = error;
blocksreleased += blkcount;
}
@@ -484,8 +492,9 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
last = lastbn % factor;
nb = bap[i];
if (nb != 0) {
- if (error = ffs_indirtrunc(ip, nlbn, fsbtodb(fs, nb),
- last, level - 1, &blkcount))
+ error = ffs_indirtrunc(ip, nlbn, fsbtodb(fs, nb),
+ last, level - 1, &blkcount);
+ if (error)
allerror = error;
blocksreleased += blkcount;
}
diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c
index ab971d75712..b532f86d4af 100644
--- a/sys/ufs/ffs/ffs_subr.c
+++ b/sys/ufs/ffs/ffs_subr.c
@@ -1,4 +1,5 @@
-/* $NetBSD: ffs_subr.c,v 1.4 1995/03/28 20:01:44 jtc Exp $ */
+/* $OpenBSD: ffs_subr.c,v 1.2 1996/02/27 07:27:39 niklas Exp $ */
+/* $NetBSD: ffs_subr.c,v 1.5 1996/02/09 22:22:24 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -52,14 +53,15 @@
* remaining space in the directory.
*/
int
-ffs_blkatoff(ap)
+ffs_blkatoff(v)
+ void *v;
+{
struct vop_blkatoff_args /* {
struct vnode *a_vp;
off_t a_offset;
char **a_res;
struct buf **a_bpp;
- } */ *ap;
-{
+ } */ *ap = v;
struct inode *ip;
register struct fs *fs;
struct buf *bp;
@@ -72,7 +74,7 @@ ffs_blkatoff(ap)
bsize = blksize(fs, ip, lbn);
*ap->a_bpp = NULL;
- if (error = bread(ap->a_vp, lbn, bsize, NOCRED, &bp)) {
+ if ((error = bread(ap->a_vp, lbn, bsize, NOCRED, &bp)) != 0) {
brelse(bp);
return (error);
}
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 3e19b2a0e7b..eecb3c01d98 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -1,4 +1,5 @@
-/* $NetBSD: ffs_vfsops.c,v 1.18 1995/12/19 23:27:53 cgd Exp $ */
+/* $OpenBSD: ffs_vfsops.c,v 1.4 1996/02/27 07:27:39 niklas Exp $ */
+/* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1994
@@ -87,6 +88,7 @@ extern u_long nextgennumber;
*/
#define ROOTNAME "root_device"
+int
ffs_mountroot()
{
extern struct vnode *rootvp;
@@ -107,11 +109,11 @@ ffs_mountroot()
bzero((char *)mp, (u_long)sizeof(struct mount));
mp->mnt_op = &ffs_vfsops;
mp->mnt_flag = MNT_RDONLY;
- if (error = ffs_mountfs(rootvp, mp, p)) {
+ if ((error = ffs_mountfs(rootvp, mp, p)) != 0) {
free(mp, M_MOUNT);
return (error);
}
- if (error = vfs_lock(mp)) {
+ if ((error = vfs_lock(mp)) != 0) {
(void)ffs_unmount(mp, 0, p);
free(mp, M_MOUNT);
return (error);
@@ -147,13 +149,14 @@ ffs_mount(mp, path, data, ndp, p)
{
struct vnode *devvp;
struct ufs_args args;
- struct ufsmount *ump;
+ struct ufsmount *ump = NULL;
register struct fs *fs;
size_t size;
int error, flags;
mode_t accessmode;
- if (error = copyin(data, (caddr_t)&args, sizeof (struct ufs_args)))
+ error = copyin(data, (caddr_t)&args, sizeof (struct ufs_args));
+ if (error)
return (error);
/*
* If updating, check whether changing from read-only to
@@ -193,8 +196,9 @@ ffs_mount(mp, path, data, ndp, p)
if (p->p_ucred->cr_uid != 0) {
devvp = ump->um_devvp;
VOP_LOCK(devvp);
- if (error = VOP_ACCESS(devvp, VREAD | VWRITE,
- p->p_ucred, p)) {
+ error = VOP_ACCESS(devvp, VREAD | VWRITE,
+ p->p_ucred, p);
+ if (error) {
VOP_UNLOCK(devvp);
return (error);
}
@@ -216,7 +220,7 @@ ffs_mount(mp, path, data, ndp, p)
* and verify that it refers to a sensible block device.
*/
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, p);
- if (error = namei(ndp))
+ if ((error = namei(ndp)) != 0)
return (error);
devvp = ndp->ni_vp;
@@ -237,7 +241,8 @@ ffs_mount(mp, path, data, ndp, p)
if ((mp->mnt_flag & MNT_RDONLY) == 0)
accessmode |= VWRITE;
VOP_LOCK(devvp);
- if (error = VOP_ACCESS(devvp, accessmode, p->p_ucred, p)) {
+ error = VOP_ACCESS(devvp, accessmode, p->p_ucred, p);
+ if (error) {
vput(devvp);
return (error);
}
@@ -288,6 +293,7 @@ ffs_mount(mp, path, data, ndp, p)
* 5) invalidate all cached file data.
* 6) re-read inode data for all active vnodes.
*/
+int
ffs_reload(mountp, cred, p)
register struct mount *mountp;
struct ucred *cred;
@@ -317,7 +323,8 @@ ffs_reload(mountp, cred, p)
size = DEV_BSIZE;
else
size = dpart.disklab->d_secsize;
- if (error = bread(devvp, (daddr_t)(SBOFF / size), SBSIZE, NOCRED, &bp))
+ error = bread(devvp, (daddr_t)(SBOFF / size), SBSIZE, NOCRED, &bp);
+ if (error)
return (error);
newfs = (struct fs *)bp->b_data;
if (newfs->fs_magic != FS_MAGIC || newfs->fs_bsize > MAXBSIZE ||
@@ -348,8 +355,9 @@ ffs_reload(mountp, cred, p)
size = fs->fs_bsize;
if (i + fs->fs_frag > blks)
size = (blks - i) * fs->fs_fsize;
- if (error = bread(devvp, fsbtodb(fs, fs->fs_csaddr + i), size,
- NOCRED, &bp))
+ error = bread(devvp, fsbtodb(fs, fs->fs_csaddr + i), size,
+ NOCRED, &bp);
+ if (error)
return (error);
bcopy(bp->b_data, fs->fs_csp[fragstoblks(fs, i)], (u_int)size);
brelse(bp);
@@ -384,9 +392,9 @@ loop:
* Step 6: re-read inode data for all active vnodes.
*/
ip = VTOI(vp);
- if (error =
- bread(devvp, fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
- (int)fs->fs_bsize, NOCRED, &bp)) {
+ error = bread(devvp, fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
+ (int)fs->fs_bsize, NOCRED, &bp);
+ if (error) {
vput(vp);
return (error);
}
@@ -430,15 +438,16 @@ ffs_mountfs(devvp, mp, p)
* (except for root, which might share swap device for miniroot).
* Flush out any old buffers remaining from a previous use.
*/
- if (error = vfs_mountedon(devvp))
+ if ((error = vfs_mountedon(devvp)) != 0)
return (error);
if (vcount(devvp) > 1 && devvp != rootvp)
return (EBUSY);
- if (error = vinvalbuf(devvp, V_SAVE, cred, p, 0, 0))
+ if ((error = vinvalbuf(devvp, V_SAVE, cred, p, 0, 0)) != 0)
return (error);
ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
- if (error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, p))
+ error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, p);
+ if (error)
return (error);
if (VOP_IOCTL(devvp, DIOCGPART, (caddr_t)&dpart, FREAD, cred, p) != 0)
size = DEV_BSIZE;
@@ -447,7 +456,8 @@ ffs_mountfs(devvp, mp, p)
bp = NULL;
ump = NULL;
- if (error = bread(devvp, (daddr_t)(SBOFF / size), SBSIZE, cred, &bp))
+ error = bread(devvp, (daddr_t)(SBOFF / size), SBSIZE, cred, &bp);
+ if (error)
goto out;
fs = (struct fs *)bp->b_data;
if (fs->fs_magic != FS_MAGIC || fs->fs_bsize > MAXBSIZE ||
@@ -484,8 +494,9 @@ ffs_mountfs(devvp, mp, p)
size = fs->fs_bsize;
if (i + fs->fs_frag > blks)
size = (blks - i) * fs->fs_fsize;
- if (error = bread(devvp, fsbtodb(fs, fs->fs_csaddr + i), size,
- cred, &bp)) {
+ error = bread(devvp, fsbtodb(fs, fs->fs_csaddr + i), size,
+ cred, &bp);
+ if (error) {
free(base, M_UFSMNT);
goto out;
}
@@ -537,6 +548,7 @@ out:
*
* XXX - goes away some day.
*/
+int
ffs_oldfscompat(fs)
struct fs *fs;
{
@@ -576,7 +588,7 @@ ffs_unmount(mp, mntflags, p)
flags = 0;
if (mntflags & MNT_FORCE)
flags |= FORCECLOSE;
- if (error = ffs_flushfiles(mp, flags, p))
+ if ((error = ffs_flushfiles(mp, flags, p)) != 0)
return (error);
ump = VFSTOUFS(mp);
fs = ump->um_fs;
@@ -601,6 +613,7 @@ ffs_unmount(mp, mntflags, p)
/*
* Flush out all the files in a filesystem.
*/
+int
ffs_flushfiles(mp, flags, p)
register struct mount *mp;
int flags;
@@ -608,14 +621,15 @@ ffs_flushfiles(mp, flags, p)
{
extern int doforce;
register struct ufsmount *ump;
- int i, error;
+ int error;
if (!doforce)
flags &= ~FORCECLOSE;
ump = VFSTOUFS(mp);
#ifdef QUOTA
if (mp->mnt_flag & MNT_QUOTA) {
- if (error = vflush(mp, NULLVP, SKIPSYSTEM|flags))
+ int i;
+ if ((error = vflush(mp, NULLVP, SKIPSYSTEM|flags)) != 0)
return (error);
for (i = 0; i < MAXQUOTAS; i++) {
if (ump->um_quotas[i] == NULLVP)
@@ -727,14 +741,14 @@ loop:
continue;
if (vget(vp, 1))
goto loop;
- if (error = VOP_FSYNC(vp, cred, waitfor, p))
+ if ((error = VOP_FSYNC(vp, cred, waitfor, p)) != 0)
allerror = error;
vput(vp);
}
/*
* Force stale file system control information to be flushed.
*/
- if (error = VOP_FSYNC(ump->um_devvp, cred, waitfor, p))
+ if ((error = VOP_FSYNC(ump->um_devvp, cred, waitfor, p)) != 0)
allerror = error;
#ifdef QUOTA
qsync(mp);
@@ -760,7 +774,7 @@ ffs_vget(mp, ino, vpp)
struct buf *bp;
struct vnode *vp;
dev_t dev;
- int i, type, error;
+ int type, error;
ump = VFSTOUFS(mp);
dev = ump->um_dev;
@@ -768,7 +782,7 @@ ffs_vget(mp, ino, vpp)
return (0);
/* Allocate a new vnode/inode. */
- if (error = getnewvnode(VT_UFS, mp, ffs_vnodeop_p, &vp)) {
+ if ((error = getnewvnode(VT_UFS, mp, ffs_vnodeop_p, &vp)) != 0) {
*vpp = NULL;
return (error);
}
@@ -781,8 +795,12 @@ ffs_vget(mp, ino, vpp)
ip->i_dev = dev;
ip->i_number = ino;
#ifdef QUOTA
- for (i = 0; i < MAXQUOTAS; i++)
- ip->i_dquot[i] = NODQUOT;
+ {
+ int i;
+
+ for (i = 0; i < MAXQUOTAS; i++)
+ ip->i_dquot[i] = NODQUOT;
+ }
#endif
/*
* Put it onto its hash chain and lock it so that other requests for
@@ -793,8 +811,9 @@ ffs_vget(mp, ino, vpp)
ufs_ihashins(ip);
/* Read in the disk contents for the inode, copy into the inode. */
- if (error = bread(ump->um_devvp, fsbtodb(fs, ino_to_fsba(fs, ino)),
- (int)fs->fs_bsize, NOCRED, &bp)) {
+ error = bread(ump->um_devvp, fsbtodb(fs, ino_to_fsba(fs, ino)),
+ (int)fs->fs_bsize, NOCRED, &bp);
+ if (error) {
/*
* The inode does not contain anything useful, so it would
* be misleading to leave it on its hash chain. With mode
@@ -813,7 +832,8 @@ ffs_vget(mp, ino, vpp)
* Initialize the vnode from the inode, check for aliases.
* Note that the underlying vnode may have changed.
*/
- if (error = ufs_vinit(mp, ffs_specop_p, FFS_FIFOOPS, &vp)) {
+ error = ufs_vinit(mp, ffs_specop_p, FFS_FIFOOPS, &vp);
+ if (error) {
vput(vp);
*vpp = NULL;
return (error);
@@ -881,6 +901,7 @@ ffs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
* Vnode pointer to File handle
*/
/* ARGSUSED */
+int
ffs_vptofh(vp, fhp)
struct vnode *vp;
struct fid *fhp;
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c
index 80778d1602e..2fb888dc4e1 100644
--- a/sys/ufs/ffs/ffs_vnops.c
+++ b/sys/ufs/ffs/ffs_vnops.c
@@ -1,4 +1,5 @@
-/* $NetBSD: ffs_vnops.c,v 1.5 1994/12/14 13:03:41 mycroft Exp $ */
+/* $OpenBSD: ffs_vnops.c,v 1.2 1996/02/27 07:27:41 niklas Exp $ */
+/* $NetBSD: ffs_vnops.c,v 1.6 1996/02/09 22:22:27 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -47,6 +48,7 @@
#include <sys/mount.h>
#include <sys/vnode.h>
#include <sys/malloc.h>
+#include <sys/signalvar.h>
#include <vm/vm.h>
@@ -63,7 +65,7 @@
#include <ufs/ffs/ffs_extern.h>
/* Global vfs data structures for ufs. */
-int (**ffs_vnodeop_p)();
+int (**ffs_vnodeop_p) __P((void *));
struct vnodeopv_entry_desc ffs_vnodeop_entries[] = {
{ &vop_default_desc, vn_default_error },
{ &vop_lookup_desc, ufs_lookup }, /* lookup */
@@ -109,12 +111,12 @@ struct vnodeopv_entry_desc ffs_vnodeop_entries[] = {
{ &vop_truncate_desc, ffs_truncate }, /* truncate */
{ &vop_update_desc, ffs_update }, /* update */
{ &vop_bwrite_desc, vn_bwrite },
- { (struct vnodeop_desc*)NULL, (int(*)())NULL }
+ { (struct vnodeop_desc*)NULL, (int(*) __P((void*)))NULL }
};
struct vnodeopv_desc ffs_vnodeop_opv_desc =
{ &ffs_vnodeop_p, ffs_vnodeop_entries };
-int (**ffs_specop_p)();
+int (**ffs_specop_p) __P((void *));
struct vnodeopv_entry_desc ffs_specop_entries[] = {
{ &vop_default_desc, vn_default_error },
{ &vop_lookup_desc, spec_lookup }, /* lookup */
@@ -159,13 +161,13 @@ struct vnodeopv_entry_desc ffs_specop_entries[] = {
{ &vop_truncate_desc, spec_truncate }, /* truncate */
{ &vop_update_desc, ffs_update }, /* update */
{ &vop_bwrite_desc, vn_bwrite },
- { (struct vnodeop_desc*)NULL, (int(*)())NULL }
+ { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL }
};
struct vnodeopv_desc ffs_specop_opv_desc =
{ &ffs_specop_p, ffs_specop_entries };
#ifdef FIFO
-int (**ffs_fifoop_p)();
+int (**ffs_fifoop_p) __P((void *));
struct vnodeopv_entry_desc ffs_fifoop_entries[] = {
{ &vop_default_desc, vn_default_error },
{ &vop_lookup_desc, fifo_lookup }, /* lookup */
@@ -210,7 +212,7 @@ struct vnodeopv_entry_desc ffs_fifoop_entries[] = {
{ &vop_truncate_desc, fifo_truncate }, /* truncate */
{ &vop_update_desc, ffs_update }, /* update */
{ &vop_bwrite_desc, vn_bwrite },
- { (struct vnodeop_desc*)NULL, (int(*)())NULL }
+ { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL }
};
struct vnodeopv_desc ffs_fifoop_opv_desc =
{ &ffs_fifoop_p, ffs_fifoop_entries };
@@ -238,14 +240,15 @@ struct ctldebug debug12 = { "doclusterwrite", &doclusterwrite };
*/
/* ARGSUSED */
int
-ffs_fsync(ap)
+ffs_fsync(v)
+ void *v;
+{
struct vop_fsync_args /* {
struct vnode *a_vp;
struct ucred *a_cred;
int a_waitfor;
struct proc *a_p;
- } */ *ap;
-{
+ } */ *ap = v;
register struct vnode *vp = ap->a_vp;
struct timeval tv;
@@ -258,15 +261,16 @@ ffs_fsync(ap)
* Reclaim an inode so that it can be used for other purposes.
*/
int
-ffs_reclaim(ap)
+ffs_reclaim(v)
+ void *v;
+{
struct vop_reclaim_args /* {
struct vnode *a_vp;
- } */ *ap;
-{
+ } */ *ap = v;
register struct vnode *vp = ap->a_vp;
int error;
- if (error = ufs_reclaim(vp))
+ if ((error = ufs_reclaim(vp)) != 0)
return (error);
FREE(vp->v_data, VFSTOUFS(vp->v_mount)->um_devvp->v_tag == VT_MFS ?
M_MFSNODE : M_FFSNODE);