svn commit: r298528 - in stable/9/sys/ufs: ffs ufs
Pedro F. Giffuni
pfg at FreeBSD.org
Sun Apr 24 03:13:04 UTC 2016
Author: pfg
Date: Sun Apr 24 03:13:02 2016
New Revision: 298528
URL: https://svnweb.freebsd.org/changeset/base/298528
Log:
MFC r297791:
UFS: replace 0 with NULL for pointers.
While here also do late initialization of the variables we are
changing.
Found with devel/coccinelle.
Reviewed by: mckusick
Modified:
stable/9/sys/ufs/ffs/ffs_alloc.c
stable/9/sys/ufs/ffs/ffs_snapshot.c
stable/9/sys/ufs/ffs/ffs_softdep.c
stable/9/sys/ufs/ufs/ufs_lookup.c
Directory Properties:
stable/9/sys/ (props changed)
Modified: stable/9/sys/ufs/ffs/ffs_alloc.c
==============================================================================
--- stable/9/sys/ufs/ffs/ffs_alloc.c Sun Apr 24 03:11:52 2016 (r298527)
+++ stable/9/sys/ufs/ffs/ffs_alloc.c Sun Apr 24 03:13:02 2016 (r298528)
@@ -260,7 +260,6 @@ ffs_realloccg(ip, lbprev, bprev, bpref,
static int curfail;
int64_t delta;
- *bpp = 0;
vp = ITOV(ip);
fs = ip->i_fs;
bp = NULL;
@@ -320,6 +319,7 @@ retry:
/*
* Check for extension in the existing location.
*/
+ *bpp = NULL;
cg = dtog(fs, bprev);
UFS_LOCK(ump);
bno = ffs_fragextend(ip, cg, bprev, osize, nsize);
@@ -503,7 +503,7 @@ ffs_reallocblks_ufs1(ap)
struct inode *ip;
struct vnode *vp;
struct buf *sbp, *ebp;
- ufs1_daddr_t *bap, *sbap, *ebap = 0;
+ ufs1_daddr_t *bap, *sbap, *ebap;
struct cluster_save *buflist;
struct ufsmount *ump;
ufs_lbn_t start_lbn, end_lbn;
@@ -583,6 +583,7 @@ ffs_reallocblks_ufs1(ap)
/*
* If the block range spans two block maps, get the second map.
*/
+ ebap = NULL;
if (end_lvl == 0 || (idp = &end_ap[end_lvl - 1])->in_off + 1 >= len) {
ssize = len;
} else {
@@ -730,7 +731,7 @@ ffs_reallocblks_ufs2(ap)
struct inode *ip;
struct vnode *vp;
struct buf *sbp, *ebp;
- ufs2_daddr_t *bap, *sbap, *ebap = 0;
+ ufs2_daddr_t *bap, *sbap, *ebap;
struct cluster_save *buflist;
struct ufsmount *ump;
ufs_lbn_t start_lbn, end_lbn;
@@ -809,6 +810,7 @@ ffs_reallocblks_ufs2(ap)
/*
* If the block range spans two block maps, get the second map.
*/
+ ebap = NULL;
if (end_lvl == 0 || (idp = &end_ap[end_lvl - 1])->in_off + 1 >= len) {
ssize = len;
} else {
@@ -2732,7 +2734,8 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS)
return (EINVAL);
}
vn_start_write(vp, &mp, V_WAIT);
- if (mp == 0 || strncmp(mp->mnt_stat.f_fstypename, "ufs", MFSNAMELEN)) {
+ if (mp == NULL ||
+ strncmp(mp->mnt_stat.f_fstypename, "ufs", MFSNAMELEN)) {
vn_finished_write(mp);
fdrop(fp, td);
return (EINVAL);
Modified: stable/9/sys/ufs/ffs/ffs_snapshot.c
==============================================================================
--- stable/9/sys/ufs/ffs/ffs_snapshot.c Sun Apr 24 03:11:52 2016 (r298527)
+++ stable/9/sys/ufs/ffs/ffs_snapshot.c Sun Apr 24 03:13:02 2016 (r298528)
@@ -1892,7 +1892,7 @@ retry:
* dopersistence sysctl-setable flag to decide on the
* persistence needed for file content data.
*/
- if (savedcbp != 0) {
+ if (savedcbp != NULL) {
bcopy(savedcbp->b_data, cbp->b_data, fs->fs_bsize);
bawrite(cbp);
if ((vtype == VDIR || dopersistence) &&
@@ -2385,7 +2385,7 @@ ffs_copyonwrite(devvp, bp)
* dopersistence sysctl-setable flag to decide on the
* persistence needed for file content data.
*/
- if (savedcbp != 0) {
+ if (savedcbp != NULL) {
bcopy(savedcbp->b_data, cbp->b_data, fs->fs_bsize);
bawrite(cbp);
if ((devvp == bp->b_vp || bp->b_vp->v_type == VDIR ||
Modified: stable/9/sys/ufs/ffs/ffs_softdep.c
==============================================================================
--- stable/9/sys/ufs/ffs/ffs_softdep.c Sun Apr 24 03:11:52 2016 (r298527)
+++ stable/9/sys/ufs/ffs/ffs_softdep.c Sun Apr 24 03:13:02 2016 (r298528)
@@ -1870,7 +1870,7 @@ softdep_move_dependencies(oldbp, newbp)
if (wk->wk_type == D_BMSAFEMAP &&
bmsafemap_backgroundwrite(WK_BMSAFEMAP(wk), newbp))
dirty = 1;
- if (wktail == 0)
+ if (wktail == NULL)
LIST_INSERT_HEAD(&newbp->b_dep, wk, wk_list);
else
LIST_INSERT_AFTER(wktail, wk, wk_list);
@@ -6502,7 +6502,7 @@ softdep_journal_freeblocks(ip, cred, len
}
}
if ((flags & IO_EXT) != 0)
- while ((adp = TAILQ_FIRST(&inodedep->id_extupdt)) != 0)
+ while ((adp = TAILQ_FIRST(&inodedep->id_extupdt)) != NULL)
cancel_allocdirect(&inodedep->id_extupdt, adp,
freeblks);
/*
@@ -6752,14 +6752,14 @@ softdep_setup_freeblocks(ip, length, fla
if (flags & IO_NORMAL) {
merge_inode_lists(&inodedep->id_newinoupdt,
&inodedep->id_inoupdt);
- while ((adp = TAILQ_FIRST(&inodedep->id_inoupdt)) != 0)
+ while ((adp = TAILQ_FIRST(&inodedep->id_inoupdt)) != NULL)
cancel_allocdirect(&inodedep->id_inoupdt, adp,
freeblks);
}
if (flags & IO_EXT) {
merge_inode_lists(&inodedep->id_newextupdt,
&inodedep->id_extupdt);
- while ((adp = TAILQ_FIRST(&inodedep->id_extupdt)) != 0)
+ while ((adp = TAILQ_FIRST(&inodedep->id_extupdt)) != NULL)
cancel_allocdirect(&inodedep->id_extupdt, adp,
freeblks);
}
@@ -7856,8 +7856,8 @@ indir_trunc(freework, dbn, lbn)
struct fs *fs;
struct indirdep *indirdep;
struct ufsmount *ump;
- ufs1_daddr_t *bap1 = 0;
- ufs2_daddr_t nb, nnb, *bap2 = 0;
+ ufs1_daddr_t *bap1;
+ ufs2_daddr_t nb, nnb, *bap2;
ufs_lbn_t lbnadd, nlbn;
int i, nblocks, ufs1fmt;
int freedblocks;
@@ -7942,10 +7942,12 @@ indir_trunc(freework, dbn, lbn)
bap1 = (ufs1_daddr_t *)bp->b_data;
nb = bap1[freework->fw_off];
ufs1fmt = 1;
+ bap2 = NULL;
} else {
bap2 = (ufs2_daddr_t *)bp->b_data;
nb = bap2[freework->fw_off];
ufs1fmt = 0;
+ bap1 = NULL;
}
level = lbn_level(lbn);
needj = MOUNTEDSUJ(UFSTOVFS(ump)) != 0;
@@ -8119,7 +8121,7 @@ setup_newdir(dap, newinum, dinum, newdir
struct newblk *newblk;
struct pagedep *pagedep;
struct inodedep *inodedep;
- struct newdirblk *newdirblk = 0;
+ struct newdirblk *newdirblk;
struct mkdir *mkdir1, *mkdir2;
struct worklist *wk;
struct jaddref *jaddref;
@@ -8244,7 +8246,7 @@ softdep_setup_directory_add(bp, dp, diro
struct newblk *newblk;
struct pagedep *pagedep;
struct inodedep *inodedep;
- struct newdirblk *newdirblk = 0;
+ struct newdirblk *newdirblk;
struct mkdir *mkdir1, *mkdir2;
struct jaddref *jaddref;
struct mount *mp;
@@ -8272,6 +8274,7 @@ softdep_setup_directory_add(bp, dp, diro
dap->da_state = ATTACHED;
LIST_INIT(&dap->da_jwork);
isindir = bp->b_lblkno >= NDADDR;
+ newdirblk = NULL;
if (isnewblk &&
(isindir ? blkoff(fs, diroffset) : fragoff(fs, diroffset)) == 0) {
newdirblk = malloc(sizeof(struct newdirblk),
@@ -8362,7 +8365,7 @@ softdep_setup_directory_add(bp, dp, diro
inodedep->id_mkdiradd = dap;
} else if (inodedep->id_mkdiradd)
merge_diradd(inodedep, dap);
- if (newdirblk) {
+ if (newdirblk != NULL) {
/*
* There is nothing to do if we are already tracking
* this block.
@@ -10312,13 +10315,13 @@ cancel_indirdep(indirdep, bp, freeblks)
* Pass in bp for blocks still have journal writes
* pending so we can cancel them on their own.
*/
- while ((aip = LIST_FIRST(&indirdep->ir_deplisthd)) != 0)
+ while ((aip = LIST_FIRST(&indirdep->ir_deplisthd)) != NULL)
cancel_allocindir(aip, bp, freeblks, 0);
- while ((aip = LIST_FIRST(&indirdep->ir_donehd)) != 0)
+ while ((aip = LIST_FIRST(&indirdep->ir_donehd)) != NULL)
cancel_allocindir(aip, NULL, freeblks, 0);
- while ((aip = LIST_FIRST(&indirdep->ir_writehd)) != 0)
+ while ((aip = LIST_FIRST(&indirdep->ir_writehd)) != NULL)
cancel_allocindir(aip, NULL, freeblks, 0);
- while ((aip = LIST_FIRST(&indirdep->ir_completehd)) != 0)
+ while ((aip = LIST_FIRST(&indirdep->ir_completehd)) != NULL)
cancel_allocindir(aip, NULL, freeblks, 0);
/*
* If there are pending partial truncations we need to keep the
@@ -11332,7 +11335,7 @@ handle_written_indirdep(indirdep, bp, bp
* the indirdep's pointer is not yet written. Otherwise
* free them here.
*/
- while ((aip = LIST_FIRST(&indirdep->ir_writehd)) != 0) {
+ while ((aip = LIST_FIRST(&indirdep->ir_writehd)) != NULL) {
LIST_REMOVE(aip, ai_next);
if ((indirdep->ir_state & DEPCOMPLETE) == 0) {
LIST_INSERT_HEAD(&indirdep->ir_completehd, aip,
@@ -11347,7 +11350,7 @@ handle_written_indirdep(indirdep, bp, bp
* the done list to the write list after updating the pointers.
*/
if (TAILQ_EMPTY(&indirdep->ir_trunc)) {
- while ((aip = LIST_FIRST(&indirdep->ir_donehd)) != 0) {
+ while ((aip = LIST_FIRST(&indirdep->ir_donehd)) != NULL) {
handle_allocindir_partdone(aip);
if (aip == LIST_FIRST(&indirdep->ir_donehd))
panic("disk_write_complete: not gone");
Modified: stable/9/sys/ufs/ufs/ufs_lookup.c
==============================================================================
--- stable/9/sys/ufs/ufs/ufs_lookup.c Sun Apr 24 03:11:52 2016 (r298527)
+++ stable/9/sys/ufs/ufs/ufs_lookup.c Sun Apr 24 03:13:02 2016 (r298528)
@@ -1251,7 +1251,8 @@ out:
* drop its snapshot reference so that it will be reclaimed
* when last open reference goes away.
*/
- if (ip != 0 && (ip->i_flags & SF_SNAPSHOT) != 0 && ip->i_effnlink == 0)
+ if (ip != NULL && (ip->i_flags & SF_SNAPSHOT) != 0 &&
+ ip->i_effnlink == 0)
UFS_SNAPGONE(ip);
return (error);
}
More information about the svn-src-stable-9
mailing list