summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/ufs/ext2fs/ext2fs_alloc.c4
-rw-r--r--sys/ufs/ext2fs/ext2fs_inode.c19
-rw-r--r--sys/ufs/ext2fs/ext2fs_lookup.c6
-rw-r--r--sys/ufs/ext2fs/ext2fs_vfsops.c31
-rw-r--r--sys/ufs/ext2fs/ext2fs_vnops.c6
-rw-r--r--sys/ufs/ffs/ffs_alloc.c8
-rw-r--r--sys/ufs/ffs/ffs_inode.c7
-rw-r--r--sys/ufs/ffs/ffs_softdep.c24
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c39
-rw-r--r--sys/ufs/ffs/ffs_vnops.c9
-rw-r--r--sys/ufs/mfs/mfs_vfsops.c16
-rw-r--r--sys/ufs/ufs/ufs_lookup.c14
-rw-r--r--sys/ufs/ufs/ufs_quota.c4
-rw-r--r--sys/ufs/ufs/ufs_vnops.c8
14 files changed, 93 insertions, 102 deletions
diff --git a/sys/ufs/ext2fs/ext2fs_alloc.c b/sys/ufs/ext2fs/ext2fs_alloc.c
index 017834135db..3c523f3d412 100644
--- a/sys/ufs/ext2fs/ext2fs_alloc.c
+++ b/sys/ufs/ext2fs/ext2fs_alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_alloc.c,v 1.29 2013/06/11 16:42:18 deraadt Exp $ */
+/* $OpenBSD: ext2fs_alloc.c,v 1.30 2013/12/12 19:00:09 tedu Exp $ */
/* $NetBSD: ext2fs_alloc.c,v 1.10 2001/07/05 08:38:27 toshii Exp $ */
/*
@@ -167,7 +167,7 @@ ext2fs_inode_alloc(struct inode *pip, mode_t mode, struct ucred *cred,
panic("ext2fs_valloc: dup alloc");
}
- bzero(ip->i_e2din, sizeof(struct ext2fs_dinode));
+ memset(ip->i_e2din, 0, sizeof(struct ext2fs_dinode));
/*
* Set up a new generation number for this inode.
diff --git a/sys/ufs/ext2fs/ext2fs_inode.c b/sys/ufs/ext2fs/ext2fs_inode.c
index 3158a0a70ce..21f3506d287 100644
--- a/sys/ufs/ext2fs/ext2fs_inode.c
+++ b/sys/ufs/ext2fs/ext2fs_inode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_inode.c,v 1.45 2012/03/23 15:51:26 guenther Exp $ */
+/* $OpenBSD: ext2fs_inode.c,v 1.46 2013/12/12 19:00:09 tedu Exp $ */
/* $NetBSD: ext2fs_inode.c,v 1.24 2001/06/19 12:59:18 wiz Exp $ */
/*
@@ -246,8 +246,7 @@ ext2fs_truncate(struct inode *oip, off_t length, int flags, struct ucred *cred)
if (length != 0)
panic("ext2fs_truncate: partial truncate of symlink");
#endif
- bzero((char *)&oip->i_e2din->e2di_shortlink,
- (u_int)ext2fs_size(oip));
+ memset(&oip->i_e2din->e2di_shortlink, 0, ext2fs_size(oip));
(void)ext2fs_setsize(oip, 0);
oip->i_flag |= IN_CHANGE | IN_UPDATE;
return (ext2fs_update(oip, NULL, NULL, 1));
@@ -311,7 +310,7 @@ ext2fs_truncate(struct inode *oip, off_t length, int flags, struct ucred *cred)
size = fs->e2fs_bsize;
uvm_vnp_setsize(ovp, length);
uvm_vnp_uncache(ovp);
- bzero(bp->b_data + offset, (u_int)(size - offset));
+ memset(bp->b_data + offset, 0, size - offset);
bp->b_bcount = size;
if (aflags & B_SYNC)
bwrite(bp);
@@ -335,7 +334,7 @@ ext2fs_truncate(struct inode *oip, off_t length, int flags, struct ucred *cred)
* will be returned to the free list. lastiblock values are also
* normalized to -1 for calls to ext2fs_indirtrunc below.
*/
- memcpy((caddr_t)oldblks, (caddr_t)&oip->i_e2fs_blocks[0], sizeof oldblks);
+ memcpy(oldblks, &oip->i_e2fs_blocks[0], sizeof(oldblks));
for (level = TRIPLE; level >= SINGLE; level--)
if (lastiblock[level] < 0) {
oip->i_e2fs_blocks[NDADDR + level] = 0;
@@ -352,8 +351,8 @@ ext2fs_truncate(struct inode *oip, off_t length, int flags, struct ucred *cred)
* Note that we save the new block configuration so we can check it
* when we are done.
*/
- bcopy((caddr_t)&oip->i_e2fs_blocks[0], (caddr_t)newblks, sizeof newblks);
- bcopy((caddr_t)oldblks, (caddr_t)&oip->i_e2fs_blocks[0], sizeof oldblks);
+ memcpy(newblks, &oip->i_e2fs_blocks[0], sizeof(newblks));
+ memcpy(&oip->i_e2fs_blocks[0], oldblks, sizeof(oldblks));
(void)ext2fs_setsize(oip, osize);
vflags = ((length > 0) ? V_SAVE : 0) | V_SAVEMETA;
allerror = vinvalbuf(ovp, vflags, cred, curproc, 0, 0);
@@ -484,9 +483,9 @@ ext2fs_indirtrunc(struct inode *ip, int32_t lbn, int32_t dbn, int32_t lastbn, in
bap = (int32_t *)bp->b_data;
if (lastbn >= 0) {
copy = malloc(fs->e2fs_bsize, M_TEMP, M_WAITOK);
- memcpy((caddr_t)copy, (caddr_t)bap, (u_int)fs->e2fs_bsize);
- memset((caddr_t)&bap[last + 1], 0,
- (u_int)(NINDIR(fs) - (last + 1)) * sizeof (u_int32_t));
+ memcpy(copy, bap, fs->e2fs_bsize);
+ memset(&bap[last + 1], 0,
+ (NINDIR(fs) - (last + 1)) * sizeof(u_int32_t));
error = bwrite(bp);
if (error)
allerror = error;
diff --git a/sys/ufs/ext2fs/ext2fs_lookup.c b/sys/ufs/ext2fs/ext2fs_lookup.c
index b8c9837a902..239efdd9c8d 100644
--- a/sys/ufs/ext2fs/ext2fs_lookup.c
+++ b/sys/ufs/ext2fs/ext2fs_lookup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_lookup.c,v 1.29 2013/08/13 05:52:27 guenther Exp $ */
+/* $OpenBSD: ext2fs_lookup.c,v 1.30 2013/12/12 19:00:09 tedu Exp $ */
/* $NetBSD: ext2fs_lookup.c,v 1.16 2000/08/03 20:29:26 thorpej Exp $ */
/*
@@ -819,7 +819,7 @@ ext2fs_direnter(struct inode *ip, struct vnode *dvp,
dsize = EXT2FS_DIRSIZ(nep->e2d_namlen);
spacefree += fs2h16(nep->e2d_reclen) - dsize;
loc += fs2h16(nep->e2d_reclen);
- memcpy((caddr_t)ep, (caddr_t)nep, dsize);
+ memcpy(ep, nep, dsize);
}
/*
* Update the pointer fields in the previous entry (if any),
@@ -843,7 +843,7 @@ ext2fs_direnter(struct inode *ip, struct vnode *dvp,
ep->e2d_reclen = h2fs16(dsize);
ep = (struct ext2fs_direct *)((char *)ep + dsize);
}
- memcpy((caddr_t)ep, (caddr_t)&newdir, (u_int)newentrysize);
+ memcpy(ep, &newdir, newentrysize);
error = VOP_BWRITE(bp);
dp->i_flag |= IN_CHANGE | IN_UPDATE;
if (!error && dp->i_endoff && dp->i_endoff < ext2fs_size(dp))
diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c
index 5d95d4fc3b2..74d3b2b85e9 100644
--- a/sys/ufs/ext2fs/ext2fs_vfsops.c
+++ b/sys/ufs/ext2fs/ext2fs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_vfsops.c,v 1.69 2013/12/01 16:40:56 krw Exp $ */
+/* $OpenBSD: ext2fs_vfsops.c,v 1.70 2013/12/12 19:00:09 tedu Exp $ */
/* $NetBSD: ext2fs_vfsops.c,v 1.1 1997/06/11 09:34:07 bouyer Exp $ */
/*
@@ -140,13 +140,12 @@ ext2fs_mountroot(void)
TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list);
ump = VFSTOUFS(mp);
fs = ump->um_e2fs;
- bzero(fs->e2fs_fsmnt, sizeof(fs->e2fs_fsmnt));
- (void)copystr(mp->mnt_stat.f_mntonname, fs->e2fs_fsmnt,
- sizeof(fs->e2fs_fsmnt) - 1, NULL);
+ memset(fs->e2fs_fsmnt, 0, sizeof(fs->e2fs_fsmnt));
+ strlcpy(fs->e2fs_fsmnt, mp->mnt_stat.f_mntonname, sizeof(fs->e2fs_fsmnt));
if (fs->e2fs.e2fs_rev > E2FS_REV0) {
- bzero(fs->e2fs.e2fs_fsmnt, sizeof(fs->e2fs.e2fs_fsmnt));
- (void)copystr(mp->mnt_stat.f_mntonname, fs->e2fs.e2fs_fsmnt,
- sizeof(fs->e2fs.e2fs_fsmnt) - 1, NULL);
+ memset(fs->e2fs.e2fs_fsmnt, 0, sizeof(fs->e2fs.e2fs_fsmnt));
+ strlcpy(fs->e2fs.e2fs_fsmnt, mp->mnt_stat.f_mntonname,
+ sizeof(fs->e2fs.e2fs_fsmnt));
}
(void)ext2fs_statfs(mp, &mp->mnt_stat, p);
vfs_unbusy(mp);
@@ -241,7 +240,7 @@ ext2fs_mount(struct mount *mp, const char *path, void *data,
goto error;
if (disk_map(fspec, fname, MNAMELEN, DM_OPENBLCK) == -1)
- bcopy(fspec, fname, sizeof(fname));
+ memcpy(fname, fspec, sizeof(fname));
NDINIT(ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, fname, p);
if ((error = namei(ndp)) != 0)
@@ -283,17 +282,17 @@ ext2fs_mount(struct mount *mp, const char *path, void *data,
ump = VFSTOUFS(mp);
fs = ump->um_e2fs;
- bzero(fs->e2fs_fsmnt, sizeof(fs->e2fs_fsmnt));
+ memset(fs->e2fs_fsmnt, 0, sizeof(fs->e2fs_fsmnt));
strlcpy(fs->e2fs_fsmnt, path, sizeof(fs->e2fs_fsmnt));
if (fs->e2fs.e2fs_rev > E2FS_REV0) {
- bzero(fs->e2fs.e2fs_fsmnt, sizeof(fs->e2fs.e2fs_fsmnt));
+ memset(fs->e2fs.e2fs_fsmnt, 0, sizeof(fs->e2fs.e2fs_fsmnt));
strlcpy(fs->e2fs.e2fs_fsmnt, mp->mnt_stat.f_mntonname,
sizeof(fs->e2fs.e2fs_fsmnt));
}
- bcopy(fs->e2fs_fsmnt, mp->mnt_stat.f_mntonname, MNAMELEN);
- bzero(mp->mnt_stat.f_mntfromname, MNAMELEN);
+ memcpy(mp->mnt_stat.f_mntonname, fs->e2fs_fsmnt, MNAMELEN);
+ memset(mp->mnt_stat.f_mntfromname, 0, MNAMELEN);
strlcpy(mp->mnt_stat.f_mntfromname, fname, MNAMELEN);
- bzero(mp->mnt_stat.f_mntfromspec, MNAMELEN);
+ memset(mp->mnt_stat.f_mntfromspec, 0, MNAMELEN);
strlcpy(mp->mnt_stat.f_mntfromspec, fspec, MNAMELEN);
if (fs->e2fs_fmod != 0) { /* XXX */
@@ -698,9 +697,9 @@ ext2fs_statfs(struct mount *mp, struct statfs *sbp, struct proc *p)
sbp->f_files = fs->e2fs.e2fs_icount;
sbp->f_ffree = fs->e2fs.e2fs_ficount;
if (sbp != &mp->mnt_stat) {
- bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN);
- bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN);
- bcopy(mp->mnt_stat.f_mntfromspec, sbp->f_mntfromspec, MNAMELEN);
+ memcpy(sbp->f_mntonname, mp->mnt_stat.f_mntonname, MNAMELEN);
+ memcpy(sbp->f_mntfromname, mp->mnt_stat.f_mntfromname, MNAMELEN);
+ memcpy(sbp->f_mntfromspec, mp->mnt_stat.f_mntfromspec, MNAMELEN);
}
strncpy(sbp->f_fstypename, mp->mnt_vfc->vfc_name, MFSNAMELEN);
return (0);
diff --git a/sys/ufs/ext2fs/ext2fs_vnops.c b/sys/ufs/ext2fs/ext2fs_vnops.c
index 65370bfc7e9..636be0b840b 100644
--- a/sys/ufs/ext2fs/ext2fs_vnops.c
+++ b/sys/ufs/ext2fs/ext2fs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_vnops.c,v 1.62 2013/03/28 03:29:44 guenther Exp $ */
+/* $OpenBSD: ext2fs_vnops.c,v 1.63 2013/12/12 19:00:09 tedu Exp $ */
/* $NetBSD: ext2fs_vnops.c,v 1.1 1997/06/11 09:34:09 bouyer Exp $ */
/*
@@ -931,7 +931,7 @@ ext2fs_mkdir(void *v)
goto bad;
/* Initialize directory with "." and ".." from static template. */
- bzero(&dirtemplate, sizeof(dirtemplate));
+ memset(&dirtemplate, 0, sizeof(dirtemplate));
dirtemplate.dot_ino = h2fs32(ip->i_number);
dirtemplate.dot_reclen = h2fs16(12);
dirtemplate.dot_namlen = 1;
@@ -1086,7 +1086,7 @@ ext2fs_symlink(void *v)
len = strlen(ap->a_target);
if (len < vp->v_mount->mnt_maxsymlinklen) {
ip = VTOI(vp);
- bcopy(ap->a_target, (char *)ip->i_e2din->e2di_shortlink, len);
+ memcpy(ip->i_e2din->e2di_shortlink, ap->a_target, len);
error = ext2fs_setsize(ip, len);
if (error)
goto bad;
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c
index 04c841807a3..8e565a6b9c6 100644
--- a/sys/ufs/ffs/ffs_alloc.c
+++ b/sys/ufs/ffs/ffs_alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_alloc.c,v 1.97 2013/11/01 17:36:19 krw Exp $ */
+/* $OpenBSD: ffs_alloc.c,v 1.98 2013/12/12 19:00:09 tedu Exp $ */
/* $NetBSD: ffs_alloc.c,v 1.11 1996/05/11 18:27:09 mycroft Exp $ */
/*
@@ -249,7 +249,7 @@ ffs_realloccg(struct inode *ip, daddr_t lbprev, daddr_t bpref, int osize,
#endif
bp->b_bcount = nsize;
bp->b_flags |= B_DONE;
- bzero(bp->b_data + osize, (u_int)nsize - osize);
+ memset(bp->b_data + osize, 0, nsize - osize);
*bpp = bp;
}
if (blknop != NULL) {
@@ -321,7 +321,7 @@ ffs_realloccg(struct inode *ip, daddr_t lbprev, daddr_t bpref, int osize,
#endif
bp->b_bcount = nsize;
bp->b_flags |= B_DONE;
- bzero(bp->b_data + osize, (u_int)nsize - osize);
+ memset(bp->b_data + osize, 0, nsize - osize);
*bpp = bp;
}
if (blknop != NULL) {
@@ -1782,7 +1782,7 @@ gotit:
ino_to_fsba(fs, cg * fs->fs_ipg + cgp->cg_initediblk)),
(int)fs->fs_bsize, 0, 0);
- bzero(ibp->b_data, (int)fs->fs_bsize);
+ memset(ibp->b_data, 0, fs->fs_bsize);
dp2 = (struct ufs2_dinode *)(ibp->b_data);
/* Give each inode a positive generation number */
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c
index d086fd03127..d41aa96bb49 100644
--- a/sys/ufs/ffs/ffs_inode.c
+++ b/sys/ufs/ffs/ffs_inode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_inode.c,v 1.65 2013/11/02 00:08:17 krw Exp $ */
+/* $OpenBSD: ffs_inode.c,v 1.66 2013/12/12 19:00:09 tedu Exp $ */
/* $NetBSD: ffs_inode.c,v 1.10 1996/05/11 18:27:19 mycroft Exp $ */
/*
@@ -289,8 +289,7 @@ ffs_truncate(struct inode *oip, off_t length, int flags, struct ucred *cred)
size = blksize(fs, oip, lbn);
(void) uvm_vnp_uncache(ovp);
if (ovp->v_type != VDIR)
- bzero((char *)bp->b_data + offset,
- (u_int)(size - offset));
+ memset(bp->b_data + offset, 0, size - offset);
bp->b_bcount = size;
if (aflags & B_SYNC)
bwrite(bp);
@@ -534,7 +533,7 @@ ffs_indirtrunc(struct inode *ip, daddr_t lbn, daddr_t dbn,
if (lastbn != -1) {
copy = malloc(fs->fs_bsize, M_TEMP, M_WAITOK);
- bcopy(bp->b_data, copy, (u_int) fs->fs_bsize);
+ memcpy(copy, bp->b_data, fs->fs_bsize);
for (i = last + 1; i < NINDIR(fs); i++)
BAP_ASSIGN(ip, i, 0);
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index 5411af43829..2bc4f4cc81b 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_softdep.c,v 1.123 2013/12/01 16:40:56 krw Exp $ */
+/* $OpenBSD: ffs_softdep.c,v 1.124 2013/12/12 19:00:10 tedu Exp $ */
/*
* Copyright 1998, 2000 Marshall Kirk McKusick. All Rights Reserved.
@@ -1214,7 +1214,7 @@ softdep_mount(struct vnode *devvp, struct mount *mp, struct fs *fs,
*/
if ((fs->fs_flags & FS_UNCLEAN) == 0)
return (0);
- bzero(&cstotal, sizeof cstotal);
+ memset(&cstotal, 0, sizeof(cstotal));
for (cyl = 0; cyl < fs->fs_ncg; cyl++) {
if ((error = bread(devvp, fsbtodb(fs, cgtod(fs, cyl)),
fs->fs_cgsize, &bp)) != 0) {
@@ -1230,10 +1230,10 @@ softdep_mount(struct vnode *devvp, struct mount *mp, struct fs *fs,
brelse(bp);
}
#ifdef DEBUG
- if (bcmp(&cstotal, &fs->fs_cstotal, sizeof cstotal))
+ if (memcmp(&cstotal, &fs->fs_cstotal, sizeof(cstotal)))
printf("ffs_mountfs: superblock updated for soft updates\n");
#endif
- bcopy(&cstotal, &fs->fs_cstotal, sizeof cstotal);
+ memcpy(&fs->fs_cstotal, &cstotal, sizeof(cstotal));
return (0);
}
@@ -1835,7 +1835,7 @@ setup_allocindir_phase2(struct buf *bp, struct inode *ip,
#if 0
BUF_KERNPROC(newindirdep->ir_savebp);
#endif
- bcopy(bp->b_data, newindirdep->ir_savebp->b_data, bp->b_bcount);
+ memcpy(newindirdep->ir_savebp->b_data, bp->b_data, bp->b_bcount);
}
}
@@ -2052,7 +2052,7 @@ deallocate_dependencies(struct buf *bp, struct inodedep *inodedep)
FREE_LOCK(&lk);
panic("deallocate_dependencies: not indir");
}
- bcopy(bp->b_data, indirdep->ir_savebp->b_data,
+ memcpy(indirdep->ir_savebp->b_data, bp->b_data,
bp->b_bcount);
WORKLIST_REMOVE(wk);
WORKLIST_INSERT(&indirdep->ir_savebp->b_dep, wk);
@@ -2726,7 +2726,7 @@ softdep_change_directoryentry_offset(struct inode *dp, caddr_t base,
}
}
done:
- bcopy(oldloc, newloc, entrysize);
+ memmove(newloc, oldloc, entrysize);
FREE_LOCK(&lk);
}
@@ -3296,8 +3296,8 @@ softdep_disk_io_initiation(struct buf *bp)
ACQUIRE_LOCK(&lk);
indirdep->ir_state &= ~ATTACHED;
indirdep->ir_state |= UNDONE;
- bcopy(bp->b_data, indirdep->ir_saveddata, bp->b_bcount);
- bcopy(indirdep->ir_savebp->b_data, bp->b_data,
+ memcpy(indirdep->ir_saveddata, bp->b_data, bp->b_bcount);
+ memcpy(bp->b_data, indirdep->ir_savebp->b_data,
bp->b_bcount);
continue;
@@ -3402,7 +3402,7 @@ initiate_write_inodeblock_ufs1(struct inodedep *inodedep, struct buf *bp)
M_INODEDEP, M_WAITOK);
ACQUIRE_LOCK(&lk);
*inodedep->id_savedino1 = *dp;
- bzero((caddr_t)dp, sizeof(struct ufs1_dinode));
+ memset(dp, 0, sizeof(struct ufs1_dinode));
return;
}
/*
@@ -3543,7 +3543,7 @@ initiate_write_inodeblock_ufs2(struct inodedep *inodedep, struct buf *bp)
inodedep->id_savedino2 = malloc(sizeof(struct ufs2_dinode),
M_INODEDEP, M_WAITOK);
*inodedep->id_savedino2 = *dp;
- bzero((caddr_t)dp, sizeof(struct ufs2_dinode));
+ memset(dp, 0, sizeof(struct ufs2_dinode));
return;
}
/*
@@ -3825,7 +3825,7 @@ softdep_disk_write_complete(struct buf *bp)
indirdep = WK_INDIRDEP(wk);
if (indirdep->ir_state & GOINGAWAY)
panic("disk_write_complete: indirdep gone");
- bcopy(indirdep->ir_saveddata, bp->b_data, bp->b_bcount);
+ memcpy(bp->b_data, indirdep->ir_saveddata, bp->b_bcount);
free(indirdep->ir_saveddata, M_INDIRDEP);
indirdep->ir_saveddata = NULL;
indirdep->ir_state &= ~UNDONE;
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index e826f925165..ba4e887615d 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_vfsops.c,v 1.139 2013/12/01 16:40:56 krw Exp $ */
+/* $OpenBSD: ffs_vfsops.c,v 1.140 2013/12/12 19:00:10 tedu Exp $ */
/* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */
/*
@@ -148,8 +148,7 @@ ffs_mountroot(void)
TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list);
ump = VFSTOUFS(mp);
fs = ump->um_fs;
- (void)copystr(mp->mnt_stat.f_mntonname, fs->fs_fsmnt, MNAMELEN - 1,
- NULL);
+ strlcpy(fs->fs_fsmnt, mp->mnt_stat.f_mntonname, sizeof(fs->fs_fsmnt));
(void)ffs_statfs(mp, &mp->mnt_stat, p);
vfs_unbusy(mp);
inittodr(fs->fs_time);
@@ -339,7 +338,7 @@ ffs_mount(struct mount *mp, const char *path, void *data,
goto error_1;
if (disk_map(fspec, fname, MNAMELEN, DM_OPENBLCK) == -1)
- bcopy(fspec, fname, sizeof(fname));
+ memcpy(fname, fspec, sizeof(fname));
NDINIT(ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, fname, p);
if ((error = namei(ndp)) != 0)
@@ -394,9 +393,9 @@ ffs_mount(struct mount *mp, const char *path, void *data,
/*
* Save "mounted from" info for mount point (NULL pad)
*/
- bzero(mp->mnt_stat.f_mntfromname, MNAMELEN);
+ memset(mp->mnt_stat.f_mntfromname, 0, MNAMELEN);
strlcpy(mp->mnt_stat.f_mntfromname, fname, MNAMELEN);
- bzero(mp->mnt_stat.f_mntfromspec, MNAMELEN);
+ memset(mp->mnt_stat.f_mntfromspec, 0, MNAMELEN);
strlcpy(mp->mnt_stat.f_mntfromspec, fspec, MNAMELEN);
}
} else {
@@ -406,11 +405,11 @@ ffs_mount(struct mount *mp, const char *path, void *data,
* error occurs, the mountpoint is discarded by the
* upper level code.
*/
- bzero(mp->mnt_stat.f_mntonname, MNAMELEN);
+ memset(mp->mnt_stat.f_mntonname, 0, MNAMELEN);
strlcpy(mp->mnt_stat.f_mntonname, path, MNAMELEN);
- bzero(mp->mnt_stat.f_mntfromname, MNAMELEN);
+ memset(mp->mnt_stat.f_mntfromname, 0, MNAMELEN);
strlcpy(mp->mnt_stat.f_mntfromname, fname, MNAMELEN);
- bzero(mp->mnt_stat.f_mntfromspec, MNAMELEN);
+ memset(mp->mnt_stat.f_mntfromspec, 0, MNAMELEN);
strlcpy(mp->mnt_stat.f_mntfromspec, fspec, MNAMELEN);
error = ffs_mountfs(devvp, mp, p);
@@ -425,7 +424,7 @@ ffs_mount(struct mount *mp, const char *path, void *data,
*
* This code is common to root and non-root mounts
*/
- bcopy(&args, &mp->mnt_stat.mount_info.ufs_args, sizeof(args));
+ memcpy(&mp->mnt_stat.mount_info.ufs_args, &args, sizeof(args));
VFS_STATFS(mp, &mp->mnt_stat, p);
success:
@@ -571,7 +570,7 @@ ffs_reload(struct mount *mountp, struct ucred *cred, struct proc *p)
newfs->fs_csp = fs->fs_csp;
newfs->fs_maxcluster = fs->fs_maxcluster;
newfs->fs_ronly = fs->fs_ronly;
- bcopy(newfs, fs, (u_int)fs->fs_sbsize);
+ memcpy(fs, newfs, fs->fs_sbsize);
if (fs->fs_sbsize < SBSIZE)
bp->b_flags |= B_INVAL;
brelse(bp);
@@ -593,7 +592,7 @@ ffs_reload(struct mount *mountp, struct ucred *cred, struct proc *p)
brelse(bp);
return (error);
}
- bcopy(bp->b_data, space, (u_int)size);
+ memcpy(space, bp->b_data, size);
space += size;
brelse(bp);
}
@@ -666,7 +665,6 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p)
daddr_t sbloc;
int error, i, blks, size, ronly;
int32_t *lp;
- size_t strsize;
struct ucred *cred;
u_int64_t maxfilesize; /* XXX */
@@ -787,7 +785,7 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p)
ump->um_fstype = UM_UFS2;
#endif
- bcopy(bp->b_data, ump->um_fs, (u_int)fs->fs_sbsize);
+ memcpy(ump->um_fs, bp->b_data, fs->fs_sbsize);
if (fs->fs_sbsize < SBSIZE)
bp->b_flags |= B_INVAL;
brelse(bp);
@@ -814,7 +812,7 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p)
free(fs->fs_csp, M_UFSMNT);
goto out;
}
- bcopy(bp->b_data, space, (u_int)size);
+ memcpy(space, bp->b_data, size);
space += size;
brelse(bp);
bp = NULL;
@@ -856,11 +854,8 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p)
/*
* Set FS local "last mounted on" information (NULL pad)
*/
- copystr(mp->mnt_stat.f_mntonname, /* mount point*/
- fs->fs_fsmnt, /* copy area*/
- sizeof(fs->fs_fsmnt) - 1, /* max size*/
- &strsize); /* real size*/
- bzero(fs->fs_fsmnt + strsize, sizeof(fs->fs_fsmnt) - strsize);
+ memset(fs->fs_fsmnt, 0, sizeof(fs->fs_fsmnt));
+ strlcpy(fs->fs_fsmnt, mp->mnt_stat.f_mntonname, sizeof(fs->fs_fsmnt));
#if 0
if( mp->mnt_flag & MNT_ROOTFS) {
@@ -1423,7 +1418,7 @@ ffs_sbupdate(struct ufsmount *mp, int waitfor)
size = (blks - i) * fs->fs_fsize;
bp = getblk(mp->um_devvp, fsbtodb(fs, fs->fs_csaddr + i),
size, 0, 0);
- bcopy(space, bp->b_data, (u_int)size);
+ memcpy(bp->b_data, space, size);
space += size;
if (waitfor != MNT_WAIT)
bawrite(bp);
@@ -1445,7 +1440,7 @@ ffs_sbupdate(struct ufsmount *mp, int waitfor)
(int)fs->fs_sbsize, 0, 0);
fs->fs_fmod = 0;
fs->fs_time = time_second;
- bcopy((caddr_t)fs, bp->b_data, (u_int)fs->fs_sbsize);
+ memcpy(bp->b_data, fs, fs->fs_sbsize);
/* Restore compatibility to old file systems. XXX */
dfs = (struct fs *)bp->b_data; /* XXX */
if (fs->fs_postblformat == FS_42POSTBLFMT) /* XXX */
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c
index 04f1af4b91d..dbf30681337 100644
--- a/sys/ufs/ffs/ffs_vnops.c
+++ b/sys/ufs/ffs/ffs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_vnops.c,v 1.72 2013/09/14 02:28:02 guenther Exp $ */
+/* $OpenBSD: ffs_vnops.c,v 1.73 2013/12/12 19:00:10 tedu Exp $ */
/* $NetBSD: ffs_vnops.c,v 1.7 1996/05/11 18:27:24 mycroft Exp $ */
/*
@@ -268,8 +268,7 @@ ffs_read(void *v)
break;
xfersize = size;
}
- error = uiomove((char *)bp->b_data + blkoffset, (int)xfersize,
- uio);
+ error = uiomove(bp->b_data + blkoffset, (int)xfersize, uio);
if (error)
break;
brelse(bp);
@@ -374,10 +373,10 @@ ffs_write(void *v)
xfersize = size;
error =
- uiomove((char *)bp->b_data + blkoffset, xfersize, uio);
+ uiomove(bp->b_data + blkoffset, xfersize, uio);
if (error != 0)
- bzero((char *)bp->b_data + blkoffset, xfersize);
+ memset(bp->b_data + blkoffset, 0, xfersize);
if (ioflag & IO_SYNC)
(void)bwrite(bp);
diff --git a/sys/ufs/mfs/mfs_vfsops.c b/sys/ufs/mfs/mfs_vfsops.c
index f793a921704..fc9d8dcdf0c 100644
--- a/sys/ufs/mfs/mfs_vfsops.c
+++ b/sys/ufs/mfs/mfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfs_vfsops.c,v 1.46 2013/04/15 15:32:19 jsing Exp $ */
+/* $OpenBSD: mfs_vfsops.c,v 1.47 2013/12/12 19:00:10 tedu Exp $ */
/* $NetBSD: mfs_vfsops.c,v 1.10 1996/02/09 22:31:28 christos Exp $ */
/*
@@ -147,14 +147,14 @@ mfs_mount(struct mount *mp, const char *path, void *data,
ump = VFSTOUFS(mp);
fs = ump->um_fs;
- bzero(fs->fs_fsmnt, sizeof(fs->fs_fsmnt));
+ memset(fs->fs_fsmnt, 0, sizeof(fs->fs_fsmnt));
strlcpy(fs->fs_fsmnt, path, sizeof(fs->fs_fsmnt));
- bcopy(fs->fs_fsmnt, mp->mnt_stat.f_mntonname, MNAMELEN);
- bzero(mp->mnt_stat.f_mntfromname, MNAMELEN);
+ memcpy(mp->mnt_stat.f_mntonname, fs->fs_fsmnt, MNAMELEN);
+ memset(mp->mnt_stat.f_mntfromname, 0, MNAMELEN);
strlcpy(mp->mnt_stat.f_mntfromname, fspec, MNAMELEN);
- bzero(mp->mnt_stat.f_mntfromspec, MNAMELEN);
+ memset(mp->mnt_stat.f_mntfromspec, 0, MNAMELEN);
strlcpy(mp->mnt_stat.f_mntfromspec, fspec, MNAMELEN);
- bcopy(&args, &mp->mnt_stat.mount_info.mfs_args, sizeof(args));
+ memcpy(&mp->mnt_stat.mount_info.mfs_args, &args, sizeof(args));
return (0);
}
@@ -221,8 +221,8 @@ mfs_statfs(struct mount *mp, struct statfs *sbp, struct proc *p)
error = ffs_statfs(mp, sbp, p);
strncpy(&sbp->f_fstypename[0], mp->mnt_vfc->vfc_name, MFSNAMELEN);
if (sbp != &mp->mnt_stat)
- bcopy(&mp->mnt_stat.mount_info.mfs_args,
- &sbp->mount_info.mfs_args, sizeof(struct mfs_args));
+ memcpy(&sbp->mount_info.mfs_args,
+ &mp->mnt_stat.mount_info.mfs_args, sizeof(struct mfs_args));
return (error);
}
diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c
index 69cf5b7f493..b0aefdd1a43 100644
--- a/sys/ufs/ufs/ufs_lookup.c
+++ b/sys/ufs/ufs/ufs_lookup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ufs_lookup.c,v 1.42 2013/05/30 19:19:09 guenther Exp $ */
+/* $OpenBSD: ufs_lookup.c,v 1.43 2013/12/12 19:00:10 tedu Exp $ */
/* $NetBSD: ufs_lookup.c,v 1.7 1996/02/09 22:36:06 christos Exp $ */
/*
@@ -672,7 +672,7 @@ ufs_makedirentry(struct inode *ip, struct componentname *cnp,
#endif
newdirp->d_ino = ip->i_number;
newdirp->d_namlen = cnp->cn_namelen;
- bcopy(cnp->cn_nameptr, newdirp->d_name, (unsigned)cnp->cn_namelen + 1);
+ memcpy(newdirp->d_name, cnp->cn_nameptr, cnp->cn_namelen + 1);
if (ITOV(ip)->v_mount->mnt_maxsymlinklen > 0)
newdirp->d_type = IFTODT(DIP(ip, mode));
else {
@@ -738,7 +738,7 @@ ufs_direnter(struct vnode *dvp, struct vnode *tvp, struct direct *dirp,
dirp->d_reclen = DIRBLKSIZ;
blkoff = dp->i_offset &
(VFSTOUFS(dvp->v_mount)->um_mountp->mnt_stat.f_iosize - 1);
- bcopy((caddr_t)dirp, (caddr_t)bp->b_data + blkoff,newentrysize);
+ memcpy(bp->b_data + blkoff, dirp, newentrysize);
#ifdef UFS_DIRHASH
if (dp->i_dirhash != NULL) {
@@ -836,7 +836,7 @@ ufs_direnter(struct vnode *dvp, struct vnode *tvp, struct direct *dirp,
ep->d_reclen = dsize;
ep = (struct direct *)((char *)ep + dsize);
- /* Read nep->d_reclen now as the bcopy() may clobber it. */
+ /* Read nep->d_reclen now as the memmove() may clobber it. */
loc += nep->d_reclen;
if (nep->d_ino == 0) {
/*
@@ -845,7 +845,7 @@ ufs_direnter(struct vnode *dvp, struct vnode *tvp, struct direct *dirp,
* can create them (and it doesn't fix them).
*
* Add up the free space, and initialise the
- * relocated entry since we don't bcopy it.
+ * relocated entry since we don't memmove it.
*/
spacefree += nep->d_reclen;
ep->d_ino = 0;
@@ -864,7 +864,7 @@ ufs_direnter(struct vnode *dvp, struct vnode *tvp, struct direct *dirp,
softdep_change_directoryentry_offset(dp, dirbuf,
(caddr_t)nep, (caddr_t)ep, dsize);
else
- bcopy((caddr_t)nep, (caddr_t)ep, dsize);
+ memmove(ep, nep, dsize);
}
/*
* Here, `ep' points to a directory entry containing `dsize' in-use
@@ -892,7 +892,7 @@ ufs_direnter(struct vnode *dvp, struct vnode *tvp, struct direct *dirp,
dirp->d_reclen == spacefree))
ufsdirhash_add(dp, dirp, dp->i_offset + ((char *)ep - dirbuf));
#endif
- bcopy((caddr_t)dirp, (caddr_t)ep, (u_int)newentrysize);
+ memcpy(ep, dirp, newentrysize);
#ifdef UFS_DIRHASH
if (dp->i_dirhash != NULL)
ufsdirhash_checkblock(dp, dirbuf -
diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c
index cc01bfd33ef..6f9816803a4 100644
--- a/sys/ufs/ufs/ufs_quota.c
+++ b/sys/ufs/ufs/ufs_quota.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ufs_quota.c,v 1.31 2013/06/11 16:42:19 deraadt Exp $ */
+/* $OpenBSD: ufs_quota.c,v 1.32 2013/12/12 19:00:10 tedu Exp $ */
/* $NetBSD: ufs_quota.c,v 1.8 1996/02/09 22:36:09 christos Exp $ */
/*
@@ -873,7 +873,7 @@ dqget(struct vnode *vp, u_long id, struct ufsmount *ump, int type,
auio.uio_procp = (struct proc *)0;
error = VOP_READ(dqvp, &auio, 0, dq->dq_cred);
if (auio.uio_resid == sizeof(struct dqblk) && error == 0)
- bzero((caddr_t)&dq->dq_dqb, sizeof(struct dqblk));
+ memset(&dq->dq_dqb, 0, sizeof(struct dqblk));
if (vp != dqvp)
VOP_UNLOCK(dqvp, 0, p);
if (dq->dq_flags & DQ_WANT)
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 8de4a89dac3..942cabe1ab0 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ufs_vnops.c,v 1.110 2013/11/23 19:07:51 guenther Exp $ */
+/* $OpenBSD: ufs_vnops.c,v 1.111 2013/12/12 19:00:10 tedu Exp $ */
/* $NetBSD: ufs_vnops.c,v 1.18 1996/05/11 18:28:04 mycroft Exp $ */
/*
@@ -1166,7 +1166,7 @@ ufs_mkdir(void *v)
DIP_ASSIGN(ip, size, DIRBLKSIZ);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
uvm_vnp_setsize(tvp, DIP(ip, size));
- bcopy((caddr_t)&dirtemplate, (caddr_t)bp->b_data, sizeof dirtemplate);
+ memcpy(bp->b_data, &dirtemplate, sizeof(dirtemplate));
if (DOINGSOFTDEP(tvp)) {
/*
* Ensure that the entire newly allocated block is a
@@ -1351,7 +1351,7 @@ ufs_symlink(void *v)
len = strlen(ap->a_target);
if (len < vp->v_mount->mnt_maxsymlinklen) {
ip = VTOI(vp);
- bcopy(ap->a_target, (char *)SHORTLINK(ip), len);
+ memcpy(SHORTLINK(ip), ap->a_target, len);
DIP_ASSIGN(ip, size, len);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
} else
@@ -1451,7 +1451,7 @@ ufs_readdir(void *v)
u.dn.d_namlen = dp->d_namlen;
}
memcpy(u.dn.d_name, dp->d_name, u.dn.d_namlen);
- bzero(u.dn.d_name + u.dn.d_namlen, u.dn.d_reclen
+ memset(u.dn.d_name + u.dn.d_namlen, 0, u.dn.d_reclen
- u.dn.d_namlen - offsetof(struct dirent, d_name));
error = uiomove(&u.dn, u.dn.d_reclen, uio);