summaryrefslogtreecommitdiff
path: root/sys/ufs/lfs/lfs_vfsops.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/ufs/lfs/lfs_vfsops.c')
-rw-r--r--sys/ufs/lfs/lfs_vfsops.c55
1 files changed, 34 insertions, 21 deletions
diff --git a/sys/ufs/lfs/lfs_vfsops.c b/sys/ufs/lfs/lfs_vfsops.c
index 4747235b714..35374b85538 100644
--- a/sys/ufs/lfs/lfs_vfsops.c
+++ b/sys/ufs/lfs/lfs_vfsops.c
@@ -1,4 +1,5 @@
-/* $NetBSD: lfs_vfsops.c,v 1.9 1995/06/18 14:48:39 cgd Exp $ */
+/* $OpenBSD: lfs_vfsops.c,v 1.2 1996/02/27 07:13:29 niklas Exp $ */
+/* $NetBSD: lfs_vfsops.c,v 1.10 1996/02/09 22:28:58 christos Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1994
@@ -82,6 +83,7 @@ int
lfs_mountroot()
{
panic("lfs_mountroot"); /* XXX -- implement */
+ return 0;
}
/*
@@ -89,6 +91,7 @@ lfs_mountroot()
*
* mount system call
*/
+int
lfs_mount(mp, path, data, ndp, p)
register struct mount *mp;
char *path;
@@ -98,13 +101,14 @@ lfs_mount(mp, path, data, ndp, p)
{
struct vnode *devvp;
struct ufs_args args;
- struct ufsmount *ump;
- register struct lfs *fs; /* LFS */
+ struct ufsmount *ump = NULL;
+ register struct lfs *fs = NULL; /* LFS */
size_t size;
int error;
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);
/* Until LFS can do NFS right. XXX */
@@ -124,8 +128,9 @@ lfs_mount(mp, path, data, ndp, p)
*/
if (p->p_ucred->cr_uid != 0) {
VOP_LOCK(ump->um_devvp);
- if (error = VOP_ACCESS(ump->um_devvp,
- VREAD | VWRITE, p->p_ucred, p)) {
+ error = VOP_ACCESS(ump->um_devvp, VREAD|VWRITE,
+ p->p_ucred, p);
+ if (error) {
VOP_UNLOCK(ump->um_devvp);
return (error);
}
@@ -145,7 +150,7 @@ lfs_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;
if (devvp->v_type != VBLK) {
@@ -165,7 +170,8 @@ lfs_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);
}
@@ -227,15 +233,16 @@ lfs_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)
@@ -255,7 +262,8 @@ lfs_mountfs(devvp, mp, p)
ump = NULL;
/* Read in the superblock. */
- if (error = bread(devvp, LFS_LABELPAD / size, LFS_SBPAD, cred, &bp))
+ error = bread(devvp, LFS_LABELPAD / size, LFS_SBPAD, cred, &bp);
+ if (error)
goto out;
fs = (struct lfs *)bp->b_data;
@@ -312,7 +320,7 @@ lfs_mountfs(devvp, mp, p)
* artificially increment the reference count and keep a pointer
* to it in the incore copy of the superblock.
*/
- if (error = VFS_VGET(mp, LFS_IFILE_INUM, &vp))
+ if ((error = VFS_VGET(mp, LFS_IFILE_INUM, &vp)) != 0)
goto out;
fs->lfs_ivnode = vp;
VREF(vp);
@@ -334,12 +342,12 @@ out:
/*
* unmount system call
*/
+int
lfs_unmount(mp, mntflags, p)
struct mount *mp;
int mntflags;
struct proc *p;
{
- extern int doforce;
register struct ufsmount *ump;
register struct lfs *fs;
int i, error, flags, ronly;
@@ -352,7 +360,8 @@ lfs_unmount(mp, mntflags, p)
fs = ump->um_lfs;
#ifdef QUOTA
if (mp->mnt_flag & MNT_QUOTA) {
- if (error = vflush(mp, fs->lfs_ivnode, SKIPSYSTEM|flags))
+ error = vflush(mp, fs->lfs_ivnode, SKIPSYSTEM|flags);
+ if (error)
return (error);
for (i = 0; i < MAXQUOTAS; i++) {
if (ump->um_quotas[i] == NULLVP)
@@ -365,10 +374,10 @@ lfs_unmount(mp, mntflags, p)
*/
}
#endif
- if (error = vflush(mp, fs->lfs_ivnode, flags))
+ if ((error = vflush(mp, fs->lfs_ivnode, flags)) != 0)
return (error);
fs->lfs_clean = 1;
- if (error = VFS_SYNC(mp, 1, p->p_ucred, p))
+ if ((error = VFS_SYNC(mp, 1, p->p_ucred, p)) != 0)
return (error);
if (fs->lfs_ivnode->v_dirtyblkhd.lh_first)
panic("lfs_unmount: still dirty blocks on ifile vnode\n");
@@ -390,6 +399,7 @@ lfs_unmount(mp, mntflags, p)
/*
* Get file system statistics.
*/
+int
lfs_statfs(mp, sbp, p)
struct mount *mp;
register struct statfs *sbp;
@@ -427,6 +437,7 @@ lfs_statfs(mp, sbp, p)
*
* Note: we are always called with the filesystem marked `MPBUSY'.
*/
+int
lfs_sync(mp, waitfor, cred, p)
struct mount *mp;
int waitfor;
@@ -482,7 +493,7 @@ lfs_vget(mp, ino, vpp)
}
/* Allocate new vnode/inode. */
- if (error = lfs_vcreate(mp, ino, &vp)) {
+ if ((error = lfs_vcreate(mp, ino, &vp)) != 0) {
*vpp = NULL;
return (error);
}
@@ -505,8 +516,8 @@ lfs_vget(mp, ino, vpp)
ip->i_lfs = ump->um_lfs;
/* Read in the disk contents for the inode, copy into the inode. */
- if (error =
- bread(ump->um_devvp, daddr, (int)fs->lfs_bsize, NOCRED, &bp)) {
+ error = bread(ump->um_devvp, daddr, (int)fs->lfs_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
@@ -525,7 +536,8 @@ lfs_vget(mp, ino, vpp)
* Initialize the vnode from the inode, check for aliases. In all
* cases re-init ip, the underlying vnode/inode may have changed.
*/
- if (error = ufs_vinit(mp, lfs_specop_p, LFS_FIFOOPS, &vp)) {
+ error = ufs_vinit(mp, lfs_specop_p, LFS_FIFOOPS, &vp);
+ if (error) {
vput(vp);
*vpp = NULL;
return (error);
@@ -575,6 +587,7 @@ lfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
* Vnode pointer to File handle
*/
/* ARGSUSED */
+int
lfs_vptofh(vp, fhp)
struct vnode *vp;
struct fid *fhp;