diff options
author | наб <[email protected]> | 2022-02-25 14:26:54 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2022-03-15 15:13:42 -0700 |
commit | 861166b02701dfc8f63a105bd32758e806c84fd7 (patch) | |
tree | 1f9341513470b4615ca340c40ad087101c7dcf24 /module/zfs/dbuf.c | |
parent | 1d77d62f5a77cab85d4b98ecf72a9838f70d6bf1 (diff) |
Remove bcopy(), bzero(), bcmp()
bcopy() has a confusing argument order and is actually a move, not a
copy; they're all deprecated since POSIX.1-2001 and removed in -2008,
and we shim them out to mem*() on Linux anyway
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes #12996
Diffstat (limited to 'module/zfs/dbuf.c')
-rw-r--r-- | module/zfs/dbuf.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index cb2b7e5a1..c32843141 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -280,7 +280,7 @@ dbuf_cons(void *vdb, void *unused, int kmflag) { (void) unused, (void) kmflag; dmu_buf_impl_t *db = vdb; - bzero(db, sizeof (dmu_buf_impl_t)); + memset(db, 0, sizeof (dmu_buf_impl_t)); mutex_init(&db->db_mtx, NULL, MUTEX_DEFAULT, NULL); rw_init(&db->db_rwlock, NULL, RW_DEFAULT, NULL); @@ -1235,7 +1235,7 @@ dbuf_loan_arcbuf(dmu_buf_impl_t *db) mutex_exit(&db->db_mtx); abuf = arc_loan_buf(spa, B_FALSE, blksz); - bcopy(db->db.db_data, abuf->b_data, blksz); + memcpy(abuf->b_data, db->db.db_data, blksz); } else { abuf = db->db_buf; arc_loan_inuse_buf(abuf, db); @@ -1356,7 +1356,7 @@ dbuf_read_done(zio_t *zio, const zbookmark_phys_t *zb, const blkptr_t *bp, /* freed in flight */ ASSERT(zio == NULL || zio->io_error == 0); arc_release(buf, db); - bzero(buf->b_data, db->db.db_size); + memset(buf->b_data, 0, db->db.db_size); arc_buf_freeze(buf); db->db_freed_in_flight = FALSE; dbuf_set_data(db, buf); @@ -1395,9 +1395,9 @@ dbuf_read_bonus(dmu_buf_impl_t *db, dnode_t *dn, uint32_t flags) db->db.db_data = kmem_alloc(max_bonuslen, KM_SLEEP); arc_space_consume(max_bonuslen, ARC_SPACE_BONUS); if (bonuslen < max_bonuslen) - bzero(db->db.db_data, max_bonuslen); + memset(db->db.db_data, 0, max_bonuslen); if (bonuslen) - bcopy(DN_BONUS(dn->dn_phys), db->db.db_data, bonuslen); + memcpy(db->db.db_data, DN_BONUS(dn->dn_phys), bonuslen); db->db_state = DB_CACHED; DTRACE_SET_STATE(db, "bonus buffer filled"); return (0); @@ -1446,7 +1446,7 @@ dbuf_read_hole(dmu_buf_impl_t *db, dnode_t *dn) if (is_hole) { dbuf_set_data(db, dbuf_alloc_arcbuf(db)); - bzero(db->db.db_data, db->db.db_size); + memset(db->db.db_data, 0, db->db.db_size); if (db->db_blkptr != NULL && db->db_level > 0 && BP_IS_HOLE(db->db_blkptr) && @@ -1657,7 +1657,7 @@ dbuf_fix_old_data(dmu_buf_impl_t *db, uint64_t txg) int bonuslen = DN_SLOTS_TO_BONUSLEN(dn->dn_num_slots); dr->dt.dl.dr_data = kmem_alloc(bonuslen, KM_SLEEP); arc_space_consume(bonuslen, ARC_SPACE_BONUS); - bcopy(db->db.db_data, dr->dt.dl.dr_data, bonuslen); + memcpy(dr->dt.dl.dr_data, db->db.db_data, bonuslen); } else if (zfs_refcount_count(&db->db_holds) > db->db_dirtycnt) { dnode_t *dn = DB_DNODE(db); int size = arc_buf_size(db->db_buf); @@ -1687,7 +1687,7 @@ dbuf_fix_old_data(dmu_buf_impl_t *db, uint64_t txg) } else { dr->dt.dl.dr_data = arc_alloc_buf(spa, db, type, size); } - bcopy(db->db.db_data, dr->dt.dl.dr_data->b_data, size); + memcpy(dr->dt.dl.dr_data->b_data, db->db.db_data, size); } else { db->db_buf = NULL; dbuf_clear_data(db); @@ -1985,7 +1985,7 @@ dbuf_free_range(dnode_t *dn, uint64_t start_blkid, uint64_t end_blkid, ASSERT(db->db.db_data != NULL); arc_release(db->db_buf, db); rw_enter(&db->db_rwlock, RW_WRITER); - bzero(db->db.db_data, db->db.db_size); + memset(db->db.db_data, 0, db->db.db_size); rw_exit(&db->db_rwlock); arc_buf_freeze(db->db_buf); } @@ -2022,10 +2022,10 @@ dbuf_new_size(dmu_buf_impl_t *db, int size, dmu_tx_t *tx) /* copy old block data to the new block */ old_buf = db->db_buf; - bcopy(old_buf->b_data, buf->b_data, MIN(osize, size)); + memcpy(buf->b_data, old_buf->b_data, MIN(osize, size)); /* zero the remainder */ if (size > osize) - bzero((uint8_t *)buf->b_data + osize, size - osize); + memset((uint8_t *)buf->b_data + osize, 0, size - osize); mutex_enter(&db->db_mtx); dbuf_set_data(db, buf); @@ -2655,9 +2655,9 @@ dmu_buf_set_crypt_params(dmu_buf_t *db_fake, boolean_t byteorder, dr->dt.dl.dr_has_raw_params = B_TRUE; dr->dt.dl.dr_byteorder = byteorder; - bcopy(salt, dr->dt.dl.dr_salt, ZIO_DATA_SALT_LEN); - bcopy(iv, dr->dt.dl.dr_iv, ZIO_DATA_IV_LEN); - bcopy(mac, dr->dt.dl.dr_mac, ZIO_DATA_MAC_LEN); + memcpy(dr->dt.dl.dr_salt, salt, ZIO_DATA_SALT_LEN); + memcpy(dr->dt.dl.dr_iv, iv, ZIO_DATA_IV_LEN); + memcpy(dr->dt.dl.dr_mac, mac, ZIO_DATA_MAC_LEN); } static void @@ -2690,7 +2690,7 @@ dmu_buf_fill_done(dmu_buf_t *dbuf, dmu_tx_t *tx) ASSERT(db->db_blkid != DMU_BONUS_BLKID); /* we were freed while filling */ /* XXX dbuf_undirty? */ - bzero(db->db.db_data, db->db.db_size); + memset(db->db.db_data, 0, db->db.db_size); db->db_freed_in_flight = FALSE; DTRACE_SET_STATE(db, "fill done handling freed in flight"); @@ -2802,7 +2802,7 @@ dbuf_assign_arcbuf(dmu_buf_impl_t *db, arc_buf_t *buf, dmu_tx_t *tx) ASSERT(!arc_is_encrypted(buf)); mutex_exit(&db->db_mtx); (void) dbuf_dirty(db, tx); - bcopy(buf->b_data, db->db.db_data, db->db.db_size); + memcpy(db->db.db_data, buf->b_data, db->db.db_size); arc_buf_destroy(buf, db); return; } @@ -3516,7 +3516,7 @@ dbuf_hold_copy(dnode_t *dn, dmu_buf_impl_t *db) } rw_enter(&db->db_rwlock, RW_WRITER); - bcopy(data->b_data, db->db.db_data, arc_buf_size(data)); + memcpy(db->db.db_data, data->b_data, arc_buf_size(data)); rw_exit(&db->db_rwlock); } @@ -4040,7 +4040,7 @@ dbuf_sync_bonus(dbuf_dirty_record_t *dr, dmu_tx_t *tx) dnode_t *dn = dr->dr_dnode; ASSERT3U(DN_MAX_BONUS_LEN(dn->dn_phys), <=, DN_SLOTS_TO_BONUSLEN(dn->dn_phys->dn_extra_slots + 1)); - bcopy(data, DN_BONUS(dn->dn_phys), DN_MAX_BONUS_LEN(dn->dn_phys)); + memcpy(DN_BONUS(dn->dn_phys), data, DN_MAX_BONUS_LEN(dn->dn_phys)); dbuf_sync_leaf_verify_bonus_dnode(dr); @@ -4460,7 +4460,7 @@ dbuf_sync_leaf(dbuf_dirty_record_t *dr, dmu_tx_t *tx) } else { *datap = arc_alloc_buf(os->os_spa, db, type, psize); } - bcopy(db->db.db_data, (*datap)->b_data, psize); + memcpy((*datap)->b_data, db->db.db_data, psize); } db->db_data_pending = dr; @@ -4640,7 +4640,7 @@ dbuf_write_children_ready(zio_t *zio, arc_buf_t *buf, void *vdb) * zero out. */ rw_enter(&db->db_rwlock, RW_WRITER); - bzero(db->db.db_data, db->db.db_size); + memset(db->db.db_data, 0, db->db.db_size); rw_exit(&db->db_rwlock); } DB_DNODE_EXIT(db); |