From 32181a02fa8d64885f0c7ddb05ec71d497850016 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Thu, 10 Oct 2002 06:29:03 +0000 Subject: [PATCH] Fix libxfs device flush ioctl, sync with kernel source. CONTRIBUTED: Anton Blanchard Bump version - fix libxfs device flush ioctl, sync with kernel source. --- VERSION | 2 +- debian/changelog | 7 ++++ doc/CHANGES | 9 ++++- include/platform_defs.h.in | 11 ++++++ include/xfs_arch.h | 4 +-- include/xfs_dir2_sf.h | 2 +- include/xfs_dir_sf.h | 2 +- include/xfs_fs.h | 12 ++----- include/xfs_inode.h | 23 ++----------- include/xfs_mount.h | 15 ++++----- include/xfs_types.h | 32 ++++++++---------- libxfs/init.c | 18 +++++----- libxfs/rdwr.c | 2 +- libxfs/util.c | 6 ++-- libxfs/xfs.h | 1 - libxfs/xfs_alloc_btree.c | 36 ++++++++++---------- libxfs/xfs_attr_leaf.c | 38 ++++++++++----------- libxfs/xfs_bmap.c | 68 +++----------------------------------- libxfs/xfs_bmap_btree.c | 52 ++++++++++++++--------------- libxfs/xfs_da_btree.c | 40 +++++++++++----------- libxfs/xfs_dir.c | 2 +- libxfs/xfs_dir2.c | 2 +- libxfs/xfs_dir2_block.c | 14 ++++---- libxfs/xfs_dir2_data.c | 2 +- libxfs/xfs_dir2_leaf.c | 24 +++++++------- libxfs/xfs_dir2_node.c | 24 +++++++------- libxfs/xfs_dir2_sf.c | 32 +++++++++--------- libxfs/xfs_dir_leaf.c | 68 +++++++++++++++++++------------------- libxfs/xfs_ialloc.c | 4 +-- libxfs/xfs_ialloc_btree.c | 24 +++++++------- libxfs/xfs_inode.c | 47 +++++++++++++------------- libxfs/xfs_mount.c | 4 +-- libxlog/xfs_log_recover.c | 24 ++++++++++---- 33 files changed, 296 insertions(+), 355 deletions(-) diff --git a/VERSION b/VERSION index eca6306b9..5abc55182 100644 --- a/VERSION +++ b/VERSION @@ -3,5 +3,5 @@ # PKG_MAJOR=2 PKG_MINOR=3 -PKG_REVISION=4 +PKG_REVISION=5 PKG_BUILD=0 diff --git a/debian/changelog b/debian/changelog index 60c57122f..0c7c695b5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +xfsprogs (2.3.5-1) unstable; urgency=low + + * New upstream release + * Fix mkfs bug, patch from Anton Blanchard (closes: #163897) + + -- Nathan Scott Mon, 7 Oct 2002 05:19:51 +1000 + xfsprogs (2.3.4-1) unstable; urgency=low * New upstream release diff --git a/doc/CHANGES b/doc/CHANGES index 428c62d88..dc698635d 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,5 +1,12 @@ +xfsprogs-2.3.5 (10 October 2002) + - Sync up user/kernel source in lib{xfs,xlog} and headers. + - Fix mkfs (libxfs) bug when using BLKFLSBUF ioctl - we passed + in the device number instead of a file descriptor (and EBADF + was the end result, which we ignored). + - Thanks to Anton Blanchard for fixing this. + xfsprogs-2.3.4 (04 October 2002) - - xfs_repair: fix size calculation bug in repair's memory allocation, + - Fix size calculation bug in xfs_repair's memory allocation, reduces memory usage by a factor of 4. xfsprogs-2.3.3 (16 September 2002) diff --git a/include/platform_defs.h.in b/include/platform_defs.h.in index c6724f1eb..44c96644b 100644 --- a/include/platform_defs.h.in +++ b/include/platform_defs.h.in @@ -132,4 +132,15 @@ typedef unsigned long long __psunsigned_t; # define ASSERT(EX) ((void) 0) #endif +#define IRIX_DEV_BITSMAJOR 14 +#define IRIX_DEV_BITSMINOR 18 +#define IRIX_DEV_MAXMAJ 0x1ff +#define IRIX_DEV_MAXMIN 0x3ffff +#define IRIX_DEV_MAJOR(dev) ((int)(((unsigned)(dev) >> IRIX_DEV_BITSMINOR) \ + & IRIX_DEV_MAXMAJ)) +#define IRIX_DEV_MINOR(dev) ((int)((dev) & IRIX_DEV_MAXMIN)) +#define IRIX_MKDEV(major,minor) ((dev_t)(((major) << IRIX_DEV_BITSMINOR) \ + | (minor&IRIX_DEV_MAXMIN))) +#define IRIX_DEV_TO_KDEVT(dev) makedev(IRIX_DEV_MAJOR(dev),IRIX_DEV_MINOR(dev)) + #endif /* __XFS_PLATFORM_DEFS_H__ */ diff --git a/include/xfs_arch.h b/include/xfs_arch.h index 57a28544b..4629bc745 100644 --- a/include/xfs_arch.h +++ b/include/xfs_arch.h @@ -260,13 +260,13 @@ #define DIRINO_COPY_ARCH(from,to,arch) \ if ((arch) == ARCH_NOCONVERT) { \ - bcopy(from,to,sizeof(xfs_ino_t)); \ + memcpy(to,from,sizeof(xfs_ino_t)); \ } else { \ INT_SWAP_UNALIGNED_64(from,to); \ } #define DIRINO4_COPY_ARCH(from,to,arch) \ if ((arch) == ARCH_NOCONVERT) { \ - bcopy((((__u8*)from+4)),to,sizeof(xfs_dir2_ino4_t)); \ + memcpy(to,(((__u8*)from+4)),sizeof(xfs_dir2_ino4_t)); \ } else { \ INT_SWAP_UNALIGNED_32(from,to); \ } diff --git a/include/xfs_dir2_sf.h b/include/xfs_dir2_sf.h index 576c19f17..7ee59c610 100644 --- a/include/xfs_dir2_sf.h +++ b/include/xfs_dir2_sf.h @@ -93,7 +93,7 @@ typedef struct { __uint8_t i[2]; } xfs_dir2_sf_off_t; * be calculated on the fly. * * Entries are packed toward the top as tightly as possible. The header - * and the elements must be bcopy()'d out into a work area to get correct + * and the elements must be memcpy'd out into a work area to get correct * alignment for the inode number fields. */ typedef struct xfs_dir2_sf_hdr { diff --git a/include/xfs_dir_sf.h b/include/xfs_dir_sf.h index ede171472..10c60645f 100644 --- a/include/xfs_dir_sf.h +++ b/include/xfs_dir_sf.h @@ -46,7 +46,7 @@ typedef struct { __uint8_t i[sizeof(xfs_ino_t)]; } xfs_dir_ino_t; * be calculated on the fly. * * Entries are packed toward the top as tight as possible. The header - * and the elements much be bcopy()'d out into a work area to get correct + * and the elements much be memcpy'd out into a work area to get correct * alignment for the inode number fields. */ typedef struct xfs_dir_shortform { diff --git a/include/xfs_fs.h b/include/xfs_fs.h index 7984d9261..0311d1258 100644 --- a/include/xfs_fs.h +++ b/include/xfs_fs.h @@ -427,9 +427,9 @@ typedef struct xfs_handle { - (char *) &(handle)) \ + (handle).ha_fid.xfs_fid_len) -#define XFS_HANDLE_CMP(h1, h2) bcmp(h1, h2, sizeof (xfs_handle_t)) +#define XFS_HANDLE_CMP(h1, h2) memcmp(h1, h2, sizeof(xfs_handle_t)) -#define FSHSIZE sizeof (fsid_t) +#define FSHSIZE sizeof(fsid_t) /* @@ -498,13 +498,5 @@ typedef struct xfs_handle { #define BTOBB(bytes) (((__u64)(bytes) + BBSIZE - 1) >> BBSHIFT) #define BTOBBT(bytes) ((__u64)(bytes) >> BBSHIFT) #define BBTOB(bbs) ((bbs) << BBSHIFT) -#define OFFTOBB(bytes) (((__u64)(bytes) + BBSIZE - 1) >> BBSHIFT) -#define OFFTOBBT(bytes) ((__u64)(bytes) >> BBSHIFT) -#define BBTOOFF(bbs) ((__u64)(bbs) << BBSHIFT) - -#define SEEKLIMIT32 0x7fffffff -#define BBSEEKLIMIT32 BTOBBT(SEEKLIMIT32) -#define SEEKLIMIT 0x7fffffffffffffffLL -#define BBSEEKLIMIT OFFTOBBT(SEEKLIMIT) #endif /* _LINUX_XFS_FS_H */ diff --git a/include/xfs_inode.h b/include/xfs_inode.h index a5320cf2c..ea739492d 100644 --- a/include/xfs_inode.h +++ b/include/xfs_inode.h @@ -98,7 +98,6 @@ struct xfs_inode_log_item; struct xfs_mount; struct xfs_trans; struct xfs_dquot; -struct pm; /* @@ -119,23 +118,6 @@ typedef struct xfs_gap { xfs_extlen_t xg_count_fsb; } xfs_gap_t; -/* - * This structure is used to hold common pieces of the buffer - * and file for xfs_dio_write and xfs_dio_read. - */ -typedef struct xfs_dio { - struct xfs_buf *xd_bp; - bhv_desc_t *xd_bdp; - struct xfs_inode *xd_ip; - struct xfs_iocore *xd_io; - struct cred *xd_cr; - struct pm *xd_pmp; - int xd_blkalgn; - int xd_ioflag; - xfs_off_t xd_start; - size_t xd_length; -} xfs_dio_t; - typedef struct dm_attrs_s { __uint32_t da_dmevmask; /* DMIG event mask */ __uint16_t da_dmstate; /* DMIG state info */ @@ -490,7 +472,6 @@ xfs_inode_t *xfs_inode_incore(struct xfs_mount *, xfs_ino_t, void xfs_inode_lock_init(xfs_inode_t *, struct vnode *); int xfs_iget(struct xfs_mount *, struct xfs_trans *, xfs_ino_t, uint, xfs_inode_t **, xfs_daddr_t); -int xfs_vn_iget(vfs_t *, struct vnode *, xfs_ino_t); void xfs_iput(xfs_inode_t *, uint); void xfs_iput_new(xfs_inode_t *, uint); void xfs_ilock(xfs_inode_t *, uint); @@ -517,7 +498,7 @@ int xfs_iread(struct xfs_mount *, struct xfs_trans *, xfs_ino_t, xfs_inode_t **, xfs_daddr_t); int xfs_iread_extents(struct xfs_trans *, xfs_inode_t *, int); int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t, nlink_t, - dev_t, struct cred *, xfs_prid_t, int, + xfs_dev_t, struct cred *, xfs_prid_t, int, struct xfs_buf **, boolean_t *, xfs_inode_t **); void xfs_xlate_dinode_core(xfs_caddr_t, struct xfs_dinode_core *, int, xfs_arch_t); @@ -551,7 +532,7 @@ void xfs_lock_inodes(xfs_inode_t **, int, int, uint); #define xfs_ipincount(ip) ((unsigned int) atomic_read(&ip->i_pincount)) - +void xfs_revalidate_inode(struct xfs_mount *, vnode_t *vp, xfs_inode_t *); #ifdef DEBUG void xfs_isize_check(struct xfs_mount *, xfs_inode_t *, xfs_fsize_t); diff --git a/include/xfs_mount.h b/include/xfs_mount.h index 51c86fea2..7011e001b 100644 --- a/include/xfs_mount.h +++ b/include/xfs_mount.h @@ -77,7 +77,6 @@ struct xfs_inode; struct xfs_perag; struct xfs_quotainfo; struct xfs_iocore; -struct xfs_dio; struct xfs_bmbt_irec; struct xfs_bmap_free; @@ -96,24 +95,18 @@ struct xfs_bmap_free; * minimize the number of memory indirections involved. */ -typedef int (*xfs_dio_write_t)(struct xfs_dio *); -typedef int (*xfs_dio_read_t)(struct xfs_dio *); -typedef int (*xfs_strat_write_t)(struct xfs_iocore *, struct xfs_buf *); typedef int (*xfs_bmapi_t)(struct xfs_trans *, void *, xfs_fileoff_t, xfs_filblks_t, int, xfs_fsblock_t *, xfs_extlen_t, struct xfs_bmbt_irec *, int *, struct xfs_bmap_free *); typedef int (*xfs_bmap_eof_t)(void *, xfs_fileoff_t, int, int *); -typedef int (*xfs_rsync_t)(void *, int, xfs_off_t, xfs_off_t); -typedef uint (*xfs_lck_map_shared_t)(void *); typedef void (*xfs_lock_t)(void *, uint); typedef void (*xfs_lock_demote_t)(void *, uint); typedef int (*xfs_lock_nowait_t)(void *, uint); typedef void (*xfs_unlk_t)(void *, unsigned int); typedef void (*xfs_chgtime_t)(void *, int); typedef xfs_fsize_t (*xfs_size_t)(void *); -typedef xfs_fsize_t (*xfs_setsize_t)(void *, xfs_off_t); typedef xfs_fsize_t (*xfs_lastbyte_t)(void *); typedef struct xfs_ioops { @@ -295,8 +288,7 @@ typedef struct xfs_mount { #define XFS_MOUNT_NOUUID 0x00004000 /* ignore uuid during mount */ #define XFS_MOUNT_32BITINODES 0x00008000 /* do not create inodes above * 32 bits in size */ -#define XFS_MOUNT_IRIXSGID 0x00010000 /* Irix-style sgid inheritance */ -#define XFS_MOUNT_NOLOGFLUSH 0x00020000 +#define XFS_MOUNT_NOLOGFLUSH 0x00010000 /* * Flags for m_cxfstype @@ -436,6 +428,11 @@ int xfs_syncsub(xfs_mount_t *, int, int, int *); void xfs_initialize_perag(xfs_mount_t *, int); void xfs_xlatesb(void *, struct xfs_sb *, int, xfs_arch_t, __int64_t); +int xfs_blkdev_get(const char *, struct block_device **); +void xfs_blkdev_put(struct block_device *); +struct xfs_buftarg *xfs_alloc_buftarg(struct block_device *); +void xfs_free_buftarg(struct xfs_buftarg *); + /* * Flags for freeze operations. */ diff --git a/include/xfs_types.h b/include/xfs_types.h index aa6fe38dd..e08f8b727 100644 --- a/include/xfs_types.h +++ b/include/xfs_types.h @@ -308,23 +308,19 @@ extern struct xfsstats xfsstats; #endif /* !CONFIG_PROC_FS */ - -/* juggle IRIX device numbers - still used in ondisk structures */ - -#ifndef __KERNEL__ -#define MKDEV(major, minor) makedev(major, minor) -#endif - -#define IRIX_DEV_BITSMAJOR 14 -#define IRIX_DEV_BITSMINOR 18 -#define IRIX_DEV_MAXMAJ 0x1ff -#define IRIX_DEV_MAXMIN 0x3ffff -#define IRIX_DEV_MAJOR(dev) ((int)(((unsigned)(dev)>>IRIX_DEV_BITSMINOR) \ - & IRIX_DEV_MAXMAJ)) -#define IRIX_DEV_MINOR(dev) ((int)((dev)&IRIX_DEV_MAXMIN)) -#define IRIX_MKDEV(major,minor) ((xfs_dev_t)(((major)<>XFS_DEV_BITSMINOR) \ + & XFS_DEV_MAXMAJ)) +#define XFS_DEV_MINOR(dev) ((int)((dev)&XFS_DEV_MAXMIN)) +#define XFS_MKDEV(major,minor) ((xfs_dev_t)(((major)<i_d.di_uid = cr->cr_uid; ip->i_d.di_gid = cr->cr_gid; ip->i_d.di_projid = prid; - bzero(&(ip->i_d.di_pad[0]), sizeof(ip->i_d.di_pad)); + memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); /* * If the superblock version is up to where we support new format @@ -366,8 +366,8 @@ libxfs_iflush_int(xfs_inode_t *ip, xfs_buf_t *bp) XFS_DINODE_VERSION_2); ip->i_d.di_onlink = 0; INT_ZERO(dip->di_core.di_onlink, ARCH_CONVERT); - bzero(&(ip->i_d.di_pad[0]), sizeof(ip->i_d.di_pad)); - bzero(&(dip->di_core.di_pad[0]), + memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); + memset(&(dip->di_core.di_pad[0]), 0, sizeof(dip->di_core.di_pad)); ASSERT(ip->i_d.di_projid == 0); } diff --git a/libxfs/xfs.h b/libxfs/xfs.h index 39c821152..c747993de 100644 --- a/libxfs/xfs.h +++ b/libxfs/xfs.h @@ -262,7 +262,6 @@ typedef struct { dev_t dev; } xfs_buftarg_t; #define mraccess(a) ((void) 0) #define ismrlocked(a,b) 1 #define spinlock_init(a,b) ((void) 0) -#define ovbcopy(from,to,count) memmove(to,from,count) #define __return_address __builtin_return_address(0) #define xfs_btree_reada_bufl(m,fsb,c) ((void) 0) #define xfs_btree_reada_bufs(m,fsb,c,x) ((void) 0) diff --git a/libxfs/xfs_alloc_btree.c b/libxfs/xfs_alloc_btree.c index bc9cc791b..88dcdb5f4 100644 --- a/libxfs/xfs_alloc_btree.c +++ b/libxfs/xfs_alloc_btree.c @@ -113,9 +113,9 @@ xfs_alloc_delrec( } #endif if (ptr < INT_GET(block->bb_numrecs, ARCH_CONVERT)) { - ovbcopy(&lkp[ptr], &lkp[ptr - 1], + memmove(&lkp[ptr - 1], &lkp[ptr], (INT_GET(block->bb_numrecs, ARCH_CONVERT) - ptr) * sizeof(*lkp)); /* INT_: mem copy */ - ovbcopy(&lpp[ptr], &lpp[ptr - 1], + memmove(&lpp[ptr - 1], &lpp[ptr], (INT_GET(block->bb_numrecs, ARCH_CONVERT) - ptr) * sizeof(*lpp)); /* INT_: mem copy */ xfs_alloc_log_ptrs(cur, bp, ptr, INT_GET(block->bb_numrecs, ARCH_CONVERT) - 1); xfs_alloc_log_keys(cur, bp, ptr, INT_GET(block->bb_numrecs, ARCH_CONVERT) - 1); @@ -128,7 +128,7 @@ xfs_alloc_delrec( else { lrp = XFS_ALLOC_REC_ADDR(block, 1, cur); if (ptr < INT_GET(block->bb_numrecs, ARCH_CONVERT)) { - ovbcopy(&lrp[ptr], &lrp[ptr - 1], + memmove(&lrp[ptr - 1], &lrp[ptr], (INT_GET(block->bb_numrecs, ARCH_CONVERT) - ptr) * sizeof(*lrp)); xfs_alloc_log_recs(cur, bp, ptr, INT_GET(block->bb_numrecs, ARCH_CONVERT) - 1); } @@ -445,8 +445,8 @@ xfs_alloc_delrec( return error; } #endif - bcopy(rkp, lkp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*lkp)); /* INT_: structure copy */ - bcopy(rpp, lpp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*lpp)); /* INT_: structure copy */ + memcpy(lkp, rkp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*lkp)); /* INT_: structure copy */ + memcpy(lpp, rpp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*lpp)); /* INT_: structure copy */ xfs_alloc_log_keys(cur, lbp, INT_GET(left->bb_numrecs, ARCH_CONVERT) + 1, INT_GET(left->bb_numrecs, ARCH_CONVERT) + INT_GET(right->bb_numrecs, ARCH_CONVERT)); xfs_alloc_log_ptrs(cur, lbp, INT_GET(left->bb_numrecs, ARCH_CONVERT) + 1, @@ -457,7 +457,7 @@ xfs_alloc_delrec( */ lrp = XFS_ALLOC_REC_ADDR(left, INT_GET(left->bb_numrecs, ARCH_CONVERT) + 1, cur); rrp = XFS_ALLOC_REC_ADDR(right, 1, cur); - bcopy(rrp, lrp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*lrp)); + memcpy(lrp, rrp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*lrp)); xfs_alloc_log_recs(cur, lbp, INT_GET(left->bb_numrecs, ARCH_CONVERT) + 1, INT_GET(left->bb_numrecs, ARCH_CONVERT) + INT_GET(right->bb_numrecs, ARCH_CONVERT)); } @@ -678,9 +678,9 @@ xfs_alloc_insrec( return error; } #endif - ovbcopy(&kp[ptr - 1], &kp[ptr], + memmove(&kp[ptr], &kp[ptr - 1], (INT_GET(block->bb_numrecs, ARCH_CONVERT) - ptr + 1) * sizeof(*kp)); /* INT_: copy */ - ovbcopy(&pp[ptr - 1], &pp[ptr], + memmove(&pp[ptr], &pp[ptr - 1], (INT_GET(block->bb_numrecs, ARCH_CONVERT) - ptr + 1) * sizeof(*pp)); /* INT_: copy */ #ifdef DEBUG if ((error = xfs_btree_check_sptr(cur, *bnop, level))) @@ -704,7 +704,7 @@ xfs_alloc_insrec( * It's a leaf entry. Make a hole for the new record. */ rp = XFS_ALLOC_REC_ADDR(block, 1, cur); - ovbcopy(&rp[ptr - 1], &rp[ptr], + memmove(&rp[ptr], &rp[ptr - 1], (INT_GET(block->bb_numrecs, ARCH_CONVERT) - ptr + 1) * sizeof(*rp)); /* * Now stuff the new record in, bump numrecs @@ -1198,12 +1198,12 @@ xfs_alloc_lshift( return error; } #endif - ovbcopy(rkp + 1, rkp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rkp)); - ovbcopy(rpp + 1, rpp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rpp)); + memmove(rkp, rkp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rkp)); + memmove(rpp, rpp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rpp)); xfs_alloc_log_keys(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT)); xfs_alloc_log_ptrs(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT)); } else { - ovbcopy(rrp + 1, rrp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rrp)); + memmove(rrp, rrp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rrp)); xfs_alloc_log_recs(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT)); key.ar_startblock = rrp->ar_startblock; /* INT_: direct copy */ key.ar_blockcount = rrp->ar_blockcount; /* INT_: direct copy */ @@ -1456,8 +1456,8 @@ xfs_alloc_rshift( return error; } #endif - ovbcopy(rkp, rkp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rkp)); - ovbcopy(rpp, rpp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rpp)); + memmove(rkp + 1, rkp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rkp)); + memmove(rpp + 1, rpp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rpp)); #ifdef DEBUG if ((error = xfs_btree_check_sptr(cur, INT_GET(*lpp, ARCH_CONVERT), level))) return error; @@ -1473,7 +1473,7 @@ xfs_alloc_rshift( lrp = XFS_ALLOC_REC_ADDR(left, INT_GET(left->bb_numrecs, ARCH_CONVERT), cur); rrp = XFS_ALLOC_REC_ADDR(right, 1, cur); - ovbcopy(rrp, rrp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rrp)); + memmove(rrp + 1, rrp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rrp)); *rrp = *lrp; xfs_alloc_log_recs(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) + 1); key.ar_startblock = rrp->ar_startblock; /* INT_: direct copy */ @@ -1589,8 +1589,8 @@ xfs_alloc_split( return error; } #endif - bcopy(lkp, rkp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rkp)); /* INT_: copy */ - bcopy(lpp, rpp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rpp));/* INT_: copy */ + memcpy(rkp, lkp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rkp)); /* INT_: copy */ + memcpy(rpp, lpp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rpp)); /* INT_: copy */ xfs_alloc_log_keys(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT)); xfs_alloc_log_ptrs(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT)); *keyp = *rkp; @@ -1604,7 +1604,7 @@ xfs_alloc_split( lrp = XFS_ALLOC_REC_ADDR(left, i, cur); rrp = XFS_ALLOC_REC_ADDR(right, 1, cur); - bcopy(lrp, rrp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rrp)); + memcpy(rrp, lrp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rrp)); xfs_alloc_log_recs(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT)); keyp->ar_startblock = rrp->ar_startblock; /* INT_: direct copy */ keyp->ar_blockcount = rrp->ar_blockcount; /* INT_: direct copy */ diff --git a/libxfs/xfs_attr_leaf.c b/libxfs/xfs_attr_leaf.c index 35f665377..a566e62a6 100644 --- a/libxfs/xfs_attr_leaf.c +++ b/libxfs/xfs_attr_leaf.c @@ -63,7 +63,7 @@ xfs_attr_leaf_create(xfs_da_args_t *args, xfs_dablk_t blkno, xfs_dabuf_t **bpp) return(error); ASSERT(bp != NULL); leaf = bp->data; - bzero((char *)leaf, XFS_LBSIZE(dp->i_mount)); + memset((char *)leaf, 0, XFS_LBSIZE(dp->i_mount)); hdr = &leaf->hdr; INT_SET(hdr->info.magic, ARCH_CONVERT, XFS_ATTR_LEAF_MAGIC); INT_SET(hdr->firstused, ARCH_CONVERT, XFS_LBSIZE(dp->i_mount)); @@ -238,7 +238,7 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex) if (args->index < INT_GET(hdr->count, ARCH_CONVERT)) { tmp = INT_GET(hdr->count, ARCH_CONVERT) - args->index; tmp *= sizeof(xfs_attr_leaf_entry_t); - ovbcopy((char *)entry, (char *)(entry+1), tmp); + memmove((char *)(entry+1), (char *)entry, tmp); xfs_da_log_buf(args->trans, bp, XFS_DA_LOGRANGE(leaf, entry, tmp + sizeof(*entry))); } @@ -293,13 +293,13 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex) name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, args->index); name_loc->namelen = args->namelen; INT_SET(name_loc->valuelen, ARCH_CONVERT, args->valuelen); - bcopy(args->name, (char *)name_loc->nameval, args->namelen); - bcopy(args->value, (char *)&name_loc->nameval[args->namelen], + memcpy((char *)name_loc->nameval, args->name, args->namelen); + memcpy((char *)&name_loc->nameval[args->namelen], args->value, INT_GET(name_loc->valuelen, ARCH_CONVERT)); } else { name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, args->index); name_rmt->namelen = args->namelen; - bcopy(args->name, (char *)name_rmt->name, args->namelen); + memcpy((char *)name_rmt->name, args->name, args->namelen); entry->flags |= XFS_ATTR_INCOMPLETE; /* just in case */ INT_ZERO(name_rmt->valuelen, ARCH_CONVERT); @@ -355,8 +355,8 @@ xfs_attr_leaf_compact(xfs_trans_t *trans, xfs_dabuf_t *bp) mp = trans->t_mountp; tmpbuffer = kmem_alloc(XFS_LBSIZE(mp), KM_SLEEP); ASSERT(tmpbuffer != NULL); - bcopy(bp->data, tmpbuffer, XFS_LBSIZE(mp)); - bzero(bp->data, XFS_LBSIZE(mp)); + memcpy(tmpbuffer, bp->data, XFS_LBSIZE(mp)); + memset(bp->data, 0, XFS_LBSIZE(mp)); /* * Copy basic information @@ -728,7 +728,7 @@ xfs_attr_leaf_toosmall(xfs_da_state_t *state, int *action) * path point to the block we want to drop (this one). */ forward = (!INT_ISZERO(info->forw, ARCH_CONVERT)); - bcopy(&state->path, &state->altpath, sizeof(state->path)); + memcpy(&state->altpath, &state->path, sizeof(state->path)); error = xfs_da_path_shift(state, &state->altpath, forward, 0, &retval); if (error) @@ -788,7 +788,7 @@ xfs_attr_leaf_toosmall(xfs_da_state_t *state, int *action) * Make altpath point to the block we want to keep (the lower * numbered block) and path point to the block we want to drop. */ - bcopy(&state->path, &state->altpath, sizeof(state->path)); + memcpy(&state->altpath, &state->path, sizeof(state->path)); if (blkno < blk->blkno) { error = xfs_da_path_shift(state, &state->altpath, forward, 0, &retval); @@ -867,7 +867,7 @@ xfs_attr_leaf_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk, */ tmpbuffer = kmem_alloc(state->blocksize, KM_SLEEP); ASSERT(tmpbuffer != NULL); - bzero(tmpbuffer, state->blocksize); + memset(tmpbuffer, 0, state->blocksize); tmp_leaf = (xfs_attr_leafblock_t *)tmpbuffer; tmp_hdr = &tmp_leaf->hdr; tmp_hdr->info = save_hdr->info; /* struct copy */ @@ -895,7 +895,7 @@ xfs_attr_leaf_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk, (int)INT_GET(drop_hdr->count, ARCH_CONVERT), mp); } - bcopy((char *)tmp_leaf, (char *)save_leaf, state->blocksize); + memcpy((char *)save_leaf, (char *)tmp_leaf, state->blocksize); kmem_free(tmpbuffer, state->blocksize); } @@ -968,7 +968,7 @@ xfs_attr_leaf_moveents(xfs_attr_leafblock_t *leaf_s, int start_s, tmp *= sizeof(xfs_attr_leaf_entry_t); entry_s = &leaf_d->entries[start_d]; entry_d = &leaf_d->entries[start_d + count]; - ovbcopy((char *)entry_s, (char *)entry_d, tmp); + memmove((char *)entry_d, (char *)entry_s, tmp); } /* @@ -989,7 +989,7 @@ xfs_attr_leaf_moveents(xfs_attr_leafblock_t *leaf_s, int start_s, * off for 6.2, should be revisited later. */ if (entry_s->flags & XFS_ATTR_INCOMPLETE) { /* skip partials? */ - bzero(XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), tmp); + memset(XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), 0, tmp); INT_MOD(hdr_s->usedbytes, ARCH_CONVERT, -tmp); INT_MOD(hdr_s->count, ARCH_CONVERT, -1); entry_d--; /* to compensate for ++ in loop hdr */ @@ -1006,11 +1006,11 @@ xfs_attr_leaf_moveents(xfs_attr_leafblock_t *leaf_s, int start_s, entry_d->flags = entry_s->flags; ASSERT(INT_GET(entry_d->nameidx, ARCH_CONVERT) + tmp <= XFS_LBSIZE(mp)); - ovbcopy(XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), - XFS_ATTR_LEAF_NAME(leaf_d, desti), tmp); + memmove(XFS_ATTR_LEAF_NAME(leaf_d, desti), + XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), tmp); ASSERT(INT_GET(entry_s->nameidx, ARCH_CONVERT) + tmp <= XFS_LBSIZE(mp)); - bzero(XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), tmp); + memset(XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), 0, tmp); INT_MOD(hdr_s->usedbytes, ARCH_CONVERT, -tmp); INT_MOD(hdr_d->usedbytes, ARCH_CONVERT, tmp); INT_MOD(hdr_s->count, ARCH_CONVERT, -1); @@ -1032,7 +1032,7 @@ xfs_attr_leaf_moveents(xfs_attr_leafblock_t *leaf_s, int start_s, entry_s = &leaf_s->entries[start_s]; ASSERT(((char *)entry_s + tmp) <= ((char *)leaf_s + XFS_LBSIZE(mp))); - bzero((char *)entry_s, tmp); + memset((char *)entry_s, 0, tmp); } else { /* * Move the remaining entries down to fill the hole, @@ -1042,14 +1042,14 @@ xfs_attr_leaf_moveents(xfs_attr_leafblock_t *leaf_s, int start_s, tmp *= sizeof(xfs_attr_leaf_entry_t); entry_s = &leaf_s->entries[start_s + count]; entry_d = &leaf_s->entries[start_s]; - ovbcopy((char *)entry_s, (char *)entry_d, tmp); + memmove((char *)entry_d, (char *)entry_s, tmp); tmp = count * sizeof(xfs_attr_leaf_entry_t); entry_s = &leaf_s->entries[INT_GET(hdr_s->count, ARCH_CONVERT)]; ASSERT(((char *)entry_s + tmp) <= ((char *)leaf_s + XFS_LBSIZE(mp))); - bzero((char *)entry_s, tmp); + memset((char *)entry_s, 0, tmp); } /* diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index c96a1b382..e7384d258 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -2677,7 +2677,7 @@ xfs_bmap_delete_exlist( ASSERT(ifp->if_flags & XFS_IFEXTENTS); base = ifp->if_u1.if_extents; nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t) - count; - ovbcopy(&base[idx + count], &base[idx], + memmove(&base[idx], &base[idx + count], (nextents - idx) * sizeof(*base)); xfs_iext_realloc(ip, -count, whichfork); } @@ -2841,7 +2841,7 @@ xfs_bmap_insert_exlist( xfs_iext_realloc(ip, count, whichfork); base = ifp->if_u1.if_extents; nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t); - ovbcopy(&base[idx], &base[idx + count], + memmove(&base[idx + count], &base[idx], (nextents - (idx + count)) * sizeof(*base)); for (to = idx; to < idx + count; to++, new++) xfs_bmbt_set_all(&base[to], new); @@ -2911,7 +2911,7 @@ xfs_bmap_local_to_extents( ASSERT(args.len == 1); *firstblock = args.fsbno; bp = xfs_btree_get_bufl(args.mp, tp, args.fsbno, 0); - bcopy(ifp->if_u1.if_data, (char *)XFS_BUF_PTR(bp), + memcpy((char *)XFS_BUF_PTR(bp), ifp->if_u1.if_data, ifp->if_bytes); xfs_trans_log_buf(tp, bp, 0, ifp->if_bytes - 1); xfs_idata_realloc(ip, -ifp->if_bytes, whichfork); @@ -3424,28 +3424,9 @@ xfs_bmap_read_extents( break; pp = XFS_BTREE_PTR_ADDR(mp->m_sb.sb_blocksize, xfs_bmbt, block, 1, mp->m_bmap_dmxr[1]); -#ifndef __KERNEL__ XFS_WANT_CORRUPTED_GOTO( XFS_FSB_SANITY_CHECK(mp, INT_GET(*pp, ARCH_CONVERT)), error0); -#else /* additional, temporary, debugging code */ - if (!(XFS_FSB_SANITY_CHECK(mp, INT_GET(*pp, ARCH_CONVERT)))) { - cmn_err(CE_NOTE, - "xfs_bmap_read_extents: FSB Sanity Check:"); - if (!(XFS_FSB_TO_AGNO(mp, INT_GET(*pp, ARCH_CONVERT)) < mp->m_sb.sb_agcount)) - cmn_err(CE_NOTE, - "bad AG count %d < agcount %d", - XFS_FSB_TO_AGNO(mp, INT_GET(*pp, ARCH_CONVERT)), - mp->m_sb.sb_agcount); - if (!(XFS_FSB_TO_AGBNO(mp, INT_GET(*pp, ARCH_CONVERT)) < mp->m_sb.sb_agblocks)) - cmn_err(CE_NOTE, - "bad AG BNO %d < %d", - XFS_FSB_TO_AGBNO(mp, INT_GET(*pp, ARCH_CONVERT)), - mp->m_sb.sb_agblocks); - error = XFS_ERROR(EFSCORRUPTED); - goto error0; - } -#endif bno = INT_GET(*pp, ARCH_CONVERT); xfs_trans_brelse(tp, bp); } @@ -3473,35 +3454,9 @@ xfs_bmap_read_extents( (unsigned long long) ip->i_ino); goto error0; } -#ifndef __KERNEL__ XFS_WANT_CORRUPTED_GOTO( XFS_BMAP_SANITY_CHECK(mp, block, 0), error0); -#else /* additional, temporary, debugging code */ - if (!(XFS_BMAP_SANITY_CHECK(mp, block, 0))) { - cmn_err(CE_NOTE, - "xfs_bmap_read_extents: BMAP Sanity Check:"); - if (!(INT_GET(block->bb_magic, ARCH_CONVERT) == XFS_BMAP_MAGIC)) - cmn_err(CE_NOTE, - "bb_magic 0x%x", - INT_GET(block->bb_magic, ARCH_CONVERT)); - if (!(INT_GET(block->bb_level, ARCH_CONVERT) == level)) - cmn_err(CE_NOTE, - "bb_level %d", - INT_GET(block->bb_level, ARCH_CONVERT)); - if (!(INT_GET(block->bb_numrecs, ARCH_CONVERT) > 0)) - cmn_err(CE_NOTE, - "bb_numrecs %d", - INT_GET(block->bb_numrecs, ARCH_CONVERT)); - if (!(INT_GET(block->bb_numrecs, ARCH_CONVERT) <= (mp)->m_bmap_dmxr[(level) != 0])) - cmn_err(CE_NOTE, - "bb_numrecs %d < m_bmap_dmxr[] %d", - INT_GET(block->bb_numrecs, ARCH_CONVERT), - (mp)->m_bmap_dmxr[(level) != 0]); - error = XFS_ERROR(EFSCORRUPTED); - goto error0; - } -#endif /* * Read-ahead the next leaf block, if any. */ @@ -3513,7 +3468,7 @@ xfs_bmap_read_extents( */ frp = XFS_BTREE_REC_ADDR(mp->m_sb.sb_blocksize, xfs_bmbt, block, 1, mp->m_bmap_dmxr[0]); - bcopy(frp, trp, num_recs * sizeof(*frp)); + memcpy(trp, frp, num_recs * sizeof(*frp)); if (exntf == XFS_EXTFMT_NOSTATE) { /* * Check all attribute bmap btree records and @@ -3628,11 +3583,6 @@ xfs_bmapi( if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS && XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE && XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_LOCAL) { -#ifdef __KERNEL__ /* additional, temporary, debugging code */ - cmn_err(CE_NOTE, - "EFSCORRUPTED returned from file %s line %d", - __FILE__, __LINE__); -#endif return XFS_ERROR(EFSCORRUPTED); } mp = ip->i_mount; @@ -4128,11 +4078,6 @@ xfs_bmapi_single( ifp = XFS_IFORK_PTR(ip, whichfork); if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE && XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS) { -#ifdef __KERNEL__ /* additional, temporary, debugging code */ - cmn_err(CE_NOTE, - "EFSCORRUPTED returned from file %s line %d", - __FILE__, __LINE__); -#endif return XFS_ERROR(EFSCORRUPTED); } if (XFS_FORCED_SHUTDOWN(ip->i_mount)) @@ -4206,11 +4151,6 @@ xfs_bunmapi( ifp = XFS_IFORK_PTR(ip, whichfork); if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS && XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE) { -#ifdef __KERNEL__ /* additional, temporary, debugging code */ - cmn_err(CE_NOTE, - "EFSCORRUPTED returned from file %s line %d", - __FILE__, __LINE__); -#endif return XFS_ERROR(EFSCORRUPTED); } mp = ip->i_mount; diff --git a/libxfs/xfs_bmap_btree.c b/libxfs/xfs_bmap_btree.c index 26482b8da..fd9b46270 100644 --- a/libxfs/xfs_bmap_btree.c +++ b/libxfs/xfs_bmap_btree.c @@ -112,9 +112,9 @@ xfs_bmbt_delrec( } #endif if (ptr < numrecs) { - ovbcopy(&kp[ptr], &kp[ptr - 1], + memmove(&kp[ptr - 1], &kp[ptr], (numrecs - ptr) * sizeof(*kp)); - ovbcopy(&pp[ptr], &pp[ptr - 1], /* INT_: direct copy */ + memmove(&pp[ptr - 1], &pp[ptr], /* INT_: direct copy */ (numrecs - ptr) * sizeof(*pp)); xfs_bmbt_log_ptrs(cur, bp, ptr, numrecs - 1); xfs_bmbt_log_keys(cur, bp, ptr, numrecs - 1); @@ -122,7 +122,7 @@ xfs_bmbt_delrec( } else { rp = XFS_BMAP_REC_IADDR(block, 1, cur); if (ptr < numrecs) { - ovbcopy(&rp[ptr], &rp[ptr - 1], + memmove(&rp[ptr - 1], &rp[ptr], (numrecs - ptr) * sizeof(*rp)); xfs_bmbt_log_recs(cur, bp, ptr, numrecs - 1); } @@ -350,14 +350,14 @@ xfs_bmbt_delrec( } } #endif - bcopy(rkp, lkp, numrrecs * sizeof(*lkp)); - bcopy(rpp, lpp, numrrecs * sizeof(*lpp)); + memcpy(lkp, rkp, numrrecs * sizeof(*lkp)); + memcpy(lpp, rpp, numrrecs * sizeof(*lpp)); xfs_bmbt_log_keys(cur, lbp, numlrecs + 1, numlrecs + numrrecs); xfs_bmbt_log_ptrs(cur, lbp, numlrecs + 1, numlrecs + numrrecs); } else { lrp = XFS_BMAP_REC_IADDR(left, numlrecs + 1, cur); rrp = XFS_BMAP_REC_IADDR(right, 1, cur); - bcopy(rrp, lrp, numrrecs * sizeof(*lrp)); + memcpy(lrp, rrp, numrrecs * sizeof(*lrp)); xfs_bmbt_log_recs(cur, lbp, numlrecs + 1, numlrecs + numrrecs); } INT_MOD(left->bb_numrecs, ARCH_CONVERT, numrrecs); @@ -551,9 +551,9 @@ xfs_bmbt_insrec( } } #endif - ovbcopy(&kp[ptr - 1], &kp[ptr], + memmove(&kp[ptr], &kp[ptr - 1], (numrecs - ptr + 1) * sizeof(*kp)); - ovbcopy(&pp[ptr - 1], &pp[ptr], /* INT_: direct copy */ + memmove(&pp[ptr], &pp[ptr - 1], /* INT_: direct copy */ (numrecs - ptr + 1) * sizeof(*pp)); #ifdef DEBUG if ((error = xfs_btree_check_lptr(cur, (xfs_bmbt_ptr_t)*bnop, @@ -570,7 +570,7 @@ xfs_bmbt_insrec( xfs_bmbt_log_ptrs(cur, bp, ptr, numrecs); } else { rp = XFS_BMAP_REC_IADDR(block, 1, cur); - ovbcopy(&rp[ptr - 1], &rp[ptr], + memmove(&rp[ptr], &rp[ptr - 1], (numrecs - ptr + 1) * sizeof(*rp)); rp[ptr - 1] = *recp; numrecs++; @@ -670,7 +670,7 @@ xfs_bmbt_killroot( ASSERT(INT_GET(block->bb_numrecs, ARCH_CONVERT) == INT_GET(cblock->bb_numrecs, ARCH_CONVERT)); kp = XFS_BMAP_KEY_IADDR(block, 1, cur); ckp = XFS_BMAP_KEY_IADDR(cblock, 1, cur); - bcopy(ckp, kp, INT_GET(block->bb_numrecs, ARCH_CONVERT) * sizeof(*kp)); + memcpy(kp, ckp, INT_GET(block->bb_numrecs, ARCH_CONVERT) * sizeof(*kp)); pp = XFS_BMAP_PTR_IADDR(block, 1, cur); cpp = XFS_BMAP_PTR_IADDR(cblock, 1, cur); #ifdef DEBUG @@ -681,7 +681,7 @@ xfs_bmbt_killroot( } } #endif - bcopy(cpp, pp, INT_GET(block->bb_numrecs, ARCH_CONVERT) * sizeof(*pp)); + memcpy(pp, cpp, INT_GET(block->bb_numrecs, ARCH_CONVERT) * sizeof(*pp)); xfs_bmap_add_free(XFS_DADDR_TO_FSB(cur->bc_mp, XFS_BUF_ADDR(cbp)), 1, cur->bc_private.b.flist, cur->bc_mp); if (!async) @@ -1039,12 +1039,12 @@ xfs_bmbt_lshift( } } #endif - ovbcopy(rkp + 1, rkp, rrecs * sizeof(*rkp)); - ovbcopy(rpp + 1, rpp, rrecs * sizeof(*rpp)); + memmove(rkp, rkp + 1, rrecs * sizeof(*rkp)); + memmove(rpp, rpp + 1, rrecs * sizeof(*rpp)); xfs_bmbt_log_keys(cur, rbp, 1, rrecs); xfs_bmbt_log_ptrs(cur, rbp, 1, rrecs); } else { - ovbcopy(rrp + 1, rrp, rrecs * sizeof(*rrp)); + memmove(rrp, rrp + 1, rrecs * sizeof(*rrp)); xfs_bmbt_log_recs(cur, rbp, 1, rrecs); INT_SET(key.br_startoff, ARCH_CONVERT, xfs_bmbt_get_startoff(rrp)); rkp = &key; @@ -1142,8 +1142,8 @@ xfs_bmbt_rshift( } } #endif - ovbcopy(rkp, rkp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rkp)); - ovbcopy(rpp, rpp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rpp)); + memmove(rkp + 1, rkp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rkp)); + memmove(rpp + 1, rpp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rpp)); #ifdef DEBUG if ((error = xfs_btree_check_lptr(cur, INT_GET(*lpp, ARCH_CONVERT), level))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); @@ -1157,7 +1157,7 @@ xfs_bmbt_rshift( } else { lrp = XFS_BMAP_REC_IADDR(left, INT_GET(left->bb_numrecs, ARCH_CONVERT), cur); rrp = XFS_BMAP_REC_IADDR(right, 1, cur); - ovbcopy(rrp, rrp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rrp)); + memmove(rrp + 1, rrp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rrp)); *rrp = *lrp; xfs_bmbt_log_recs(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) + 1); INT_SET(key.br_startoff, ARCH_CONVERT, xfs_bmbt_get_startoff(rrp)); @@ -1319,15 +1319,15 @@ xfs_bmbt_split( } } #endif - bcopy(lkp, rkp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rkp)); - bcopy(lpp, rpp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rpp)); + memcpy(rkp, lkp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rkp)); + memcpy(rpp, lpp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rpp)); xfs_bmbt_log_keys(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT)); xfs_bmbt_log_ptrs(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT)); keyp->br_startoff = INT_GET(rkp->br_startoff, ARCH_CONVERT); } else { lrp = XFS_BMAP_REC_IADDR(left, i, cur); rrp = XFS_BMAP_REC_IADDR(right, 1, cur); - bcopy(lrp, rrp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rrp)); + memcpy(rrp, lrp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rrp)); xfs_bmbt_log_recs(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT)); keyp->br_startoff = xfs_bmbt_get_startoff(rrp); } @@ -1437,8 +1437,8 @@ xfs_bmdr_to_bmbt( fpp = XFS_BTREE_PTR_ADDR(dblocklen, xfs_bmdr, dblock, 1, dmxr); tpp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, rblocklen); dmxr = INT_GET(dblock->bb_numrecs, ARCH_CONVERT); - bcopy(fkp, tkp, sizeof(*fkp) * dmxr); - bcopy(fpp, tpp, sizeof(*fpp) * dmxr); /* INT_: direct copy */ + memcpy(tkp, fkp, sizeof(*fkp) * dmxr); + memcpy(tpp, fpp, sizeof(*fpp) * dmxr); /* INT_: direct copy */ } /* @@ -2022,7 +2022,7 @@ xfs_bmbt_newroot( cur->bc_ptrs[level + 1] = 1; kp = XFS_BMAP_KEY_IADDR(block, 1, cur); ckp = XFS_BMAP_KEY_IADDR(cblock, 1, cur); - bcopy(kp, ckp, INT_GET(cblock->bb_numrecs, ARCH_CONVERT) * sizeof(*kp)); + memcpy(ckp, kp, INT_GET(cblock->bb_numrecs, ARCH_CONVERT) * sizeof(*kp)); cpp = XFS_BMAP_PTR_IADDR(cblock, 1, cur); #ifdef DEBUG for (i = 0; i < INT_GET(cblock->bb_numrecs, ARCH_CONVERT); i++) { @@ -2032,7 +2032,7 @@ xfs_bmbt_newroot( } } #endif - bcopy(pp, cpp, INT_GET(cblock->bb_numrecs, ARCH_CONVERT) * sizeof(*pp)); + memcpy(cpp, pp, INT_GET(cblock->bb_numrecs, ARCH_CONVERT) * sizeof(*pp)); #ifdef DEBUG if ((error = xfs_btree_check_lptr(cur, (xfs_bmbt_ptr_t)args.fsbno, level))) { @@ -2248,8 +2248,8 @@ xfs_bmbt_to_bmdr( fpp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, rblocklen); tpp = XFS_BTREE_PTR_ADDR(dblocklen, xfs_bmdr, dblock, 1, dmxr); dmxr = INT_GET(dblock->bb_numrecs, ARCH_CONVERT); - bcopy(fkp, tkp, sizeof(*fkp) * dmxr); - bcopy(fpp, tpp, sizeof(*fpp) * dmxr); /* INT_: direct copy */ + memcpy(tkp, fkp, sizeof(*fkp) * dmxr); + memcpy(tpp, fpp, sizeof(*fpp) * dmxr); /* INT_: direct copy */ } /* diff --git a/libxfs/xfs_da_btree.c b/libxfs/xfs_da_btree.c index 6537559a1..c44853fd3 100644 --- a/libxfs/xfs_da_btree.c +++ b/libxfs/xfs_da_btree.c @@ -310,7 +310,7 @@ xfs_da_root_split(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, size = (int)((char *)&leaf->ents[INT_GET(leaf->hdr.count, ARCH_CONVERT)] - (char *)leaf); } - bcopy(oldroot, node, size); + memcpy(node, oldroot, size); xfs_da_log_buf(tp, bp, 0, size - 1); xfs_da_buf_done(blk1->bp); blk1->bp = bp; @@ -477,7 +477,7 @@ xfs_da_node_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, tmp *= (uint)sizeof(xfs_da_node_entry_t); btree_s = &node2->btree[0]; btree_d = &node2->btree[count]; - ovbcopy(btree_s, btree_d, tmp); + memmove(btree_d, btree_s, tmp); } /* @@ -488,7 +488,7 @@ xfs_da_node_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, tmp = count * (uint)sizeof(xfs_da_node_entry_t); btree_s = &node1->btree[INT_GET(node1->hdr.count, ARCH_CONVERT) - count]; btree_d = &node2->btree[0]; - bcopy(btree_s, btree_d, tmp); + memcpy(btree_d, btree_s, tmp); INT_MOD(node1->hdr.count, ARCH_CONVERT, -(count)); } else { @@ -500,7 +500,7 @@ xfs_da_node_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, tmp = count * (uint)sizeof(xfs_da_node_entry_t); btree_s = &node2->btree[0]; btree_d = &node1->btree[INT_GET(node1->hdr.count, ARCH_CONVERT)]; - bcopy(btree_s, btree_d, tmp); + memcpy(btree_d, btree_s, tmp); INT_MOD(node1->hdr.count, ARCH_CONVERT, count); xfs_da_log_buf(tp, blk1->bp, XFS_DA_LOGRANGE(node1, btree_d, tmp)); @@ -512,7 +512,7 @@ xfs_da_node_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, tmp *= (uint)sizeof(xfs_da_node_entry_t); btree_s = &node2->btree[count]; btree_d = &node2->btree[0]; - ovbcopy(btree_s, btree_d, tmp); + memmove(btree_d, btree_s, tmp); INT_MOD(node2->hdr.count, ARCH_CONVERT, -(count)); } @@ -572,7 +572,7 @@ xfs_da_node_add(xfs_da_state_t *state, xfs_da_state_blk_t *oldblk, btree = &node->btree[ oldblk->index ]; if (oldblk->index < INT_GET(node->hdr.count, ARCH_CONVERT)) { tmp = (INT_GET(node->hdr.count, ARCH_CONVERT) - oldblk->index) * (uint)sizeof(*btree); - ovbcopy(btree, btree + 1, tmp); + memmove(btree + 1, btree, tmp); } INT_SET(btree->hashval, ARCH_CONVERT, newblk->hashval); INT_SET(btree->before, ARCH_CONVERT, newblk->blkno); @@ -740,7 +740,7 @@ xfs_da_root_join(xfs_da_state_t *state, xfs_da_state_blk_t *root_blk) } ASSERT(INT_ISZERO(blkinfo->forw, ARCH_CONVERT)); ASSERT(INT_ISZERO(blkinfo->back, ARCH_CONVERT)); - bcopy(bp->data, root_blk->bp->data, state->blocksize); + memcpy(root_blk->bp->data, bp->data, state->blocksize); xfs_da_log_buf(args->trans, root_blk->bp, 0, state->blocksize - 1); error = xfs_da_shrink_inode(args, child, bp); return(error); @@ -792,7 +792,7 @@ xfs_da_node_toosmall(xfs_da_state_t *state, int *action) * path point to the block we want to drop (this one). */ forward = (!INT_ISZERO(info->forw, ARCH_CONVERT)); - bcopy(&state->path, &state->altpath, sizeof(state->path)); + memcpy(&state->altpath, &state->path, sizeof(state->path)); error = xfs_da_path_shift(state, &state->altpath, forward, 0, &retval); if (error) @@ -848,7 +848,7 @@ xfs_da_node_toosmall(xfs_da_state_t *state, int *action) * Make altpath point to the block we want to keep (the lower * numbered block) and path point to the block we want to drop. */ - bcopy(&state->path, &state->altpath, sizeof(state->path)); + memcpy(&state->altpath, &state->path, sizeof(state->path)); if (blkno < blk->blkno) { error = xfs_da_path_shift(state, &state->altpath, forward, 0, &retval); @@ -954,12 +954,12 @@ xfs_da_node_remove(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk) if (drop_blk->index < (INT_GET(node->hdr.count, ARCH_CONVERT)-1)) { tmp = INT_GET(node->hdr.count, ARCH_CONVERT) - drop_blk->index - 1; tmp *= (uint)sizeof(xfs_da_node_entry_t); - ovbcopy(btree + 1, btree, tmp); + memmove(btree, btree + 1, tmp); xfs_da_log_buf(state->args->trans, drop_blk->bp, XFS_DA_LOGRANGE(node, btree, tmp)); btree = &node->btree[ INT_GET(node->hdr.count, ARCH_CONVERT)-1 ]; } - bzero((char *)btree, sizeof(xfs_da_node_entry_t)); + memset((char *)btree, 0, sizeof(xfs_da_node_entry_t)); xfs_da_log_buf(state->args->trans, drop_blk->bp, XFS_DA_LOGRANGE(node, btree, sizeof(*btree))); INT_MOD(node->hdr.count, ARCH_CONVERT, -1); @@ -1002,7 +1002,7 @@ xfs_da_node_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk, { btree = &save_node->btree[ INT_GET(drop_node->hdr.count, ARCH_CONVERT) ]; tmp = INT_GET(save_node->hdr.count, ARCH_CONVERT) * (uint)sizeof(xfs_da_node_entry_t); - ovbcopy(&save_node->btree[0], btree, tmp); + memmove(btree, &save_node->btree[0], tmp); btree = &save_node->btree[0]; xfs_da_log_buf(tp, save_blk->bp, XFS_DA_LOGRANGE(save_node, btree, @@ -1020,7 +1020,7 @@ xfs_da_node_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk, * Move all the B-tree elements from drop_blk to save_blk. */ tmp = INT_GET(drop_node->hdr.count, ARCH_CONVERT) * (uint)sizeof(xfs_da_node_entry_t); - bcopy(&drop_node->btree[0], btree, tmp); + memcpy(btree, &drop_node->btree[0], tmp); INT_MOD(save_node->hdr.count, ARCH_CONVERT, INT_GET(drop_node->hdr.count, ARCH_CONVERT)); xfs_da_log_buf(tp, save_blk->bp, @@ -1756,7 +1756,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, /* * Copy the last block into the dead buffer and log it. */ - bcopy(last_buf->data, dead_buf->data, mp->m_dirblksize); + memcpy(dead_buf->data, last_buf->data, mp->m_dirblksize); xfs_da_log_buf(tp, dead_buf, 0, mp->m_dirblksize - 1); dead_info = dead_buf->data; /* @@ -2281,7 +2281,7 @@ xfs_da_state_free(xfs_da_state_t *state) if (state->extravalid && state->extrablk.bp) xfs_da_buf_done(state->extrablk.bp); #ifdef DEBUG - bzero((char *)state, sizeof(*state)); + memset((char *)state, 0, sizeof(*state)); #endif /* DEBUG */ kmem_zone_free(xfs_da_state_zone, state); } @@ -2328,7 +2328,7 @@ xfs_da_buf_make(int nbuf, xfs_buf_t **bps, inst_t *ra) dabuf->data = kmem_alloc(BBTOB(dabuf->bbcount), KM_SLEEP); for (i = off = 0; i < nbuf; i++, off += XFS_BUF_COUNT(bp)) { bp = bps[i]; - bcopy(XFS_BUF_PTR(bp), (char *)dabuf->data + off, + memcpy((char *)dabuf->data + off, XFS_BUF_PTR(bp), XFS_BUF_COUNT(bp)); } } @@ -2369,7 +2369,7 @@ xfs_da_buf_clean(xfs_dabuf_t *dabuf) for (i = off = 0; i < dabuf->nbuf; i++, off += XFS_BUF_COUNT(bp)) { bp = dabuf->bps[i]; - bcopy((char *)dabuf->data + off, XFS_BUF_PTR(bp), + memcpy(XFS_BUF_PTR(bp), (char *)dabuf->data + off, XFS_BUF_COUNT(bp)); } } @@ -2400,7 +2400,7 @@ xfs_da_buf_done(xfs_dabuf_t *dabuf) dabuf->next->prev = dabuf->prev; mutex_spinunlock(&xfs_dabuf_global_lock, s); } - bzero(dabuf, XFS_DA_BUF_SIZE(dabuf->nbuf)); + memset(dabuf, 0, XFS_DA_BUF_SIZE(dabuf->nbuf)); #endif if (dabuf->nbuf == 1) kmem_zone_free(xfs_dabuf_zone, dabuf); @@ -2470,7 +2470,7 @@ xfs_da_brelse(xfs_trans_t *tp, xfs_dabuf_t *dabuf) bp = dabuf->bps[0]; } else { bplist = kmem_alloc(nbuf * sizeof(*bplist), KM_SLEEP); - bcopy(dabuf->bps, bplist, nbuf * sizeof(*bplist)); + memcpy(bplist, dabuf->bps, nbuf * sizeof(*bplist)); } xfs_da_buf_done(dabuf); for (i = 0; i < nbuf; i++) @@ -2496,7 +2496,7 @@ xfs_da_binval(xfs_trans_t *tp, xfs_dabuf_t *dabuf) bp = dabuf->bps[0]; } else { bplist = kmem_alloc(nbuf * sizeof(*bplist), KM_SLEEP); - bcopy(dabuf->bps, bplist, nbuf * sizeof(*bplist)); + memcpy(bplist, dabuf->bps, nbuf * sizeof(*bplist)); } xfs_da_buf_done(dabuf); for (i = 0; i < nbuf; i++) diff --git a/libxfs/xfs_dir.c b/libxfs/xfs_dir.c index 654822de8..54c8312cd 100644 --- a/libxfs/xfs_dir.c +++ b/libxfs/xfs_dir.c @@ -85,7 +85,7 @@ xfs_dir_init(xfs_trans_t *trans, xfs_inode_t *dir, xfs_inode_t *parent_dir) xfs_da_args_t args; int error; - bzero((char *)&args, sizeof(args)); + memset((char *)&args, 0, sizeof(args)); args.dp = dir; args.trans = trans; diff --git a/libxfs/xfs_dir2.c b/libxfs/xfs_dir2.c index e3f0e37a0..47f5654e4 100644 --- a/libxfs/xfs_dir2.c +++ b/libxfs/xfs_dir2.c @@ -71,7 +71,7 @@ xfs_dir2_init( xfs_da_args_t args; /* operation arguments */ int error; /* error return value */ - bzero((char *)&args, sizeof(args)); + memset((char *)&args, 0, sizeof(args)); args.dp = dp; args.trans = tp; ASSERT((dp->i_d.di_mode & IFMT) == IFDIR); diff --git a/libxfs/xfs_dir2_block.c b/libxfs/xfs_dir2_block.c index 35d466745..cf1fc4b56 100644 --- a/libxfs/xfs_dir2_block.c +++ b/libxfs/xfs_dir2_block.c @@ -320,7 +320,7 @@ xfs_dir2_block_addname( blp--; mid++; if (mid) - ovbcopy(&blp[1], blp, mid * sizeof(*blp)); + memmove(blp, &blp[1], mid * sizeof(*blp)); lfloglow = 0; lfloghigh = mid; } @@ -346,7 +346,7 @@ xfs_dir2_block_addname( (highstale == INT_GET(btp->count, ARCH_CONVERT) || mid - lowstale <= highstale - mid)) { if (mid - lowstale) - ovbcopy(&blp[lowstale + 1], &blp[lowstale], + memmove(&blp[lowstale], &blp[lowstale + 1], (mid - lowstale) * sizeof(*blp)); lfloglow = MIN(lowstale, lfloglow); lfloghigh = MAX(mid, lfloghigh); @@ -358,7 +358,7 @@ xfs_dir2_block_addname( ASSERT(highstale < INT_GET(btp->count, ARCH_CONVERT)); mid++; if (highstale - mid) - ovbcopy(&blp[mid], &blp[mid + 1], + memmove(&blp[mid + 1], &blp[mid], (highstale - mid) * sizeof(*blp)); lfloglow = MIN(mid, lfloglow); lfloghigh = MAX(highstale, lfloghigh); @@ -386,7 +386,7 @@ xfs_dir2_block_addname( */ INT_SET(dep->inumber, ARCH_CONVERT, args->inumber); dep->namelen = args->namelen; - bcopy(args->name, dep->name, args->namelen); + memcpy(dep->name, args->name, args->namelen); tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)block)); /* @@ -571,7 +571,7 @@ xfs_dir2_block_lookup_int( */ if (dep->namelen == args->namelen && dep->name[0] == args->name[0] && - bcmp(dep->name, args->name, args->namelen) == 0) { + memcmp(dep->name, args->name, args->namelen) == 0) { *bpp = bp; *entno = mid; return 0; @@ -929,7 +929,7 @@ xfs_dir2_sf_to_block( buf_len = dp->i_df.if_bytes; buf = kmem_alloc(dp->i_df.if_bytes, KM_SLEEP); - bcopy(sfp, buf, dp->i_df.if_bytes); + memcpy(buf, sfp, dp->i_df.if_bytes); xfs_idata_realloc(dp, -dp->i_df.if_bytes, XFS_DATA_FORK); dp->i_d.di_size = 0; xfs_trans_log_inode(tp, dp, XFS_ILOG_CORE); @@ -1053,7 +1053,7 @@ xfs_dir2_sf_to_block( INT_SET(dep->inumber, ARCH_CONVERT, XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT)); dep->namelen = sfep->namelen; - bcopy(sfep->name, dep->name, dep->namelen); + memcpy(dep->name, sfep->name, dep->namelen); tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)block)); xfs_dir2_data_log_entry(tp, bp, dep); diff --git a/libxfs/xfs_dir2_data.c b/libxfs/xfs_dir2_data.c index db9114078..9f6248948 100644 --- a/libxfs/xfs_dir2_data.c +++ b/libxfs/xfs_dir2_data.c @@ -338,7 +338,7 @@ xfs_dir2_data_freescan( /* * Start by clearing the table. */ - bzero(d->hdr.bestfree, sizeof(d->hdr.bestfree)); + memset(d->hdr.bestfree, 0, sizeof(d->hdr.bestfree)); *loghead = 1; /* * Set up pointers. diff --git a/libxfs/xfs_dir2_leaf.c b/libxfs/xfs_dir2_leaf.c index 897f5ebbc..2b1bdef75 100644 --- a/libxfs/xfs_dir2_leaf.c +++ b/libxfs/xfs_dir2_leaf.c @@ -100,7 +100,7 @@ xfs_dir2_block_to_leaf( * Could compact these but I think we always do the conversion * after squeezing out stale entries. */ - bcopy(blp, leaf->ents, INT_GET(btp->count, ARCH_CONVERT) * sizeof(xfs_dir2_leaf_entry_t)); + memcpy(leaf->ents, blp, INT_GET(btp->count, ARCH_CONVERT) * sizeof(xfs_dir2_leaf_entry_t)); xfs_dir2_leaf_log_ents(tp, lbp, 0, INT_GET(leaf->hdr.count, ARCH_CONVERT) - 1); needscan = 0; needlog = 1; @@ -343,7 +343,7 @@ xfs_dir2_leaf_addname( */ if (use_block >= INT_GET(ltp->bestcount, ARCH_CONVERT)) { bestsp--; - ovbcopy(&bestsp[1], &bestsp[0], + memmove(&bestsp[0], &bestsp[1], INT_GET(ltp->bestcount, ARCH_CONVERT) * sizeof(bestsp[0])); INT_MOD(ltp->bestcount, ARCH_CONVERT, +1); xfs_dir2_leaf_log_tail(tp, lbp); @@ -392,7 +392,7 @@ xfs_dir2_leaf_addname( dep = (xfs_dir2_data_entry_t *)dup; INT_SET(dep->inumber, ARCH_CONVERT, args->inumber); dep->namelen = args->namelen; - bcopy(args->name, dep->name, dep->namelen); + memcpy(dep->name, args->name, dep->namelen); tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)data)); /* @@ -424,7 +424,7 @@ xfs_dir2_leaf_addname( * lep is still good as the index leaf entry. */ if (index < INT_GET(leaf->hdr.count, ARCH_CONVERT)) - ovbcopy(lep, lep + 1, + memmove(lep + 1, lep, (INT_GET(leaf->hdr.count, ARCH_CONVERT) - index) * sizeof(*lep)); /* * Record low and high logging indices for the leaf. @@ -483,8 +483,8 @@ xfs_dir2_leaf_addname( * and make room for the new entry. */ if (index - lowstale - 1 > 0) - ovbcopy(&leaf->ents[lowstale + 1], - &leaf->ents[lowstale], + memmove(&leaf->ents[lowstale], + &leaf->ents[lowstale + 1], (index - lowstale - 1) * sizeof(*lep)); lep = &leaf->ents[index - 1]; lfloglow = MIN(lowstale, lfloglow); @@ -502,8 +502,8 @@ xfs_dir2_leaf_addname( * and make room for the new entry. */ if (highstale - index > 0) - ovbcopy(&leaf->ents[index], - &leaf->ents[index + 1], + memmove(&leaf->ents[index + 1], + &leaf->ents[index], (highstale - index) * sizeof(*lep)); lep = &leaf->ents[index]; lfloglow = MIN(index, lfloglow); @@ -1007,7 +1007,7 @@ xfs_dir2_leaf_lookup_int( */ if (dep->namelen == args->namelen && dep->name[0] == args->name[0] && - bcmp(dep->name, args->name, args->namelen) == 0) { + memcmp(dep->name, args->name, args->namelen) == 0) { *dbpp = dbp; *indexp = index; return 0; @@ -1142,7 +1142,7 @@ xfs_dir2_leaf_removename( * Copy the table down so inactive entries at the * end are removed. */ - ovbcopy(bestsp, &bestsp[db - i], + memmove(&bestsp[db - i], bestsp, (INT_GET(ltp->bestcount, ARCH_CONVERT) - (db - i)) * sizeof(*bestsp)); INT_MOD(ltp->bestcount, ARCH_CONVERT, -(db - i)); xfs_dir2_leaf_log_tail(tp, lbp); @@ -1326,7 +1326,7 @@ xfs_dir2_leaf_trim_data( */ bestsp = XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT); INT_MOD(ltp->bestcount, ARCH_CONVERT, -1); - ovbcopy(&bestsp[0], &bestsp[1], INT_GET(ltp->bestcount, ARCH_CONVERT) * sizeof(*bestsp)); + memmove(&bestsp[1], &bestsp[0], INT_GET(ltp->bestcount, ARCH_CONVERT) * sizeof(*bestsp)); xfs_dir2_leaf_log_tail(tp, lbp); xfs_dir2_leaf_log_bests(tp, lbp, 0, INT_GET(ltp->bestcount, ARCH_CONVERT) - 1); return 0; @@ -1440,7 +1440,7 @@ xfs_dir2_node_to_leaf( /* * Set up the leaf bests table. */ - bcopy(free->bests, XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT), + memcpy(XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT), free->bests, INT_GET(ltp->bestcount, ARCH_CONVERT) * sizeof(leaf->bests[0])); xfs_dir2_leaf_log_bests(tp, lbp, 0, INT_GET(ltp->bestcount, ARCH_CONVERT) - 1); xfs_dir2_leaf_log_tail(tp, lbp); diff --git a/libxfs/xfs_dir2_node.c b/libxfs/xfs_dir2_node.c index 918e852d9..2d9eabc1b 100644 --- a/libxfs/xfs_dir2_node.c +++ b/libxfs/xfs_dir2_node.c @@ -217,7 +217,7 @@ xfs_dir2_leafn_add( if (INT_ISZERO(leaf->hdr.stale, ARCH_CONVERT)) { lep = &leaf->ents[index]; if (index < INT_GET(leaf->hdr.count, ARCH_CONVERT)) - ovbcopy(lep, lep + 1, + memmove(lep + 1, lep, (INT_GET(leaf->hdr.count, ARCH_CONVERT) - index) * sizeof(*lep)); lfloglow = index; lfloghigh = INT_GET(leaf->hdr.count, ARCH_CONVERT); @@ -266,8 +266,8 @@ xfs_dir2_leafn_add( XFS_DIR2_NULL_DATAPTR); ASSERT(index - lowstale - 1 >= 0); if (index - lowstale - 1 > 0) - ovbcopy(&leaf->ents[lowstale + 1], - &leaf->ents[lowstale], + memmove(&leaf->ents[lowstale], + &leaf->ents[lowstale + 1], (index - lowstale - 1) * sizeof(*lep)); lep = &leaf->ents[index - 1]; lfloglow = MIN(lowstale, lfloglow); @@ -282,8 +282,8 @@ xfs_dir2_leafn_add( XFS_DIR2_NULL_DATAPTR); ASSERT(highstale - index >= 0); if (highstale - index > 0) - ovbcopy(&leaf->ents[index], - &leaf->ents[index + 1], + memmove(&leaf->ents[index + 1], + &leaf->ents[index], (highstale - index) * sizeof(*lep)); lep = &leaf->ents[index]; lfloglow = MIN(index, lfloglow); @@ -542,7 +542,7 @@ xfs_dir2_leafn_lookup_int( */ if (dep->namelen == args->namelen && dep->name[0] == args->name[0] && - bcmp(dep->name, args->name, args->namelen) == 0) { + memcmp(dep->name, args->name, args->namelen) == 0) { args->inumber = INT_GET(dep->inumber, ARCH_CONVERT); *indexp = index; state->extravalid = 1; @@ -622,7 +622,7 @@ xfs_dir2_leafn_moveents( * to hold the new entries. */ if (start_d < INT_GET(leaf_d->hdr.count, ARCH_CONVERT)) { - ovbcopy(&leaf_d->ents[start_d], &leaf_d->ents[start_d + count], + memmove(&leaf_d->ents[start_d + count], &leaf_d->ents[start_d], (INT_GET(leaf_d->hdr.count, ARCH_CONVERT) - start_d) * sizeof(xfs_dir2_leaf_entry_t)); xfs_dir2_leaf_log_ents(tp, bp_d, start_d + count, @@ -644,7 +644,7 @@ xfs_dir2_leafn_moveents( /* * Copy the leaf entries from source to destination. */ - bcopy(&leaf_s->ents[start_s], &leaf_d->ents[start_d], + memcpy(&leaf_d->ents[start_d], &leaf_s->ents[start_s], count * sizeof(xfs_dir2_leaf_entry_t)); xfs_dir2_leaf_log_ents(tp, bp_d, start_d, start_d + count - 1); /* @@ -652,7 +652,7 @@ xfs_dir2_leafn_moveents( * delete the ones we copied by sliding the next ones down. */ if (start_s + count < INT_GET(leaf_s->hdr.count, ARCH_CONVERT)) { - ovbcopy(&leaf_s->ents[start_s + count], &leaf_s->ents[start_s], + memmove(&leaf_s->ents[start_s], &leaf_s->ents[start_s + count], count * sizeof(xfs_dir2_leaf_entry_t)); xfs_dir2_leaf_log_ents(tp, bp_s, start_s, start_s + count - 1); } @@ -1113,7 +1113,7 @@ xfs_dir2_leafn_toosmall( * path point to the block we want to drop (this one). */ forward = !INT_ISZERO(info->forw, ARCH_CONVERT); - bcopy(&state->path, &state->altpath, sizeof(state->path)); + memcpy(&state->altpath, &state->path, sizeof(state->path)); error = xfs_da_path_shift(state, &state->altpath, forward, 0, &rval); if (error) @@ -1175,7 +1175,7 @@ xfs_dir2_leafn_toosmall( * Make altpath point to the block we want to keep (the lower * numbered block) and path point to the block we want to drop. */ - bcopy(&state->path, &state->altpath, sizeof(state->path)); + memcpy(&state->altpath, &state->path, sizeof(state->path)); if (blkno < blk->blkno) error = xfs_da_path_shift(state, &state->altpath, forward, 0, &rval); @@ -1664,7 +1664,7 @@ xfs_dir2_node_addname_int( dep = (xfs_dir2_data_entry_t *)dup; INT_SET(dep->inumber, ARCH_CONVERT, args->inumber); dep->namelen = args->namelen; - bcopy(args->name, dep->name, dep->namelen); + memcpy(dep->name, args->name, dep->namelen); tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)data)); xfs_dir2_data_log_entry(tp, dbp, dep); diff --git a/libxfs/xfs_dir2_sf.c b/libxfs/xfs_dir2_sf.c index 3e056c131..cc7d4294a 100644 --- a/libxfs/xfs_dir2_sf.c +++ b/libxfs/xfs_dir2_sf.c @@ -155,7 +155,7 @@ xfs_dir2_block_to_sf( * and add local data. */ block = kmem_alloc(mp->m_dirblksize, KM_SLEEP); - bcopy(bp->data, block, mp->m_dirblksize); + memcpy(block, bp->data, mp->m_dirblksize); logflags = XFS_ILOG_CORE; if ((error = xfs_dir2_shrink_inode(args, mp->m_dirdatablk, bp))) { ASSERT(error != ENOSPC); @@ -177,7 +177,7 @@ xfs_dir2_block_to_sf( * Copy the header into the newly allocate local space. */ sfp = (xfs_dir2_sf_t *)dp->i_df.if_u1.if_data; - bcopy(sfhp, sfp, XFS_DIR2_SF_HDR_SIZE(sfhp->i8count)); + memcpy(sfp, sfhp, XFS_DIR2_SF_HDR_SIZE(sfhp->i8count)); dp->i_d.di_size = size; /* * Set up to loop over the block's entries. @@ -220,7 +220,7 @@ xfs_dir2_block_to_sf( XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep, (xfs_dir2_data_aoff_t) ((char *)dep - (char *)block), ARCH_CONVERT); - bcopy(dep->name, sfep->name, dep->namelen); + memcpy(sfep->name, dep->name, dep->namelen); temp=INT_GET(dep->inumber, ARCH_CONVERT); XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &temp, XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); @@ -384,7 +384,7 @@ xfs_dir2_sf_addname_easy( */ sfep->namelen = args->namelen; XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep, offset, ARCH_CONVERT); - bcopy(args->name, sfep->name, sfep->namelen); + memcpy(sfep->name, args->name, sfep->namelen); XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &args->inumber, XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); /* @@ -436,7 +436,7 @@ xfs_dir2_sf_addname_hard( old_isize = (int)dp->i_d.di_size; buf = kmem_alloc(old_isize, KM_SLEEP); oldsfp = (xfs_dir2_sf_t *)buf; - bcopy(sfp, oldsfp, old_isize); + memcpy(oldsfp, sfp, old_isize); /* * Loop over the old directory finding the place we're going * to insert the new entry. @@ -469,14 +469,14 @@ xfs_dir2_sf_addname_hard( * Copy the first part of the directory, including the header. */ nbytes = (int)((char *)oldsfep - (char *)oldsfp); - bcopy(oldsfp, sfp, nbytes); + memcpy(sfp, oldsfp, nbytes); sfep = (xfs_dir2_sf_entry_t *)((char *)sfp + nbytes); /* * Fill in the new entry, and update the header counts. */ sfep->namelen = args->namelen; XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep, offset, ARCH_CONVERT); - bcopy(args->name, sfep->name, sfep->namelen); + memcpy(sfep->name, args->name, sfep->namelen); XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &args->inumber, XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); sfp->hdr.count++; @@ -489,7 +489,7 @@ xfs_dir2_sf_addname_hard( */ if (!eof) { sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep); - bcopy(oldsfep, sfep, old_isize - nbytes); + memcpy(sfep, oldsfep, old_isize - nbytes); } kmem_free(buf, old_isize); dp->i_d.di_size = new_isize; @@ -726,7 +726,7 @@ xfs_dir2_sf_lookup( i++, sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep)) { if (sfep->namelen == args->namelen && sfep->name[0] == args->name[0] && - bcmp(args->name, sfep->name, args->namelen) == 0) { + memcmp(args->name, sfep->name, args->namelen) == 0) { args->inumber = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); @@ -781,7 +781,7 @@ xfs_dir2_sf_removename( i++, sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep)) { if (sfep->namelen == args->namelen && sfep->name[0] == args->name[0] && - bcmp(sfep->name, args->name, args->namelen) == 0) { + memcmp(sfep->name, args->name, args->namelen) == 0) { ASSERT(XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT) == args->inumber); @@ -804,7 +804,7 @@ xfs_dir2_sf_removename( * Copy the part if any after the removed entry, sliding it down. */ if (byteoff + entsize < oldsize) - ovbcopy((char *)sfp + byteoff + entsize, (char *)sfp + byteoff, + memmove((char *)sfp + byteoff, (char *)sfp + byteoff + entsize, oldsize - (byteoff + entsize)); /* * Fix up the header and file size. @@ -918,7 +918,7 @@ xfs_dir2_sf_replace( i++, sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep)) { if (sfep->namelen == args->namelen && sfep->name[0] == args->name[0] && - bcmp(args->name, sfep->name, args->namelen) == 0) { + memcmp(args->name, sfep->name, args->namelen) == 0) { #if XFS_BIG_FILESYSTEMS || defined(DEBUG) ino = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); @@ -1006,7 +1006,7 @@ xfs_dir2_sf_toino4( buf = kmem_alloc(oldsize, KM_SLEEP); oldsfp = (xfs_dir2_sf_t *)dp->i_df.if_u1.if_data; ASSERT(oldsfp->hdr.i8count == 1); - bcopy(oldsfp, buf, oldsize); + memcpy(buf, oldsfp, oldsize); /* * Compute the new inode size. */ @@ -1038,7 +1038,7 @@ xfs_dir2_sf_toino4( oldsfep = XFS_DIR2_SF_NEXTENTRY(oldsfp, oldsfep)) { sfep->namelen = oldsfep->namelen; sfep->offset = oldsfep->offset; - bcopy(oldsfep->name, sfep->name, sfep->namelen); + memcpy(sfep->name, oldsfep->name, sfep->namelen); ino = XFS_DIR2_SF_GET_INUMBER_ARCH(oldsfp, XFS_DIR2_SF_INUMBERP(oldsfep), ARCH_CONVERT); XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &ino, XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); @@ -1083,7 +1083,7 @@ xfs_dir2_sf_toino8( buf = kmem_alloc(oldsize, KM_SLEEP); oldsfp = (xfs_dir2_sf_t *)dp->i_df.if_u1.if_data; ASSERT(oldsfp->hdr.i8count == 0); - bcopy(oldsfp, buf, oldsize); + memcpy(buf, oldsfp, oldsize); /* * Compute the new inode size. */ @@ -1115,7 +1115,7 @@ xfs_dir2_sf_toino8( oldsfep = XFS_DIR2_SF_NEXTENTRY(oldsfp, oldsfep)) { sfep->namelen = oldsfep->namelen; sfep->offset = oldsfep->offset; - bcopy(oldsfep->name, sfep->name, sfep->namelen); + memcpy(sfep->name, oldsfep->name, sfep->namelen); ino = XFS_DIR2_SF_GET_INUMBER_ARCH(oldsfp, XFS_DIR2_SF_INUMBERP(oldsfep), ARCH_CONVERT); XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &ino, XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); diff --git a/libxfs/xfs_dir_leaf.c b/libxfs/xfs_dir_leaf.c index 6de71acd6..ed5290c54 100644 --- a/libxfs/xfs_dir_leaf.c +++ b/libxfs/xfs_dir_leaf.c @@ -128,7 +128,7 @@ xfs_dir_shortform_addname(xfs_da_args_t *args) for (i = INT_GET(sf->hdr.count, ARCH_CONVERT)-1; i >= 0; i--) { if (sfe->namelen == args->namelen && args->name[0] == sfe->name[0] && - bcmp(args->name, sfe->name, args->namelen) == 0) + memcmp(args->name, sfe->name, args->namelen) == 0) return(XFS_ERROR(EEXIST)); sfe = XFS_DIR_SF_NEXTENTRY(sfe); } @@ -141,7 +141,7 @@ xfs_dir_shortform_addname(xfs_da_args_t *args) XFS_DIR_SF_PUT_DIRINO_ARCH(&args->inumber, &sfe->inumber, ARCH_CONVERT); sfe->namelen = args->namelen; - bcopy(args->name, sfe->name, sfe->namelen); + memcpy(sfe->name, args->name, sfe->namelen); INT_MOD(sf->hdr.count, ARCH_CONVERT, +1); dp->i_d.di_size += size; @@ -180,7 +180,7 @@ xfs_dir_shortform_removename(xfs_da_args_t *args) size = XFS_DIR_SF_ENTSIZE_BYENTRY(sfe); if (sfe->namelen == args->namelen && sfe->name[0] == args->name[0] && - bcmp(sfe->name, args->name, args->namelen) == 0) + memcmp(sfe->name, args->name, args->namelen) == 0) break; base += size; sfe = XFS_DIR_SF_NEXTENTRY(sfe); @@ -191,7 +191,7 @@ xfs_dir_shortform_removename(xfs_da_args_t *args) } if ((base + size) != dp->i_d.di_size) { - ovbcopy(&((char *)sf)[base+size], &((char *)sf)[base], + memmove(&((char *)sf)[base], &((char *)sf)[base+size], dp->i_d.di_size - (base+size)); } INT_MOD(sf->hdr.count, ARCH_CONVERT, -1); @@ -240,7 +240,7 @@ xfs_dir_shortform_lookup(xfs_da_args_t *args) for (i = INT_GET(sf->hdr.count, ARCH_CONVERT)-1; i >= 0; i--) { if (sfe->namelen == args->namelen && sfe->name[0] == args->name[0] && - bcmp(args->name, sfe->name, args->namelen) == 0) { + memcmp(args->name, sfe->name, args->namelen) == 0) { XFS_DIR_SF_GET_DIRINO_ARCH(&sfe->inumber, &args->inumber, ARCH_CONVERT); return(XFS_ERROR(EEXIST)); } @@ -281,7 +281,7 @@ xfs_dir_shortform_to_leaf(xfs_da_args_t *iargs) tmpbuffer = kmem_alloc(size, KM_SLEEP); ASSERT(tmpbuffer != NULL); - bcopy(dp->i_df.if_u1.if_data, tmpbuffer, size); + memcpy(tmpbuffer, dp->i_df.if_u1.if_data, size); sf = (xfs_dir_shortform_t *)tmpbuffer; XFS_DIR_SF_GET_DIRINO_ARCH(&sf->hdr.parent, &inumber, ARCH_CONVERT); @@ -378,8 +378,8 @@ xfs_dir_shortform_replace(xfs_da_args_t *args) for (i = INT_GET(sf->hdr.count, ARCH_CONVERT)-1; i >= 0; i--) { if (sfe->namelen == args->namelen && sfe->name[0] == args->name[0] && - bcmp(args->name, sfe->name, args->namelen) == 0) { - ASSERT(bcmp((char *)&args->inumber, + memcmp(args->name, sfe->name, args->namelen) == 0) { + ASSERT(memcmp((char *)&args->inumber, (char *)&sfe->inumber, sizeof(xfs_ino_t))); XFS_DIR_SF_PUT_DIRINO_ARCH(&args->inumber, &sfe->inumber, ARCH_CONVERT); xfs_trans_log_inode(args->trans, dp, XFS_ILOG_DDATA); @@ -417,10 +417,10 @@ xfs_dir_leaf_to_shortform(xfs_da_args_t *iargs) if (retval) return(retval); ASSERT(bp != NULL); - bcopy(bp->data, tmpbuffer, XFS_LBSIZE(dp->i_mount)); + memcpy(tmpbuffer, bp->data, XFS_LBSIZE(dp->i_mount)); leaf = (xfs_dir_leafblock_t *)tmpbuffer; ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR_LEAF_MAGIC); - bzero(bp->data, XFS_LBSIZE(dp->i_mount)); + memset(bp->data, 0, XFS_LBSIZE(dp->i_mount)); /* * Find and special case the parent inode number @@ -503,7 +503,7 @@ xfs_dir_leaf_to_node(xfs_da_args_t *args) return(retval); } ASSERT(bp2 != NULL); - bcopy(bp1->data, bp2->data, XFS_LBSIZE(dp->i_mount)); + memcpy(bp2->data, bp1->data, XFS_LBSIZE(dp->i_mount)); xfs_da_buf_done(bp1); xfs_da_log_buf(args->trans, bp2, 0, XFS_LBSIZE(dp->i_mount) - 1); @@ -554,7 +554,7 @@ xfs_dir_leaf_create(xfs_da_args_t *args, xfs_dablk_t blkno, xfs_dabuf_t **bpp) return(retval); ASSERT(bp != NULL); leaf = bp->data; - bzero((char *)leaf, XFS_LBSIZE(dp->i_mount)); + memset((char *)leaf, 0, XFS_LBSIZE(dp->i_mount)); hdr = &leaf->hdr; INT_SET(hdr->info.magic, ARCH_CONVERT, XFS_DIR_LEAF_MAGIC); INT_SET(hdr->firstused, ARCH_CONVERT, XFS_LBSIZE(dp->i_mount)); @@ -727,7 +727,7 @@ xfs_dir_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int index, if (index < INT_GET(hdr->count, ARCH_CONVERT)) { tmp = INT_GET(hdr->count, ARCH_CONVERT) - index; tmp *= (uint)sizeof(xfs_dir_leaf_entry_t); - ovbcopy(entry, entry + 1, tmp); + memmove(entry + 1, entry, tmp); xfs_da_log_buf(args->trans, bp, XFS_DA_LOGRANGE(leaf, entry, tmp + (uint)sizeof(*entry))); } @@ -753,7 +753,7 @@ xfs_dir_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int index, */ namest = XFS_DIR_LEAF_NAMESTRUCT(leaf, INT_GET(entry->nameidx, ARCH_CONVERT)); XFS_DIR_SF_PUT_DIRINO_ARCH(&args->inumber, &namest->inumber, ARCH_CONVERT); - bcopy(args->name, namest->name, args->namelen); + memcpy(namest->name, args->name, args->namelen); xfs_da_log_buf(args->trans, bp, XFS_DA_LOGRANGE(leaf, namest, XFS_DIR_LEAF_ENTSIZE_BYENTRY(entry))); @@ -796,7 +796,7 @@ xfs_dir_leaf_compact(xfs_trans_t *trans, xfs_dabuf_t *bp, int musthave, lbsize = XFS_LBSIZE(mp); tmpbuffer = kmem_alloc(lbsize, KM_SLEEP); ASSERT(tmpbuffer != NULL); - bcopy(bp->data, tmpbuffer, lbsize); + memcpy(tmpbuffer, bp->data, lbsize); /* * Make a second copy in case xfs_dir_leaf_moveents() @@ -804,9 +804,9 @@ xfs_dir_leaf_compact(xfs_trans_t *trans, xfs_dabuf_t *bp, int musthave, */ if (musthave || justcheck) { tmpbuffer2 = kmem_alloc(lbsize, KM_SLEEP); - bcopy(bp->data, tmpbuffer2, lbsize); + memcpy(tmpbuffer2, bp->data, lbsize); } - bzero(bp->data, lbsize); + memset(bp->data, 0, lbsize); /* * Copy basic information @@ -839,7 +839,7 @@ xfs_dir_leaf_compact(xfs_trans_t *trans, xfs_dabuf_t *bp, int musthave, if (justcheck || rval == ENOSPC) { ASSERT(tmpbuffer2); - bcopy(tmpbuffer2, bp->data, lbsize); + memcpy(bp->data, tmpbuffer2, lbsize); } else { xfs_da_log_buf(trans, bp, 0, lbsize - 1); } @@ -1124,7 +1124,7 @@ xfs_dir_leaf_toosmall(xfs_da_state_t *state, int *action) * path point to the block we want to drop (this one). */ forward = !INT_ISZERO(info->forw, ARCH_CONVERT); - bcopy(&state->path, &state->altpath, sizeof(state->path)); + memcpy(&state->altpath, &state->path, sizeof(state->path)); error = xfs_da_path_shift(state, &state->altpath, forward, 0, &retval); if (error) @@ -1185,7 +1185,7 @@ xfs_dir_leaf_toosmall(xfs_da_state_t *state, int *action) * Make altpath point to the block we want to keep (the lower * numbered block) and path point to the block we want to drop. */ - bcopy(&state->path, &state->altpath, sizeof(state->path)); + memcpy(&state->altpath, &state->path, sizeof(state->path)); if (blkno < blk->blkno) { error = xfs_da_path_shift(state, &state->altpath, forward, 0, &retval); @@ -1305,17 +1305,17 @@ xfs_dir_leaf_remove(xfs_trans_t *trans, xfs_dabuf_t *bp, int index) * Compress the remaining entries and zero out the removed stuff. */ namest = XFS_DIR_LEAF_NAMESTRUCT(leaf, INT_GET(entry->nameidx, ARCH_CONVERT)); - bzero((char *)namest, entsize); + memset((char *)namest, 0, entsize); xfs_da_log_buf(trans, bp, XFS_DA_LOGRANGE(leaf, namest, entsize)); INT_MOD(hdr->namebytes, ARCH_CONVERT, -(entry->namelen)); tmp = (INT_GET(hdr->count, ARCH_CONVERT) - index) * (uint)sizeof(xfs_dir_leaf_entry_t); - ovbcopy(entry + 1, entry, tmp); + memmove(entry, entry + 1, tmp); INT_MOD(hdr->count, ARCH_CONVERT, -1); xfs_da_log_buf(trans, bp, XFS_DA_LOGRANGE(leaf, entry, tmp + (uint)sizeof(*entry))); entry = &leaf->entries[INT_GET(hdr->count, ARCH_CONVERT)]; - bzero((char *)entry, sizeof(xfs_dir_leaf_entry_t)); + memset((char *)entry, 0, sizeof(xfs_dir_leaf_entry_t)); /* * If we removed the first entry, re-find the first used byte @@ -1409,7 +1409,7 @@ xfs_dir_leaf_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk, */ tmpbuffer = kmem_alloc(state->blocksize, KM_SLEEP); ASSERT(tmpbuffer != NULL); - bzero(tmpbuffer, state->blocksize); + memset(tmpbuffer, 0, state->blocksize); tmp_leaf = (xfs_dir_leafblock_t *)tmpbuffer; tmp_hdr = &tmp_leaf->hdr; tmp_hdr->info = save_hdr->info; /* struct copy */ @@ -1431,7 +1431,7 @@ xfs_dir_leaf_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk, tmp_leaf, INT_GET(tmp_leaf->hdr.count, ARCH_CONVERT), (int)INT_GET(drop_hdr->count, ARCH_CONVERT), mp); } - bcopy(tmp_leaf, save_leaf, state->blocksize); + memcpy(save_leaf, tmp_leaf, state->blocksize); kmem_free(tmpbuffer, state->blocksize); } @@ -1518,7 +1518,7 @@ xfs_dir_leaf_lookup_int(xfs_dabuf_t *bp, xfs_da_args_t *args, int *index) namest = XFS_DIR_LEAF_NAMESTRUCT(leaf, INT_GET(entry->nameidx, ARCH_CONVERT)); if (entry->namelen == args->namelen && namest->name[0] == args->name[0] && - bcmp(args->name, namest->name, args->namelen) == 0) { + memcmp(args->name, namest->name, args->namelen) == 0) { XFS_DIR_SF_GET_DIRINO_ARCH(&namest->inumber, &args->inumber, ARCH_CONVERT); *index = probe; return(XFS_ERROR(EEXIST)); @@ -1581,7 +1581,7 @@ xfs_dir_leaf_moveents(xfs_dir_leafblock_t *leaf_s, int start_s, tmp *= (uint)sizeof(xfs_dir_leaf_entry_t); entry_s = &leaf_d->entries[start_d]; entry_d = &leaf_d->entries[start_d + count]; - bcopy(entry_s, entry_d, tmp); + memcpy(entry_d, entry_s, tmp); } /* @@ -1599,11 +1599,11 @@ xfs_dir_leaf_moveents(xfs_dir_leafblock_t *leaf_s, int start_s, INT_COPY(entry_d->nameidx, hdr_d->firstused, ARCH_CONVERT); entry_d->namelen = entry_s->namelen; ASSERT(INT_GET(entry_d->nameidx, ARCH_CONVERT) + tmp <= XFS_LBSIZE(mp)); - bcopy(XFS_DIR_LEAF_NAMESTRUCT(leaf_s, INT_GET(entry_s->nameidx, ARCH_CONVERT)), - XFS_DIR_LEAF_NAMESTRUCT(leaf_d, INT_GET(entry_d->nameidx, ARCH_CONVERT)), tmp); + memcpy(XFS_DIR_LEAF_NAMESTRUCT(leaf_d, INT_GET(entry_d->nameidx, ARCH_CONVERT)), + XFS_DIR_LEAF_NAMESTRUCT(leaf_s, INT_GET(entry_s->nameidx, ARCH_CONVERT)), tmp); ASSERT(INT_GET(entry_s->nameidx, ARCH_CONVERT) + tmp <= XFS_LBSIZE(mp)); - bzero((char *)XFS_DIR_LEAF_NAMESTRUCT(leaf_s, INT_GET(entry_s->nameidx, ARCH_CONVERT)), - tmp); + memset((char *)XFS_DIR_LEAF_NAMESTRUCT(leaf_s, INT_GET(entry_s->nameidx, ARCH_CONVERT)), + 0, tmp); INT_MOD(hdr_s->namebytes, ARCH_CONVERT, -(entry_d->namelen)); INT_MOD(hdr_d->namebytes, ARCH_CONVERT, entry_d->namelen); INT_MOD(hdr_s->count, ARCH_CONVERT, -1); @@ -1621,7 +1621,7 @@ xfs_dir_leaf_moveents(xfs_dir_leafblock_t *leaf_s, int start_s, tmp = count * (uint)sizeof(xfs_dir_leaf_entry_t); entry_s = &leaf_s->entries[start_s]; ASSERT((char *)entry_s + tmp <= (char *)leaf_s + XFS_LBSIZE(mp)); - bzero((char *)entry_s, tmp); + memset((char *)entry_s, 0, tmp); } else { /* * Move the remaining entries down to fill the hole, @@ -1631,12 +1631,12 @@ xfs_dir_leaf_moveents(xfs_dir_leafblock_t *leaf_s, int start_s, tmp *= (uint)sizeof(xfs_dir_leaf_entry_t); entry_s = &leaf_s->entries[start_s + count]; entry_d = &leaf_s->entries[start_s]; - bcopy(entry_s, entry_d, tmp); + memcpy(entry_d, entry_s, tmp); tmp = count * (uint)sizeof(xfs_dir_leaf_entry_t); entry_s = &leaf_s->entries[INT_GET(hdr_s->count, ARCH_CONVERT)]; ASSERT((char *)entry_s + tmp <= (char *)leaf_s + XFS_LBSIZE(mp)); - bzero((char *)entry_s, tmp); + memset((char *)entry_s, 0, tmp); } /* diff --git a/libxfs/xfs_ialloc.c b/libxfs/xfs_ialloc.c index fd297292a..27d982c02 100644 --- a/libxfs/xfs_ialloc.c +++ b/libxfs/xfs_ialloc.c @@ -266,7 +266,7 @@ xfs_ialloc_ag_alloc( INT_ZERO(dic.di_gid, ARCH_CONVERT); INT_ZERO(dic.di_nlink, ARCH_CONVERT); INT_ZERO(dic.di_projid, ARCH_CONVERT); - bzero(&(dic.di_pad[0]),sizeof(dic.di_pad)); + memset(&(dic.di_pad[0]), 0, sizeof(dic.di_pad)); INT_SET(dic.di_atime.t_sec, ARCH_CONVERT, ztime.t_sec); INT_SET(dic.di_atime.t_nsec, ARCH_CONVERT, ztime.t_nsec); @@ -290,7 +290,7 @@ xfs_ialloc_ag_alloc( for (i = 0; i < ninodes; i++) { free = XFS_MAKE_IPTR(args.mp, fbuf, i); - bcopy (&dic, &(free->di_core), sizeof(xfs_dinode_core_t)); + memcpy(&(free->di_core), &dic, sizeof(xfs_dinode_core_t)); INT_SET(free->di_next_unlinked, ARCH_CONVERT, NULLAGINO); xfs_ialloc_log_di(tp, fbuf, i, XFS_DI_CORE_BITS | XFS_DI_NEXT_UNLINKED); diff --git a/libxfs/xfs_ialloc_btree.c b/libxfs/xfs_ialloc_btree.c index 5d00e9d26..b3f119e86 100644 --- a/libxfs/xfs_ialloc_btree.c +++ b/libxfs/xfs_ialloc_btree.c @@ -176,9 +176,9 @@ xfs_inobt_insrec( return error; } #endif - ovbcopy(&kp[ptr - 1], &kp[ptr], + memmove(&kp[ptr], &kp[ptr - 1], (INT_GET(block->bb_numrecs, ARCH_CONVERT) - ptr + 1) * sizeof(*kp)); - ovbcopy(&pp[ptr - 1], &pp[ptr], + memmove(&pp[ptr], &pp[ptr - 1], (INT_GET(block->bb_numrecs, ARCH_CONVERT) - ptr + 1) * sizeof(*pp)); /* * Now stuff the new data in, bump numrecs and log the new data. @@ -197,7 +197,7 @@ xfs_inobt_insrec( * It's a leaf entry. Make a hole for the new record. */ rp = XFS_INOBT_REC_ADDR(block, 1, cur); - ovbcopy(&rp[ptr - 1], &rp[ptr], + memmove(&rp[ptr], &rp[ptr - 1], (INT_GET(block->bb_numrecs, ARCH_CONVERT) - ptr + 1) * sizeof(*rp)); /* * Now stuff the new record in, bump numrecs @@ -656,12 +656,12 @@ xfs_inobt_lshift( return error; } #endif - ovbcopy(rkp + 1, rkp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rkp)); - ovbcopy(rpp + 1, rpp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rpp)); + memmove(rkp, rkp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rkp)); + memmove(rpp, rpp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rpp)); xfs_inobt_log_keys(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT)); xfs_inobt_log_ptrs(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT)); } else { - ovbcopy(rrp + 1, rrp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rrp)); + memmove(rrp, rrp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rrp)); xfs_inobt_log_recs(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT)); key.ir_startino = rrp->ir_startino; /* INT_: direct copy */ rkp = &key; @@ -907,8 +907,8 @@ xfs_inobt_rshift( return error; } #endif - ovbcopy(rkp, rkp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rkp)); - ovbcopy(rpp, rpp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rpp)); + memmove(rkp + 1, rkp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rkp)); + memmove(rpp + 1, rpp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rpp)); #ifdef DEBUG if ((error = xfs_btree_check_sptr(cur, INT_GET(*lpp, ARCH_CONVERT), level))) return error; @@ -920,7 +920,7 @@ xfs_inobt_rshift( } else { lrp = XFS_INOBT_REC_ADDR(left, INT_GET(left->bb_numrecs, ARCH_CONVERT), cur); rrp = XFS_INOBT_REC_ADDR(right, 1, cur); - ovbcopy(rrp, rrp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rrp)); + memmove(rrp + 1, rrp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rrp)); *rrp = *lrp; xfs_inobt_log_recs(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) + 1); key.ir_startino = rrp->ir_startino; /* INT_: direct copy */ @@ -1048,8 +1048,8 @@ xfs_inobt_split( return error; } #endif - bcopy(lkp, rkp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rkp)); - bcopy(lpp, rpp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rpp)); + memcpy(rkp, lkp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rkp)); + memcpy(rpp, lpp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rpp)); xfs_inobt_log_keys(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT)); xfs_inobt_log_ptrs(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT)); *keyp = *rkp; @@ -1060,7 +1060,7 @@ xfs_inobt_split( else { lrp = XFS_INOBT_REC_ADDR(left, i, cur); rrp = XFS_INOBT_REC_ADDR(right, 1, cur); - bcopy(lrp, rrp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rrp)); + memcpy(rrp, lrp, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rrp)); xfs_inobt_log_recs(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT)); keyp->ir_startino = rrp->ir_startino; /* INT_: direct copy */ } diff --git a/libxfs/xfs_inode.c b/libxfs/xfs_inode.c index e18e41e3b..fcf7ca8ac 100644 --- a/libxfs/xfs_inode.c +++ b/libxfs/xfs_inode.c @@ -369,7 +369,7 @@ xfs_iformat_local( /* * If the size is unreasonable, then something * is wrong and we just bail out rather than crash in - * kmem_alloc() or bcopy() below. + * kmem_alloc() or memcpy() below. */ if (size > XFS_DFORK_SIZE_ARCH(dip, ip->i_mount, whichfork, ARCH_CONVERT)) { xfs_fs_cmn_err(CE_WARN, ip->i_mount, @@ -393,7 +393,8 @@ xfs_iformat_local( ifp->if_bytes = size; ifp->if_real_bytes = real_size; if (size) - bcopy(XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_CONVERT), ifp->if_u1.if_data, size); + memcpy(ifp->if_u1.if_data, + XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_CONVERT), size); ifp->if_flags &= ~XFS_IFEXTENTS; ifp->if_flags |= XFS_IFINLINE; return 0; @@ -426,7 +427,7 @@ xfs_iformat_extents( /* * If the number of extents is unreasonable, then something * is wrong and we just bail out rather than crash in - * kmem_alloc() or bcopy() below. + * kmem_alloc() or memcpy() below. */ if (size < 0 || size > XFS_DFORK_SIZE_ARCH(dip, ip->i_mount, whichfork, ARCH_CONVERT)) { xfs_fs_cmn_err(CE_WARN, ip->i_mount, @@ -452,8 +453,8 @@ xfs_iformat_extents( xfs_validate_extents( (xfs_bmbt_rec_32_t *)XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_CONVERT), nex, XFS_EXTFMT_INODE(ip)); - bcopy(XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_CONVERT), ifp->if_u1.if_extents, - size); + memcpy(ifp->if_u1.if_extents, + XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_CONVERT), size); xfs_bmap_trace_exlist("xfs_iformat_extents", ip, nex, whichfork); if (whichfork != XFS_DATA_FORK || @@ -549,9 +550,9 @@ xfs_xlate_dinode_core(xfs_caddr_t buf, xfs_dinode_core_t *dip, if (arch == ARCH_NOCONVERT) { if (dir>0) { - bcopy((xfs_caddr_t)buf_core, (xfs_caddr_t)mem_core, sizeof(xfs_dinode_core_t)); + memcpy((xfs_caddr_t)mem_core, (xfs_caddr_t)buf_core, sizeof(xfs_dinode_core_t)); } else { - bcopy((xfs_caddr_t)mem_core, (xfs_caddr_t)buf_core, sizeof(xfs_dinode_core_t)); + memcpy((xfs_caddr_t)buf_core, (xfs_caddr_t)mem_core, sizeof(xfs_dinode_core_t)); } return; } @@ -567,9 +568,9 @@ xfs_xlate_dinode_core(xfs_caddr_t buf, xfs_dinode_core_t *dip, INT_XLATE(buf_core->di_projid, mem_core->di_projid, dir, arch); if (dir>0) { - bcopy(buf_core->di_pad, mem_core->di_pad, sizeof(buf_core->di_pad)); + memcpy(mem_core->di_pad, buf_core->di_pad, sizeof(buf_core->di_pad)); } else { - bcopy(mem_core->di_pad, buf_core->di_pad, sizeof(buf_core->di_pad)); + memcpy(buf_core->di_pad, mem_core->di_pad, sizeof(buf_core->di_pad)); } INT_XLATE(buf_core->di_atime.t_sec, mem_core->di_atime.t_sec, dir, arch); @@ -875,7 +876,7 @@ xfs_iroot_realloc( ifp->if_broot_bytes = (int)new_size; ASSERT(ifp->if_broot_bytes <= XFS_IFORK_SIZE(ip, whichfork) + XFS_BROOT_SIZE_ADJ); - ovbcopy(op, np, cur_max * (uint)sizeof(xfs_dfsbno_t)); + memmove(np, op, cur_max * (uint)sizeof(xfs_dfsbno_t)); return; } @@ -897,7 +898,7 @@ xfs_iroot_realloc( /* * First copy over the btree block header. */ - bcopy(ifp->if_broot, new_broot, sizeof(xfs_bmbt_block_t)); + memcpy(new_broot, ifp->if_broot, sizeof(xfs_bmbt_block_t)); } else { new_broot = NULL; ifp->if_flags &= ~XFS_IFBROOT; @@ -914,7 +915,7 @@ xfs_iroot_realloc( ifp->if_broot_bytes); np = (char *)XFS_BMAP_BROOT_REC_ADDR(new_broot, 1, (int)new_size); - bcopy(op, np, new_max * (uint)sizeof(xfs_bmbt_rec_t)); + memcpy(np, op, new_max * (uint)sizeof(xfs_bmbt_rec_t)); /* * Then copy the pointers. @@ -923,7 +924,7 @@ xfs_iroot_realloc( ifp->if_broot_bytes); np = (char *)XFS_BMAP_BROOT_PTR_ADDR(new_broot, 1, (int)new_size); - bcopy(op, np, new_max * (uint)sizeof(xfs_dfsbno_t)); + memcpy(np, op, new_max * (uint)sizeof(xfs_dfsbno_t)); } kmem_free(ifp->if_broot, ifp->if_broot_bytes); ifp->if_broot = new_broot; @@ -986,8 +987,8 @@ xfs_iext_realloc( * so the if_extents pointer is null. */ if (ifp->if_u1.if_extents) { - bcopy(ifp->if_u1.if_extents, - ifp->if_u2.if_inline_ext, new_size); + memcpy(ifp->if_u2.if_inline_ext, + ifp->if_u1.if_extents, new_size); kmem_free(ifp->if_u1.if_extents, ifp->if_real_bytes); } @@ -1004,7 +1005,7 @@ xfs_iext_realloc( if (ifp->if_u1.if_extents == ifp->if_u2.if_inline_ext) { ifp->if_u1.if_extents = (xfs_bmbt_rec_t *) kmem_alloc(rnew_size, KM_SLEEP); - bcopy(ifp->if_u2.if_inline_ext, ifp->if_u1.if_extents, + memcpy(ifp->if_u1.if_extents, ifp->if_u2.if_inline_ext, sizeof(ifp->if_u2.if_inline_ext)); } else if (rnew_size != ifp->if_real_bytes) { ifp->if_u1.if_extents = (xfs_bmbt_rec_t *) @@ -1067,7 +1068,7 @@ xfs_idata_realloc( ifp->if_u1.if_data = ifp->if_u2.if_inline_data; } else if (ifp->if_u1.if_data != ifp->if_u2.if_inline_data) { ASSERT(ifp->if_real_bytes != 0); - bcopy(ifp->if_u1.if_data, ifp->if_u2.if_inline_data, + memcpy(ifp->if_u2.if_inline_data, ifp->if_u1.if_data, new_size); kmem_free(ifp->if_u1.if_data, ifp->if_real_bytes); ifp->if_u1.if_data = ifp->if_u2.if_inline_data; @@ -1100,8 +1101,8 @@ xfs_idata_realloc( } else { ASSERT(ifp->if_real_bytes == 0); ifp->if_u1.if_data = kmem_alloc(real_size, KM_SLEEP); - bcopy(ifp->if_u2.if_inline_data, ifp->if_u1.if_data, - ifp->if_bytes); + memcpy(ifp->if_u1.if_data, ifp->if_u2.if_inline_data, + ifp->if_bytes); } } ifp->if_real_bytes = real_size; @@ -1226,7 +1227,7 @@ xfs_iroundup( * returns the number of bytes copied into the buffer. * * If there are no delayed allocation extents, then we can just - * bcopy() the extents into the buffer. Otherwise, we need to + * memcpy() the extents into the buffer. Otherwise, we need to * examine each extent in turn and skip those which are delayed. */ int @@ -1262,7 +1263,7 @@ xfs_iextents_copy( ASSERT(ifp->if_bytes == (XFS_IFORK_NEXTENTS(ip, whichfork) * (uint)sizeof(xfs_bmbt_rec_t))); - bcopy(ifp->if_u1.if_extents, buffer, ifp->if_bytes); + memcpy(buffer, ifp->if_u1.if_extents, ifp->if_bytes); xfs_validate_extents(buffer, nrecs, XFS_EXTFMT_INODE(ip)); return ifp->if_bytes; } @@ -1351,7 +1352,7 @@ xfs_iflush_fork( (ifp->if_bytes > 0)) { ASSERT(ifp->if_u1.if_data != NULL); ASSERT(ifp->if_bytes <= XFS_IFORK_SIZE(ip, whichfork)); - bcopy(ifp->if_u1.if_data, cp, ifp->if_bytes); + memcpy(cp, ifp->if_u1.if_data, ifp->if_bytes); } if (whichfork == XFS_DATA_FORK) { if (XFS_DIR_SHORTFORM_VALIDATE_ONDISK(mp, dip)) { @@ -1396,7 +1397,7 @@ xfs_iflush_fork( case XFS_DINODE_FMT_UUID: if (iip->ili_format.ilf_fields & XFS_ILOG_UUID) { ASSERT(whichfork == XFS_DATA_FORK); - bcopy(&ip->i_df.if_u2.if_uuid, &dip->di_u.di_muuid, + memcpy(&dip->di_u.di_muuid, &ip->i_df.if_u2.if_uuid, sizeof(uuid_t)); } break; diff --git a/libxfs/xfs_mount.c b/libxfs/xfs_mount.c index 3d2e824d1..2ebd16b3a 100644 --- a/libxfs/xfs_mount.c +++ b/libxfs/xfs_mount.c @@ -204,9 +204,9 @@ xfs_xlatesb( size == 1 || xfs_sb_info[f].type == 1) { if (dir > 0) { - bcopy(buf_ptr + first, mem_ptr + first, size); + memcpy(mem_ptr + first, buf_ptr + first, size); } else { - bcopy(mem_ptr + first, buf_ptr + first, size); + memcpy(buf_ptr + first, mem_ptr + first, size); } } else { switch (size) { diff --git a/libxlog/xfs_log_recover.c b/libxlog/xfs_log_recover.c index 69d3e0f71..d43632134 100644 --- a/libxlog/xfs_log_recover.c +++ b/libxlog/xfs_log_recover.c @@ -670,9 +670,19 @@ xlog_find_tail(xlog_t *log, * overwrite the unmount record after a clean unmount. * * Do this only if we are going to recover the filesystem + * + * NOTE: This used to say "if (!readonly)" + * However on Linux, we can & do recover a read-only filesystem. + * We only skip recovery if NORECOVERY is specified on mount, + * in which case we would not be here. + * + * But... if the -device- itself is readonly, just skip this. + * We can't recover this device anyway, so it won't matter. */ - if (!readonly) + + if (!is_read_only(log->l_mp->m_logdev_targp->pbr_kdev)) { error = xlog_clear_stale_blocks(log, tail_lsn); + } #endif bread_err: @@ -998,7 +1008,7 @@ xlog_recover_add_item(xlog_recover_item_t **itemq) * will appear in the current log item. */ STATIC int -xlog_recover_add_to_trans(xlog_recover_t *trans, + xlog_recover_add_to_trans(xlog_recover_t *trans, xfs_caddr_t dp, int len) { @@ -1009,7 +1019,7 @@ xlog_recover_add_to_trans(xlog_recover_t *trans, if (!len) return 0; ptr = kmem_zalloc(len, 0); - bcopy(dp, ptr, len); + memcpy(ptr, dp, len); in_f = (xfs_inode_log_format_t *)ptr; item = trans->r_itemq; @@ -1017,7 +1027,7 @@ xlog_recover_add_to_trans(xlog_recover_t *trans, ASSERT(*(uint *)dp == XFS_TRANS_HEADER_MAGIC); if (len == sizeof(xfs_trans_header_t)) xlog_recover_add_item(&trans->r_itemq); - bcopy(dp, &trans->r_theader, len); /* s, d, l */ + memcpy(&trans->r_theader, dp, len); /* d, s, l */ return 0; } if (item->ri_prev->ri_total != 0 && @@ -1055,7 +1065,7 @@ xlog_recover_add_to_cont_trans(xlog_recover_t *trans, /* finish copying rest of trans header */ xlog_recover_add_item(&trans->r_itemq); ptr = (xfs_caddr_t)&trans->r_theader+sizeof(xfs_trans_header_t)-len; - bcopy(dp, ptr, len); /* s, d, l */ + memcpy(ptr, dp, len); /* d, s, l */ return 0; } item = item->ri_prev; @@ -1064,7 +1074,7 @@ xlog_recover_add_to_cont_trans(xlog_recover_t *trans, old_len = item->ri_buf[item->ri_cnt-1].i_len; ptr = kmem_realloc(old_ptr, len+old_len, old_len, 0); - bcopy(dp , &ptr[old_len], len); /* s, d, l */ + memcpy(&ptr[old_len], dp, len); /* d, s, l */ item->ri_buf[item->ri_cnt-1].i_len += len; item->ri_buf[item->ri_cnt-1].i_addr = ptr; return 0; @@ -1238,7 +1248,7 @@ xlog_do_recovery_pass(xlog_t *log, return ENOMEM; } - bzero(rhash, sizeof(rhash)); + memset(rhash, 0, sizeof(rhash)); if (tail_blk <= head_blk) { for (blk_no = tail_blk; blk_no < head_blk; ) { if ((error = xlog_bread(log, blk_no, hblks, hbp))) -- 2.39.5