makefs: use FreeBSD brelse function signature
Although the ffs (and later msdosfs) implementation in makefs is independent of the one in kernel, it makes sense to keep differences to a minimum in order to ease comparison and porting changes across. Submitted by: Siva Mahadevan Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
240138a391
commit
ad0eafa64d
@ -980,7 +980,7 @@ ffs_write_file(union dinode *din, uint32_t ino, void *buf, fsinfo_t *fsopts)
|
||||
errno = bwrite(bp);
|
||||
if (errno != 0)
|
||||
goto bad_ffs_write_file;
|
||||
brelse(bp, 0);
|
||||
brelse(bp);
|
||||
if (!isfile)
|
||||
p += chunk;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ bread(struct vnode *vp, daddr_t blkno, int size, struct ucred *u1 __unused,
|
||||
}
|
||||
|
||||
void
|
||||
brelse(struct buf *bp, int u1 __unused)
|
||||
brelse(struct buf *bp)
|
||||
{
|
||||
|
||||
assert (bp != NULL);
|
||||
|
@ -67,7 +67,7 @@ struct buf {
|
||||
void bcleanup(void);
|
||||
int bread(struct vnode *, daddr_t, int, struct ucred *,
|
||||
struct buf **);
|
||||
void brelse(struct buf *, int);
|
||||
void brelse(struct buf *);
|
||||
int bwrite(struct buf *);
|
||||
struct buf * getblk(struct vnode *, daddr_t, int, int, int, int);
|
||||
|
||||
|
@ -305,13 +305,13 @@ ffs_alloccg(struct inode *ip, int cg, daddr_t bpref, int size)
|
||||
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)), (int)fs->fs_cgsize,
|
||||
NULL, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
brelse(bp);
|
||||
return (0);
|
||||
}
|
||||
cgp = (struct cg *)bp->b_data;
|
||||
if (!cg_chkmagic_swap(cgp, needswap) ||
|
||||
(cgp->cg_cs.cs_nbfree == 0 && size == fs->fs_bsize)) {
|
||||
brelse(bp, 0);
|
||||
brelse(bp);
|
||||
return (0);
|
||||
}
|
||||
if (size == fs->fs_bsize) {
|
||||
@ -334,7 +334,7 @@ ffs_alloccg(struct inode *ip, int cg, daddr_t bpref, int size)
|
||||
* allocated, and hacked up
|
||||
*/
|
||||
if (cgp->cg_cs.cs_nbfree == 0) {
|
||||
brelse(bp, 0);
|
||||
brelse(bp);
|
||||
return (0);
|
||||
}
|
||||
bno = ffs_alloccgblk(ip, bp, bpref);
|
||||
@ -449,12 +449,12 @@ ffs_blkfree(struct inode *ip, daddr_t bno, long size)
|
||||
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)), (int)fs->fs_cgsize,
|
||||
NULL, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
brelse(bp);
|
||||
return;
|
||||
}
|
||||
cgp = (struct cg *)bp->b_data;
|
||||
if (!cg_chkmagic_swap(cgp, needswap)) {
|
||||
brelse(bp, 0);
|
||||
brelse(bp);
|
||||
return;
|
||||
}
|
||||
cgbno = dtogd(fs, bno);
|
||||
|
@ -138,7 +138,7 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
||||
error = bread(ip->i_devvp, lbn, fs->fs_bsize,
|
||||
NULL, bpp);
|
||||
if (error) {
|
||||
brelse(*bpp, 0);
|
||||
brelse(*bpp);
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
@ -164,7 +164,7 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
||||
error = bread(ip->i_devvp, lbn, osize,
|
||||
NULL, bpp);
|
||||
if (error) {
|
||||
brelse(*bpp, 0);
|
||||
brelse(*bpp);
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
@ -250,7 +250,7 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
||||
error = bread(ip->i_devvp, indirs[i].in_lbn, fs->fs_bsize,
|
||||
NULL, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
brelse(bp);
|
||||
return error;
|
||||
}
|
||||
bap = (int32_t *)bp->b_data;
|
||||
@ -259,14 +259,14 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
||||
break;
|
||||
i++;
|
||||
if (nb != 0) {
|
||||
brelse(bp, 0);
|
||||
brelse(bp);
|
||||
continue;
|
||||
}
|
||||
if (pref == 0)
|
||||
pref = ffs_blkpref_ufs1(ip, lbn, 0, (int32_t *)0);
|
||||
error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, &newb);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
brelse(bp);
|
||||
return error;
|
||||
}
|
||||
nb = newb;
|
||||
@ -280,7 +280,7 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
||||
*/
|
||||
|
||||
if ((error = bwrite(nbp)) != 0) {
|
||||
brelse(bp, 0);
|
||||
brelse(bp);
|
||||
return error;
|
||||
}
|
||||
bap[indirs[i - 1].in_off] = ufs_rw32(nb, needswap);
|
||||
@ -296,7 +296,7 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
||||
pref = ffs_blkpref_ufs1(ip, lbn, indirs[num].in_off, &bap[0]);
|
||||
error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, &newb);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
brelse(bp);
|
||||
return error;
|
||||
}
|
||||
nb = newb;
|
||||
@ -316,11 +316,11 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
||||
bwrite(bp);
|
||||
return (0);
|
||||
}
|
||||
brelse(bp, 0);
|
||||
brelse(bp);
|
||||
if (bpp != NULL) {
|
||||
error = bread(ip->i_devvp, lbn, (int)fs->fs_bsize, NULL, &nbp);
|
||||
if (error) {
|
||||
brelse(nbp, 0);
|
||||
brelse(nbp);
|
||||
return error;
|
||||
}
|
||||
*bpp = nbp;
|
||||
@ -389,7 +389,7 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
||||
error = bread(ip->i_devvp, lbn, fs->fs_bsize,
|
||||
NULL, bpp);
|
||||
if (error) {
|
||||
brelse(*bpp, 0);
|
||||
brelse(*bpp);
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
@ -415,7 +415,7 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
||||
error = bread(ip->i_devvp, lbn, osize,
|
||||
NULL, bpp);
|
||||
if (error) {
|
||||
brelse(*bpp, 0);
|
||||
brelse(*bpp);
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
@ -501,7 +501,7 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
||||
error = bread(ip->i_devvp, indirs[i].in_lbn, fs->fs_bsize,
|
||||
NULL, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
brelse(bp);
|
||||
return error;
|
||||
}
|
||||
bap = (int64_t *)bp->b_data;
|
||||
@ -510,14 +510,14 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
||||
break;
|
||||
i++;
|
||||
if (nb != 0) {
|
||||
brelse(bp, 0);
|
||||
brelse(bp);
|
||||
continue;
|
||||
}
|
||||
if (pref == 0)
|
||||
pref = ffs_blkpref_ufs2(ip, lbn, 0, (int64_t *)0);
|
||||
error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, &newb);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
brelse(bp);
|
||||
return error;
|
||||
}
|
||||
nb = newb;
|
||||
@ -531,7 +531,7 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
||||
*/
|
||||
|
||||
if ((error = bwrite(nbp)) != 0) {
|
||||
brelse(bp, 0);
|
||||
brelse(bp);
|
||||
return error;
|
||||
}
|
||||
bap[indirs[i - 1].in_off] = ufs_rw64(nb, needswap);
|
||||
@ -547,7 +547,7 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
||||
pref = ffs_blkpref_ufs2(ip, lbn, indirs[num].in_off, &bap[0]);
|
||||
error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, &newb);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
brelse(bp);
|
||||
return error;
|
||||
}
|
||||
nb = newb;
|
||||
@ -567,11 +567,11 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
||||
bwrite(bp);
|
||||
return (0);
|
||||
}
|
||||
brelse(bp, 0);
|
||||
brelse(bp);
|
||||
if (bpp != NULL) {
|
||||
error = bread(ip->i_devvp, lbn, (int)fs->fs_bsize, NULL, &nbp);
|
||||
if (error) {
|
||||
brelse(nbp, 0);
|
||||
brelse(nbp);
|
||||
return error;
|
||||
}
|
||||
*bpp = nbp;
|
||||
|
@ -160,7 +160,7 @@ deget(struct msdosfsmount *pmp, u_long dirclust, u_long diroffset,
|
||||
return (error);
|
||||
}
|
||||
DE_INTERNALIZE(ldep, direntptr);
|
||||
brelse(bp, 0);
|
||||
brelse(bp);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -326,7 +326,7 @@ msdosfs_mount(struct vnode *devvp, int flags)
|
||||
/*
|
||||
* Release the bootsector buffer.
|
||||
*/
|
||||
brelse(bp, BC_AGE);
|
||||
brelse(bp);
|
||||
bp = NULL;
|
||||
|
||||
/*
|
||||
@ -353,7 +353,7 @@ msdosfs_mount(struct vnode *devvp, int flags)
|
||||
pmp->pm_nxtfree = getulong(fp->fsinxtfree);
|
||||
else
|
||||
pmp->pm_fsinfo = 0;
|
||||
brelse(bp, 0);
|
||||
brelse(bp);
|
||||
bp = NULL;
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ msdosfs_findslot(struct denode *dp, struct componentname *cnp)
|
||||
slotoffset = diroff;
|
||||
}
|
||||
if (dep->deName[0] == SLOT_EMPTY) {
|
||||
brelse(bp, 0);
|
||||
brelse(bp);
|
||||
goto notfound;
|
||||
}
|
||||
} else {
|
||||
@ -291,7 +291,7 @@ msdosfs_findslot(struct denode *dp, struct componentname *cnp)
|
||||
* Release the buffer holding the directory cluster just
|
||||
* searched.
|
||||
*/
|
||||
brelse(bp, 0);
|
||||
brelse(bp);
|
||||
} /* for (frcn = 0; ; frcn++) */
|
||||
|
||||
notfound:
|
||||
|
Loading…
Reference in New Issue
Block a user