POSSIBLE BOGUS CODE found, (related to dos-partitions) in ufs_disksubr.c,
look for CC_WALL. Cosmetics, a couple of unused vars.
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_bmap.c 8.6 (Berkeley) 1/21/94
|
||||
* $Id$
|
||||
* $Id: ufs_bmap.c,v 1.3 1994/08/02 07:54:52 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -54,6 +54,8 @@
|
||||
#include <ufs/ufs/ufsmount.h>
|
||||
#include <ufs/ufs/ufs_extern.h>
|
||||
|
||||
int ufs_bmaparray __P((struct vnode *, daddr_t, daddr_t *, struct indir *, int *, int *));
|
||||
|
||||
/*
|
||||
* Bmap converts a the logical block number of a file to its physical block
|
||||
* number on the disk. The conversion is done by using the logical block
|
||||
@@ -137,7 +139,8 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp)
|
||||
xap = ap == NULL ? a : ap;
|
||||
if (!nump)
|
||||
nump = #
|
||||
if (error = ufs_getlbns(vp, bn, xap, nump))
|
||||
error = ufs_getlbns(vp, bn, xap, nump);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
num = *nump;
|
||||
@@ -165,7 +168,7 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp)
|
||||
*/
|
||||
|
||||
metalbn = xap->in_lbn;
|
||||
if (daddr == 0 && !incore(vp, metalbn) || metalbn == bn)
|
||||
if ((daddr == 0 && !incore(vp, metalbn)) || metalbn == bn)
|
||||
break;
|
||||
/*
|
||||
* If we get here, we've either got the block in the cache
|
||||
@@ -189,7 +192,8 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp)
|
||||
bp->b_flags |= B_READ;
|
||||
VOP_STRATEGY(bp);
|
||||
curproc->p_stats->p_ru.ru_inblock++; /* XXX */
|
||||
if (error = biowait(bp)) {
|
||||
error = biowait(bp);
|
||||
if (error) {
|
||||
brelse(bp);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_ihash.c 8.4 (Berkeley) 12/30/93
|
||||
* $Id: ufs_ihash.c,v 1.2 1994/08/02 07:54:55 davidg Exp $
|
||||
* $Id: ufs_ihash.c,v 1.3 1994/10/06 21:07:01 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -122,7 +122,8 @@ ufs_ihashins(ip)
|
||||
struct inode **ipp, *iq;
|
||||
|
||||
ipp = &ihashtbl[INOHASH(ip->i_dev, ip->i_number)];
|
||||
if (iq = *ipp)
|
||||
iq = *ipp;
|
||||
if (iq)
|
||||
iq->i_prev = &ip->i_next;
|
||||
ip->i_next = iq;
|
||||
ip->i_prev = ipp;
|
||||
@@ -145,7 +146,8 @@ ufs_ihashrem(ip)
|
||||
{
|
||||
register struct inode *iq;
|
||||
|
||||
if (iq = ip->i_next)
|
||||
iq = ip->i_next;
|
||||
if (iq)
|
||||
iq->i_prev = ip->i_prev;
|
||||
*ip->i_prev = iq;
|
||||
#ifdef DIAGNOSTIC
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_bmap.c 8.6 (Berkeley) 1/21/94
|
||||
* $Id$
|
||||
* $Id: ufs_bmap.c,v 1.3 1994/08/02 07:54:52 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -54,6 +54,8 @@
|
||||
#include <ufs/ufs/ufsmount.h>
|
||||
#include <ufs/ufs/ufs_extern.h>
|
||||
|
||||
int ufs_bmaparray __P((struct vnode *, daddr_t, daddr_t *, struct indir *, int *, int *));
|
||||
|
||||
/*
|
||||
* Bmap converts a the logical block number of a file to its physical block
|
||||
* number on the disk. The conversion is done by using the logical block
|
||||
@@ -137,7 +139,8 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp)
|
||||
xap = ap == NULL ? a : ap;
|
||||
if (!nump)
|
||||
nump = #
|
||||
if (error = ufs_getlbns(vp, bn, xap, nump))
|
||||
error = ufs_getlbns(vp, bn, xap, nump);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
num = *nump;
|
||||
@@ -165,7 +168,7 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp)
|
||||
*/
|
||||
|
||||
metalbn = xap->in_lbn;
|
||||
if (daddr == 0 && !incore(vp, metalbn) || metalbn == bn)
|
||||
if ((daddr == 0 && !incore(vp, metalbn)) || metalbn == bn)
|
||||
break;
|
||||
/*
|
||||
* If we get here, we've either got the block in the cache
|
||||
@@ -189,7 +192,8 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp)
|
||||
bp->b_flags |= B_READ;
|
||||
VOP_STRATEGY(bp);
|
||||
curproc->p_stats->p_ru.ru_inblock++; /* XXX */
|
||||
if (error = biowait(bp)) {
|
||||
error = biowait(bp);
|
||||
if (error) {
|
||||
brelse(bp);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_disksubr.c 8.5 (Berkeley) 1/21/94
|
||||
* $Id$
|
||||
* $Id: ufs_disksubr.c,v 1.3 1994/08/02 07:54:53 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/dkbad.h>
|
||||
|
||||
int dkcksum __P((struct disklabel *));
|
||||
/*
|
||||
* Seek sort for disks. We depend on the driver which calls us using b_resid
|
||||
* as the current cylinder number.
|
||||
@@ -181,8 +182,6 @@ readdisklabel(dev, strat, lp, dp, bdp)
|
||||
dospartoff = 0;
|
||||
cyl = LABELSECTOR / lp->d_secpercyl;
|
||||
if (dp) {
|
||||
struct dos_partition *ap;
|
||||
|
||||
/* read master boot record */
|
||||
bp->b_dev = dev;
|
||||
bp->b_blkno = DOSBBSECTOR;
|
||||
@@ -217,8 +216,14 @@ readdisklabel(dev, strat, lp, dp, bdp)
|
||||
dp->dp_start;
|
||||
lp->d_ntracks = dp->dp_ehd + 1;
|
||||
lp->d_nsectors = DPSECT(dp->dp_esect);
|
||||
#ifdef CC_WALL
|
||||
/* The next statement looks bogus... i runs int 0..3 ??? */
|
||||
lp->d_subtype |= ((lp->d_subtype & 3)
|
||||
+ i) | DSTYPE_INDOSPART;
|
||||
#else /* CC_WALL */
|
||||
lp->d_subtype |= (lp->d_subtype & 3)
|
||||
+ i | DSTYPE_INDOSPART;
|
||||
#endif /* CC_WALL */
|
||||
lp->d_secpercyl = lp->d_ntracks *
|
||||
lp->d_nsectors;
|
||||
}
|
||||
@@ -258,7 +263,7 @@ readdisklabel(dev, strat, lp, dp, bdp)
|
||||
if (bdp && (lp->d_flags & D_BADSECT)) {
|
||||
struct dkbad *db;
|
||||
|
||||
printf("d_secsize: %d\n", lp->d_secsize);
|
||||
printf("d_secsize: %ld\n", lp->d_secsize);
|
||||
i = 0;
|
||||
do {
|
||||
/* read a bad sector table */
|
||||
@@ -367,7 +372,8 @@ writedisklabel(dev, strat, lp)
|
||||
bp->b_bcount = lp->d_secsize;
|
||||
bp->b_flags = B_READ;
|
||||
(*strat)(bp);
|
||||
if (error = biowait(bp))
|
||||
error = biowait(bp);
|
||||
if (error)
|
||||
goto done;
|
||||
for (dlp = (struct disklabel *)bp->b_data;
|
||||
dlp <= (struct disklabel *)
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_bmap.c 8.6 (Berkeley) 1/21/94
|
||||
* $Id$
|
||||
* $Id: ufs_bmap.c,v 1.3 1994/08/02 07:54:52 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -54,6 +54,8 @@
|
||||
#include <ufs/ufs/ufsmount.h>
|
||||
#include <ufs/ufs/ufs_extern.h>
|
||||
|
||||
int ufs_bmaparray __P((struct vnode *, daddr_t, daddr_t *, struct indir *, int *, int *));
|
||||
|
||||
/*
|
||||
* Bmap converts a the logical block number of a file to its physical block
|
||||
* number on the disk. The conversion is done by using the logical block
|
||||
@@ -137,7 +139,8 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp)
|
||||
xap = ap == NULL ? a : ap;
|
||||
if (!nump)
|
||||
nump = #
|
||||
if (error = ufs_getlbns(vp, bn, xap, nump))
|
||||
error = ufs_getlbns(vp, bn, xap, nump);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
num = *nump;
|
||||
@@ -165,7 +168,7 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp)
|
||||
*/
|
||||
|
||||
metalbn = xap->in_lbn;
|
||||
if (daddr == 0 && !incore(vp, metalbn) || metalbn == bn)
|
||||
if ((daddr == 0 && !incore(vp, metalbn)) || metalbn == bn)
|
||||
break;
|
||||
/*
|
||||
* If we get here, we've either got the block in the cache
|
||||
@@ -189,7 +192,8 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp)
|
||||
bp->b_flags |= B_READ;
|
||||
VOP_STRATEGY(bp);
|
||||
curproc->p_stats->p_ru.ru_inblock++; /* XXX */
|
||||
if (error = biowait(bp)) {
|
||||
error = biowait(bp);
|
||||
if (error) {
|
||||
brelse(bp);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_disksubr.c 8.5 (Berkeley) 1/21/94
|
||||
* $Id$
|
||||
* $Id: ufs_disksubr.c,v 1.3 1994/08/02 07:54:53 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/dkbad.h>
|
||||
|
||||
int dkcksum __P((struct disklabel *));
|
||||
/*
|
||||
* Seek sort for disks. We depend on the driver which calls us using b_resid
|
||||
* as the current cylinder number.
|
||||
@@ -181,8 +182,6 @@ readdisklabel(dev, strat, lp, dp, bdp)
|
||||
dospartoff = 0;
|
||||
cyl = LABELSECTOR / lp->d_secpercyl;
|
||||
if (dp) {
|
||||
struct dos_partition *ap;
|
||||
|
||||
/* read master boot record */
|
||||
bp->b_dev = dev;
|
||||
bp->b_blkno = DOSBBSECTOR;
|
||||
@@ -217,8 +216,14 @@ readdisklabel(dev, strat, lp, dp, bdp)
|
||||
dp->dp_start;
|
||||
lp->d_ntracks = dp->dp_ehd + 1;
|
||||
lp->d_nsectors = DPSECT(dp->dp_esect);
|
||||
#ifdef CC_WALL
|
||||
/* The next statement looks bogus... i runs int 0..3 ??? */
|
||||
lp->d_subtype |= ((lp->d_subtype & 3)
|
||||
+ i) | DSTYPE_INDOSPART;
|
||||
#else /* CC_WALL */
|
||||
lp->d_subtype |= (lp->d_subtype & 3)
|
||||
+ i | DSTYPE_INDOSPART;
|
||||
#endif /* CC_WALL */
|
||||
lp->d_secpercyl = lp->d_ntracks *
|
||||
lp->d_nsectors;
|
||||
}
|
||||
@@ -258,7 +263,7 @@ readdisklabel(dev, strat, lp, dp, bdp)
|
||||
if (bdp && (lp->d_flags & D_BADSECT)) {
|
||||
struct dkbad *db;
|
||||
|
||||
printf("d_secsize: %d\n", lp->d_secsize);
|
||||
printf("d_secsize: %ld\n", lp->d_secsize);
|
||||
i = 0;
|
||||
do {
|
||||
/* read a bad sector table */
|
||||
@@ -367,7 +372,8 @@ writedisklabel(dev, strat, lp)
|
||||
bp->b_bcount = lp->d_secsize;
|
||||
bp->b_flags = B_READ;
|
||||
(*strat)(bp);
|
||||
if (error = biowait(bp))
|
||||
error = biowait(bp);
|
||||
if (error)
|
||||
goto done;
|
||||
for (dlp = (struct disklabel *)bp->b_data;
|
||||
dlp <= (struct disklabel *)
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_ihash.c 8.4 (Berkeley) 12/30/93
|
||||
* $Id: ufs_ihash.c,v 1.2 1994/08/02 07:54:55 davidg Exp $
|
||||
* $Id: ufs_ihash.c,v 1.3 1994/10/06 21:07:01 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -122,7 +122,8 @@ ufs_ihashins(ip)
|
||||
struct inode **ipp, *iq;
|
||||
|
||||
ipp = &ihashtbl[INOHASH(ip->i_dev, ip->i_number)];
|
||||
if (iq = *ipp)
|
||||
iq = *ipp;
|
||||
if (iq)
|
||||
iq->i_prev = &ip->i_next;
|
||||
ip->i_next = iq;
|
||||
ip->i_prev = ipp;
|
||||
@@ -145,7 +146,8 @@ ufs_ihashrem(ip)
|
||||
{
|
||||
register struct inode *iq;
|
||||
|
||||
if (iq = ip->i_next)
|
||||
iq = ip->i_next;
|
||||
if (iq)
|
||||
iq->i_prev = ip->i_prev;
|
||||
*ip->i_prev = iq;
|
||||
#ifdef DIAGNOSTIC
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_inode.c 8.4 (Berkeley) 1/21/94
|
||||
* $Id: ufs_inode.c,v 1.2 1994/08/02 07:54:56 davidg Exp $
|
||||
* $Id: ufs_inode.c,v 1.3 1994/08/18 22:35:57 wollman Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -144,7 +144,7 @@ ufs_reclaim(ap)
|
||||
{
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
register struct inode *ip;
|
||||
int i, type;
|
||||
int type;
|
||||
|
||||
if (prtactive && vp->v_usecount != 0)
|
||||
vprint("ufs_reclaim: pushing active", vp);
|
||||
|
||||
+39
-22
@@ -36,10 +36,11 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_lookup.c 8.6 (Berkeley) 4/1/94
|
||||
* $Id$
|
||||
* $Id: ufs_lookup.c,v 1.2 1994/08/02 07:54:58 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/namei.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/file.h>
|
||||
@@ -141,7 +142,8 @@ ufs_lookup(ap)
|
||||
*/
|
||||
if ((dp->i_mode & IFMT) != IFDIR)
|
||||
return (ENOTDIR);
|
||||
if (error = VOP_ACCESS(vdp, VEXEC, cred, cnp->cn_proc))
|
||||
error = VOP_ACCESS(vdp, VEXEC, cred, cnp->cn_proc);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
/*
|
||||
@@ -151,7 +153,8 @@ ufs_lookup(ap)
|
||||
* check the name cache to see if the directory/name pair
|
||||
* we are looking for is known already.
|
||||
*/
|
||||
if (error = cache_lookup(vdp, vpp, cnp)) {
|
||||
error = cache_lookup(vdp, vpp, cnp);
|
||||
if (error) {
|
||||
int vpid; /* capability number of vnode */
|
||||
|
||||
if (error == ENOENT)
|
||||
@@ -189,7 +192,8 @@ ufs_lookup(ap)
|
||||
if (lockparent && pdp != vdp && (flags & ISLASTCN))
|
||||
VOP_UNLOCK(pdp);
|
||||
}
|
||||
if (error = VOP_LOCK(pdp))
|
||||
error = VOP_LOCK(pdp);
|
||||
if (error)
|
||||
return (error);
|
||||
vdp = pdp;
|
||||
dp = VTOI(pdp);
|
||||
@@ -248,8 +252,9 @@ ufs_lookup(ap)
|
||||
if ((dp->i_offset & bmask) == 0) {
|
||||
if (bp != NULL)
|
||||
brelse(bp);
|
||||
if (error =
|
||||
VOP_BLKATOFF(vdp, (off_t)dp->i_offset, NULL, &bp))
|
||||
error =
|
||||
VOP_BLKATOFF(vdp, (off_t)dp->i_offset, NULL, &bp);
|
||||
if (error)
|
||||
return (error);
|
||||
entryoffsetinblock = 0;
|
||||
}
|
||||
@@ -271,7 +276,7 @@ ufs_lookup(ap)
|
||||
*/
|
||||
ep = (struct direct *)((char *)bp->b_data + entryoffsetinblock);
|
||||
if (ep->d_reclen == 0 ||
|
||||
dirchk && ufs_dirbadentry(vdp, ep, entryoffsetinblock)) {
|
||||
(dirchk && ufs_dirbadentry(vdp, ep, entryoffsetinblock))) {
|
||||
int i;
|
||||
|
||||
ufs_dirbad(dp, dp->i_offset, "mangled entry");
|
||||
@@ -366,7 +371,8 @@ ufs_lookup(ap)
|
||||
* Access for write is interpreted as allowing
|
||||
* creation of files in the directory.
|
||||
*/
|
||||
if (error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_proc))
|
||||
error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_proc);
|
||||
if (error)
|
||||
return (error);
|
||||
/*
|
||||
* Return an indication of where the new directory
|
||||
@@ -446,7 +452,8 @@ ufs_lookup(ap)
|
||||
/*
|
||||
* Write access to directory required to delete files.
|
||||
*/
|
||||
if (error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_proc))
|
||||
error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_proc);
|
||||
if (error)
|
||||
return (error);
|
||||
/*
|
||||
* Return pointer to current entry in dp->i_offset,
|
||||
@@ -463,7 +470,8 @@ ufs_lookup(ap)
|
||||
*vpp = vdp;
|
||||
return (0);
|
||||
}
|
||||
if (error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp))
|
||||
error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp);
|
||||
if (error)
|
||||
return (error);
|
||||
/*
|
||||
* If directory is "sticky", then user must own
|
||||
@@ -492,7 +500,8 @@ ufs_lookup(ap)
|
||||
*/
|
||||
if (nameiop == RENAME && wantparent &&
|
||||
(flags & ISLASTCN)) {
|
||||
if (error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_proc))
|
||||
error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_proc);
|
||||
if (error)
|
||||
return (error);
|
||||
/*
|
||||
* Careful about locking second inode.
|
||||
@@ -500,7 +509,8 @@ ufs_lookup(ap)
|
||||
*/
|
||||
if (dp->i_number == dp->i_ino)
|
||||
return (EISDIR);
|
||||
if (error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp))
|
||||
error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp);
|
||||
if (error)
|
||||
return (error);
|
||||
*vpp = tdp;
|
||||
cnp->cn_flags |= SAVENAME;
|
||||
@@ -531,7 +541,8 @@ ufs_lookup(ap)
|
||||
pdp = vdp;
|
||||
if (flags & ISDOTDOT) {
|
||||
VOP_UNLOCK(pdp); /* race to get the inode */
|
||||
if (error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp)) {
|
||||
error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp);
|
||||
if (error) {
|
||||
VOP_LOCK(pdp);
|
||||
return (error);
|
||||
}
|
||||
@@ -545,7 +556,8 @@ ufs_lookup(ap)
|
||||
VREF(vdp); /* we want ourself, ie "." */
|
||||
*vpp = vdp;
|
||||
} else {
|
||||
if (error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp))
|
||||
error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp);
|
||||
if (error)
|
||||
return (error);
|
||||
if (!lockparent || !(flags & ISLASTCN))
|
||||
VOP_UNLOCK(pdp);
|
||||
@@ -569,7 +581,7 @@ ufs_dirbad(ip, offset, how)
|
||||
struct mount *mp;
|
||||
|
||||
mp = ITOV(ip)->v_mount;
|
||||
(void)printf("%s: bad dir ino %d at offset %d: %s\n",
|
||||
(void)printf("%s: bad dir ino %ld at offset %ld: %s\n",
|
||||
mp->mnt_stat.f_mntonname, ip->i_number, offset, how);
|
||||
if ((mp->mnt_stat.f_flags & MNT_RDONLY) == 0)
|
||||
panic("bad dir");
|
||||
@@ -715,7 +727,8 @@ ufs_direnter(ip, dvp, cnp)
|
||||
/*
|
||||
* Get the block containing the space for the new directory entry.
|
||||
*/
|
||||
if (error = VOP_BLKATOFF(dvp, (off_t)dp->i_offset, &dirbuf, &bp))
|
||||
error = VOP_BLKATOFF(dvp, (off_t)dp->i_offset, &dirbuf, &bp);
|
||||
if (error)
|
||||
return (error);
|
||||
/*
|
||||
* Find space for the new entry. In the simple case, the entry at
|
||||
@@ -793,8 +806,9 @@ ufs_dirremove(dvp, cnp)
|
||||
/*
|
||||
* First entry in block: set d_ino to zero.
|
||||
*/
|
||||
if (error =
|
||||
VOP_BLKATOFF(dvp, (off_t)dp->i_offset, (char **)&ep, &bp))
|
||||
error =
|
||||
VOP_BLKATOFF(dvp, (off_t)dp->i_offset, (char **)&ep, &bp);
|
||||
if (error)
|
||||
return (error);
|
||||
ep->d_ino = 0;
|
||||
error = VOP_BWRITE(bp);
|
||||
@@ -804,8 +818,9 @@ ufs_dirremove(dvp, cnp)
|
||||
/*
|
||||
* Collapse new free space into previous entry.
|
||||
*/
|
||||
if (error = VOP_BLKATOFF(dvp, (off_t)(dp->i_offset - dp->i_count),
|
||||
(char **)&ep, &bp))
|
||||
error = VOP_BLKATOFF(dvp, (off_t)(dp->i_offset - dp->i_count),
|
||||
(char **)&ep, &bp);
|
||||
if (error)
|
||||
return (error);
|
||||
ep->d_reclen += dp->i_reclen;
|
||||
error = VOP_BWRITE(bp);
|
||||
@@ -828,7 +843,8 @@ ufs_dirrewrite(dp, ip, cnp)
|
||||
struct vnode *vdp = ITOV(dp);
|
||||
int error;
|
||||
|
||||
if (error = VOP_BLKATOFF(vdp, (off_t)dp->i_offset, (char **)&ep, &bp))
|
||||
error = VOP_BLKATOFF(vdp, (off_t)dp->i_offset, (char **)&ep, &bp);
|
||||
if (error)
|
||||
return (error);
|
||||
ep->d_ino = ip->i_number;
|
||||
if (vdp->v_mount->mnt_maxsymlinklen > 0)
|
||||
@@ -956,7 +972,8 @@ ufs_checkpath(source, target, cred)
|
||||
if (dirbuf.dotdot_ino == rootino)
|
||||
break;
|
||||
vput(vp);
|
||||
if (error = VFS_VGET(vp->v_mount, dirbuf.dotdot_ino, &vp)) {
|
||||
error = VFS_VGET(vp->v_mount, dirbuf.dotdot_ino, &vp);
|
||||
if (error) {
|
||||
vp = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
+27
-14
@@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_quota.c 8.2 (Berkeley) 12/30/93
|
||||
* $Id: ufs_quota.c,v 1.2 1994/08/02 07:54:59 davidg Exp $
|
||||
* $Id: ufs_quota.c,v 1.3 1994/10/06 21:07:02 davidg Exp $
|
||||
*/
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
@@ -136,7 +136,8 @@ chkdq(ip, change, cred, flags)
|
||||
for (i = 0; i < MAXQUOTAS; i++) {
|
||||
if ((dq = ip->i_dquot[i]) == NODQUOT)
|
||||
continue;
|
||||
if (error = chkdqchg(ip, change, cred, i))
|
||||
error = chkdqchg(ip, change, cred, i);
|
||||
if (error)
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
@@ -251,7 +252,8 @@ chkiq(ip, change, cred, flags)
|
||||
for (i = 0; i < MAXQUOTAS; i++) {
|
||||
if ((dq = ip->i_dquot[i]) == NODQUOT)
|
||||
continue;
|
||||
if (error = chkiqchg(ip, change, cred, i))
|
||||
error = chkiqchg(ip, change, cred, i);
|
||||
if (error)
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
@@ -371,7 +373,8 @@ quotaon(p, mp, type, fname)
|
||||
|
||||
vpp = &ump->um_quotas[type];
|
||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, fname, p);
|
||||
if (error = vn_open(&nd, FREAD|FWRITE, 0))
|
||||
error = vn_open(&nd, FREAD|FWRITE, 0);
|
||||
if (error)
|
||||
return (error);
|
||||
vp = nd.ni_vp;
|
||||
VOP_UNLOCK(vp);
|
||||
@@ -416,7 +419,8 @@ quotaon(p, mp, type, fname)
|
||||
continue;
|
||||
if (vget(vp, 1))
|
||||
goto again;
|
||||
if (error = getinoquota(VTOI(vp))) {
|
||||
error = getinoquota(VTOI(vp));
|
||||
if (error) {
|
||||
vput(vp);
|
||||
break;
|
||||
}
|
||||
@@ -497,7 +501,8 @@ getquota(mp, id, type, addr)
|
||||
struct dquot *dq;
|
||||
int error;
|
||||
|
||||
if (error = dqget(NULLVP, id, VFSTOUFS(mp), type, &dq))
|
||||
error = dqget(NULLVP, id, VFSTOUFS(mp), type, &dq);
|
||||
if (error)
|
||||
return (error);
|
||||
error = copyout((caddr_t)&dq->dq_dqb, addr, sizeof (struct dqblk));
|
||||
dqrele(NULLVP, dq);
|
||||
@@ -520,9 +525,11 @@ setquota(mp, id, type, addr)
|
||||
struct dqblk newlim;
|
||||
int error;
|
||||
|
||||
if (error = copyin(addr, (caddr_t)&newlim, sizeof (struct dqblk)))
|
||||
error = copyin(addr, (caddr_t)&newlim, sizeof (struct dqblk));
|
||||
if (error)
|
||||
return (error);
|
||||
if (error = dqget(NULLVP, id, ump, type, &ndq))
|
||||
error = dqget(NULLVP, id, ump, type, &ndq);
|
||||
if (error)
|
||||
return (error);
|
||||
dq = ndq;
|
||||
while (dq->dq_flags & DQ_LOCK) {
|
||||
@@ -579,9 +586,11 @@ setuse(mp, id, type, addr)
|
||||
struct dqblk usage;
|
||||
int error;
|
||||
|
||||
if (error = copyin(addr, (caddr_t)&usage, sizeof (struct dqblk)))
|
||||
error = copyin(addr, (caddr_t)&usage, sizeof (struct dqblk));
|
||||
if (error)
|
||||
return (error);
|
||||
if (error = dqget(NULLVP, id, ump, type, &ndq))
|
||||
error = dqget(NULLVP, id, ump, type, &ndq);
|
||||
if (error)
|
||||
return (error);
|
||||
dq = ndq;
|
||||
while (dq->dq_flags & DQ_LOCK) {
|
||||
@@ -748,7 +757,8 @@ dqget(vp, id, ump, type, dqp)
|
||||
dqfreel = dp;
|
||||
dq->dq_freef = NULL;
|
||||
dq->dq_freeb = NULL;
|
||||
if (dp = dq->dq_forw)
|
||||
dp = dq->dq_forw;
|
||||
if (dp)
|
||||
dp->dq_back = dq->dq_back;
|
||||
*dq->dq_back = dp;
|
||||
}
|
||||
@@ -757,7 +767,8 @@ dqget(vp, id, ump, type, dqp)
|
||||
*/
|
||||
if (vp != dqvp)
|
||||
VOP_LOCK(dqvp);
|
||||
if (dp = *dpp)
|
||||
dp = *dpp;
|
||||
if (dp)
|
||||
dp->dq_back = &dq->dq_forw;
|
||||
dq->dq_forw = dp;
|
||||
dq->dq_back = dpp;
|
||||
@@ -789,7 +800,8 @@ dqget(vp, id, ump, type, dqp)
|
||||
* quota structure and reflect problem to caller.
|
||||
*/
|
||||
if (error) {
|
||||
if (dp = dq->dq_forw)
|
||||
dp = dq->dq_forw;
|
||||
if (dp)
|
||||
dp->dq_back = dq->dq_back;
|
||||
*dq->dq_back = dp;
|
||||
dq->dq_forw = NULL;
|
||||
@@ -928,7 +940,8 @@ dqflush(vp)
|
||||
continue;
|
||||
if (dq->dq_cnt)
|
||||
panic("dqflush: stray dquot");
|
||||
if (dp = dq->dq_forw)
|
||||
dp = dq->dq_forw;
|
||||
if (dp)
|
||||
dp->dq_back = dq->dq_back;
|
||||
*dq->dq_back = dp;
|
||||
dq->dq_forw = NULL;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_vfsops.c 8.4 (Berkeley) 4/16/94
|
||||
* $Id$
|
||||
* $Id: ufs_vfsops.c,v 1.2 1994/08/02 07:55:01 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -85,7 +85,8 @@ ufs_root(mp, vpp)
|
||||
struct vnode *nvp;
|
||||
int error;
|
||||
|
||||
if (error = VFS_VGET(mp, (ino_t)ROOTINO, &nvp))
|
||||
error = VFS_VGET(mp, (ino_t)ROOTINO, &nvp);
|
||||
if (error)
|
||||
return (error);
|
||||
*vpp = nvp;
|
||||
return (0);
|
||||
@@ -102,11 +103,11 @@ ufs_quotactl(mp, cmds, uid, arg, p)
|
||||
caddr_t arg;
|
||||
struct proc *p;
|
||||
{
|
||||
int cmd, type, error;
|
||||
|
||||
#ifndef QUOTA
|
||||
return (EOPNOTSUPP);
|
||||
#else
|
||||
int cmd, type, error;
|
||||
|
||||
if (uid == -1)
|
||||
uid = p->p_cred->p_ruid;
|
||||
cmd = cmds >> SUBCMDSHIFT;
|
||||
@@ -190,7 +191,8 @@ ufs_check_export(mp, ufhp, nam, vpp, exflagsp, credanonp)
|
||||
if (np == NULL)
|
||||
return (EACCES);
|
||||
|
||||
if (error = VFS_VGET(mp, ufhp->ufid_ino, &nvp)) {
|
||||
error = VFS_VGET(mp, ufhp->ufid_ino, &nvp);
|
||||
if (error) {
|
||||
*vpp = NULLVP;
|
||||
return (error);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_vnops.c 8.10 (Berkeley) 4/1/94
|
||||
* $Id: ufs_vnops.c,v 1.8 1994/10/06 21:07:04 davidg Exp $
|
||||
* $Id: ufs_vnops.c,v 1.9 1994/10/08 01:41:15 phk Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -1893,6 +1893,9 @@ ufs_vinit(mntp, specops, fifoops, vpp)
|
||||
case VFIFO:
|
||||
vp->v_op = fifoops;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
if (ip->i_number == ROOTINO)
|
||||
vp->v_flag |= VROOT;
|
||||
|
||||
Reference in New Issue
Block a user