mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
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 <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #12996
This commit is contained in:
@@ -63,7 +63,7 @@ bench_fini_raidz_maps(void)
|
||||
{
|
||||
/* tear down golden zio */
|
||||
raidz_free(zio_bench.io_abd, max_data_size);
|
||||
bzero(&zio_bench, sizeof (zio_t));
|
||||
memset(&zio_bench, 0, sizeof (zio_t));
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
||||
@@ -141,10 +141,9 @@ static void process_options(int argc, char **argv)
|
||||
{
|
||||
size_t value;
|
||||
int opt;
|
||||
|
||||
raidz_test_opts_t *o = &rto_opts;
|
||||
|
||||
bcopy(&rto_opts_defaults, o, sizeof (*o));
|
||||
memcpy(o, &rto_opts_defaults, sizeof (*o));
|
||||
|
||||
while ((opt = getopt(argc, argv, "TDBSvha:er:o:d:s:t:")) != -1) {
|
||||
value = 0;
|
||||
|
||||
@@ -92,19 +92,19 @@ static inline size_t ilog2(size_t a)
|
||||
}
|
||||
|
||||
|
||||
#define LOG(lvl, a...) \
|
||||
#define LOG(lvl, ...) \
|
||||
{ \
|
||||
if (rto_opts.rto_v >= lvl) \
|
||||
(void) fprintf(stdout, a); \
|
||||
(void) fprintf(stdout, __VA_ARGS__); \
|
||||
} \
|
||||
|
||||
#define LOG_OPT(lvl, opt, a...) \
|
||||
#define LOG_OPT(lvl, opt, ...) \
|
||||
{ \
|
||||
if (opt->rto_v >= lvl) \
|
||||
(void) fprintf(stdout, a); \
|
||||
(void) fprintf(stdout, __VA_ARGS__); \
|
||||
} \
|
||||
|
||||
#define ERR(a...) (void) fprintf(stderr, a)
|
||||
#define ERR(...) (void) fprintf(stderr, __VA_ARGS__)
|
||||
|
||||
|
||||
#define DBLSEP "================\n"
|
||||
|
||||
+13
-28
@@ -2035,11 +2035,8 @@ dump_ddt(ddt_t *ddt, enum ddt_type type, enum ddt_class class)
|
||||
static void
|
||||
dump_all_ddts(spa_t *spa)
|
||||
{
|
||||
ddt_histogram_t ddh_total;
|
||||
ddt_stat_t dds_total;
|
||||
|
||||
bzero(&ddh_total, sizeof (ddh_total));
|
||||
bzero(&dds_total, sizeof (dds_total));
|
||||
ddt_histogram_t ddh_total = {{{0}}};
|
||||
ddt_stat_t dds_total = {0};
|
||||
|
||||
for (enum zio_checksum c = 0; c < ZIO_CHECKSUM_FUNCTIONS; c++) {
|
||||
ddt_t *ddt = spa->spa_ddt[c];
|
||||
@@ -4360,7 +4357,7 @@ dump_l2arc_log_blocks(int fd, l2arc_dev_hdr_phys_t l2dhdr,
|
||||
|
||||
if (!dump_opt['q'])
|
||||
print_l2arc_log_blocks();
|
||||
bcopy((&l2dhdr)->dh_start_lbps, lbps, sizeof (lbps));
|
||||
memcpy(lbps, l2dhdr.dh_start_lbps, sizeof (lbps));
|
||||
|
||||
dev.l2ad_evict = l2dhdr.dh_evict;
|
||||
dev.l2ad_start = l2dhdr.dh_start;
|
||||
@@ -4460,12 +4457,9 @@ dump_l2arc_log_blocks(int fd, l2arc_dev_hdr_phys_t l2dhdr,
|
||||
static int
|
||||
dump_l2arc_header(int fd)
|
||||
{
|
||||
l2arc_dev_hdr_phys_t l2dhdr, rebuild;
|
||||
l2arc_dev_hdr_phys_t l2dhdr = {0}, rebuild = {0};
|
||||
int error = B_FALSE;
|
||||
|
||||
bzero(&l2dhdr, sizeof (l2dhdr));
|
||||
bzero(&rebuild, sizeof (rebuild));
|
||||
|
||||
if (pread64(fd, &l2dhdr, sizeof (l2dhdr),
|
||||
VDEV_LABEL_START_SIZE) != sizeof (l2dhdr)) {
|
||||
error = B_TRUE;
|
||||
@@ -4820,7 +4814,7 @@ static int
|
||||
dump_label(const char *dev)
|
||||
{
|
||||
char path[MAXPATHLEN];
|
||||
zdb_label_t labels[VDEV_LABELS];
|
||||
zdb_label_t labels[VDEV_LABELS] = {{{{0}}}};
|
||||
uint64_t psize, ashift, l2cache;
|
||||
struct stat64 statbuf;
|
||||
boolean_t config_found = B_FALSE;
|
||||
@@ -4831,8 +4825,6 @@ dump_label(const char *dev)
|
||||
void *node, *cookie;
|
||||
int fd;
|
||||
|
||||
bzero(labels, sizeof (labels));
|
||||
|
||||
/*
|
||||
* Check if we were given absolute path and use it as is.
|
||||
* Otherwise if the provided vdev name doesn't point to a file,
|
||||
@@ -5746,14 +5738,13 @@ zdb_load_obsolete_counts(vdev_t *vd)
|
||||
static void
|
||||
zdb_ddt_leak_init(spa_t *spa, zdb_cb_t *zcb)
|
||||
{
|
||||
ddt_bookmark_t ddb;
|
||||
ddt_bookmark_t ddb = {0};
|
||||
ddt_entry_t dde;
|
||||
int error;
|
||||
int p;
|
||||
|
||||
ASSERT(!dump_opt['L']);
|
||||
|
||||
bzero(&ddb, sizeof (ddb));
|
||||
while ((error = ddt_walk(spa, &ddb, &dde)) == 0) {
|
||||
blkptr_t blk;
|
||||
ddt_phys_t *ddp = dde.dde_phys;
|
||||
@@ -6413,7 +6404,7 @@ deleted_livelists_dump_mos(spa_t *spa)
|
||||
static int
|
||||
dump_block_stats(spa_t *spa)
|
||||
{
|
||||
zdb_cb_t zcb;
|
||||
zdb_cb_t zcb = {{{{0}}}};
|
||||
zdb_blkstats_t *zb, *tzb;
|
||||
uint64_t norm_alloc, norm_space, total_alloc, total_found;
|
||||
int flags = TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA |
|
||||
@@ -6422,7 +6413,6 @@ dump_block_stats(spa_t *spa)
|
||||
int e, c, err;
|
||||
bp_embedded_type_t i;
|
||||
|
||||
bzero(&zcb, sizeof (zcb));
|
||||
(void) printf("\nTraversing all blocks %s%s%s%s%s...\n\n",
|
||||
(dump_opt['c'] || !dump_opt['L']) ? "to verify " : "",
|
||||
(dump_opt['c'] == 1) ? "metadata " : "",
|
||||
@@ -6442,7 +6432,6 @@ dump_block_stats(spa_t *spa)
|
||||
* pool claiming each block we discover, but we skip opening any space
|
||||
* maps.
|
||||
*/
|
||||
bzero(&zcb, sizeof (zdb_cb_t));
|
||||
zdb_leak_init(spa, &zcb);
|
||||
|
||||
/*
|
||||
@@ -6815,11 +6804,9 @@ dump_simulated_ddt(spa_t *spa)
|
||||
avl_tree_t t;
|
||||
void *cookie = NULL;
|
||||
zdb_ddt_entry_t *zdde;
|
||||
ddt_histogram_t ddh_total;
|
||||
ddt_stat_t dds_total;
|
||||
ddt_histogram_t ddh_total = {{{0}}};
|
||||
ddt_stat_t dds_total = {0};
|
||||
|
||||
bzero(&ddh_total, sizeof (ddh_total));
|
||||
bzero(&dds_total, sizeof (dds_total));
|
||||
avl_create(&t, ddt_entry_compare,
|
||||
sizeof (zdb_ddt_entry_t), offsetof(zdb_ddt_entry_t, zdde_node));
|
||||
|
||||
@@ -7654,8 +7641,7 @@ dump_log_spacemap_obsolete_stats(spa_t *spa)
|
||||
if (!spa_feature_is_active(spa, SPA_FEATURE_LOG_SPACEMAP))
|
||||
return;
|
||||
|
||||
log_sm_obsolete_stats_arg_t lsos;
|
||||
bzero(&lsos, sizeof (lsos));
|
||||
log_sm_obsolete_stats_arg_t lsos = {0};
|
||||
|
||||
(void) printf("Log Space Map Obsolete Entry Statistics:\n");
|
||||
|
||||
@@ -8050,7 +8036,7 @@ zdb_decompress_block(abd_t *pabd, void *buf, void *lbuf, uint64_t lsize,
|
||||
lbuf, psize, lsize, NULL) == 0 &&
|
||||
zio_decompress_data(*cfuncp, pabd,
|
||||
lbuf2, psize, lsize, NULL) == 0 &&
|
||||
bcmp(lbuf, lbuf2, lsize) == 0)
|
||||
memcmp(lbuf, lbuf2, lsize) == 0)
|
||||
break;
|
||||
}
|
||||
if (*cfuncp != 0)
|
||||
@@ -8368,12 +8354,11 @@ done:
|
||||
static void
|
||||
zdb_embedded_block(char *thing)
|
||||
{
|
||||
blkptr_t bp;
|
||||
blkptr_t bp = {{{{0}}}};
|
||||
unsigned long long *words = (void *)&bp;
|
||||
char *buf;
|
||||
int err;
|
||||
|
||||
bzero(&bp, sizeof (bp));
|
||||
err = sscanf(thing, "%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx:"
|
||||
"%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx",
|
||||
words + 0, words + 1, words + 2, words + 3,
|
||||
@@ -8566,7 +8551,7 @@ main(int argc, char **argv)
|
||||
} else {
|
||||
char **tmp = umem_alloc((nsearch + 1) *
|
||||
sizeof (char *), UMEM_NOFAIL);
|
||||
bcopy(searchdirs, tmp, nsearch *
|
||||
memcpy(tmp, searchdirs, nsearch *
|
||||
sizeof (char *));
|
||||
umem_free(searchdirs,
|
||||
nsearch * sizeof (char *));
|
||||
|
||||
@@ -485,7 +485,7 @@ fmd_buf_read(fmd_hdl_t *hdl, fmd_case_t *cp,
|
||||
assert(cp->ci_bufptr != NULL);
|
||||
assert(size <= cp->ci_bufsiz);
|
||||
|
||||
bcopy(cp->ci_bufptr, buf, size);
|
||||
memcpy(buf, cp->ci_bufptr, size);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -497,7 +497,7 @@ fmd_buf_write(fmd_hdl_t *hdl, fmd_case_t *cp,
|
||||
assert(cp->ci_bufptr != NULL);
|
||||
assert(cp->ci_bufsiz >= size);
|
||||
|
||||
bcopy(buf, cp->ci_bufptr, size);
|
||||
memcpy(cp->ci_bufptr, buf, size);
|
||||
}
|
||||
|
||||
/* SERD Engines */
|
||||
@@ -581,7 +581,7 @@ _timer_notify(union sigval sv)
|
||||
fmd_hdl_debug(hdl, "timer fired (%p)", ftp->ft_tid);
|
||||
|
||||
/* disarm the timer */
|
||||
bzero(&its, sizeof (struct itimerspec));
|
||||
memset(&its, 0, sizeof (struct itimerspec));
|
||||
timer_settime(ftp->ft_tid, 0, &its, NULL);
|
||||
|
||||
/* Note that the fmdo_timeout can remove this timer */
|
||||
|
||||
@@ -74,7 +74,7 @@ fmd_serd_eng_alloc(const char *name, uint64_t n, hrtime_t t)
|
||||
fmd_serd_eng_t *sgp;
|
||||
|
||||
sgp = malloc(sizeof (fmd_serd_eng_t));
|
||||
bzero(sgp, sizeof (fmd_serd_eng_t));
|
||||
memset(sgp, 0, sizeof (fmd_serd_eng_t));
|
||||
|
||||
sgp->sg_name = strdup(name);
|
||||
sgp->sg_flags = FMD_SERD_DIRTY;
|
||||
@@ -139,7 +139,7 @@ fmd_serd_hash_destroy(fmd_serd_hash_t *shp)
|
||||
}
|
||||
|
||||
free(shp->sh_hash);
|
||||
bzero(shp, sizeof (fmd_serd_hash_t));
|
||||
memset(shp, 0, sizeof (fmd_serd_hash_t));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
+5
-5
@@ -2037,7 +2037,7 @@ zfs_do_get(int argc, char **argv)
|
||||
* Process the set of columns to display. We zero out
|
||||
* the structure to give us a blank slate.
|
||||
*/
|
||||
bzero(&cb.cb_columns, sizeof (cb.cb_columns));
|
||||
memset(&cb.cb_columns, 0, sizeof (cb.cb_columns));
|
||||
i = 0;
|
||||
while (*optarg != '\0') {
|
||||
static char *col_subopts[] =
|
||||
@@ -5104,7 +5104,7 @@ deleg_perm_compare(const void *larg, const void *rarg, void *unused)
|
||||
static inline void
|
||||
fs_perm_set_init(fs_perm_set_t *fspset)
|
||||
{
|
||||
bzero(fspset, sizeof (fs_perm_set_t));
|
||||
memset(fspset, 0, sizeof (fs_perm_set_t));
|
||||
|
||||
if ((fspset->fsps_list_pool = uu_list_pool_create("fsps_list_pool",
|
||||
sizeof (fs_perm_node_t), offsetof(fs_perm_node_t, fspn_list_node),
|
||||
@@ -5171,7 +5171,7 @@ who_perm_init(who_perm_t *who_perm, fs_perm_t *fsperm,
|
||||
uu_avl_pool_t *pool;
|
||||
pool = fsperm->fsp_set->fsps_deleg_perm_avl_pool;
|
||||
|
||||
bzero(who_perm, sizeof (who_perm_t));
|
||||
memset(who_perm, 0, sizeof (who_perm_t));
|
||||
|
||||
if ((who_perm->who_deleg_perm_avl = uu_avl_create(pool, NULL,
|
||||
UU_DEFAULT)) == NULL)
|
||||
@@ -5205,7 +5205,7 @@ fs_perm_init(fs_perm_t *fsperm, fs_perm_set_t *fspset, const char *fsname)
|
||||
uu_avl_pool_t *nset_pool = fspset->fsps_named_set_avl_pool;
|
||||
uu_avl_pool_t *who_pool = fspset->fsps_who_perm_avl_pool;
|
||||
|
||||
bzero(fsperm, sizeof (fs_perm_t));
|
||||
memset(fsperm, 0, sizeof (fs_perm_t));
|
||||
|
||||
if ((fsperm->fsp_sc_avl = uu_avl_create(nset_pool, NULL, UU_DEFAULT))
|
||||
== NULL)
|
||||
@@ -8508,7 +8508,7 @@ zfs_do_wait(int argc, char **argv)
|
||||
char *value;
|
||||
|
||||
/* Reset activities array */
|
||||
bzero(&enabled, sizeof (enabled));
|
||||
memset(&enabled, 0, sizeof (enabled));
|
||||
while (*optarg != '\0') {
|
||||
int activity = getsubopt(&optarg, col_subopts,
|
||||
&value);
|
||||
|
||||
+2
-5
@@ -484,15 +484,12 @@ zhack_repair_label_cksum(int argc, char **argv)
|
||||
zio_checksum_info_t *ci = &zio_checksum_table[ZIO_CHECKSUM_LABEL];
|
||||
const char *cfg_keys[] = { ZPOOL_CONFIG_VERSION,
|
||||
ZPOOL_CONFIG_POOL_STATE, ZPOOL_CONFIG_GUID };
|
||||
boolean_t labels_repaired[VDEV_LABELS];
|
||||
boolean_t labels_repaired[VDEV_LABELS] = {0};
|
||||
boolean_t repaired = B_FALSE;
|
||||
vdev_label_t labels[VDEV_LABELS];
|
||||
vdev_label_t labels[VDEV_LABELS] = {{{0}}};
|
||||
struct stat st;
|
||||
int fd;
|
||||
|
||||
bzero(labels_repaired, sizeof (labels_repaired));
|
||||
bzero(labels, sizeof (labels));
|
||||
|
||||
abd_init();
|
||||
|
||||
argc -= 1;
|
||||
|
||||
@@ -10097,7 +10097,7 @@ zpool_do_get(int argc, char **argv)
|
||||
cb.cb_scripted = B_TRUE;
|
||||
break;
|
||||
case 'o':
|
||||
bzero(&cb.cb_columns, sizeof (cb.cb_columns));
|
||||
memset(&cb.cb_columns, 0, sizeof (cb.cb_columns));
|
||||
i = 0;
|
||||
while (*optarg != '\0') {
|
||||
static char *col_subopts[] =
|
||||
@@ -10714,7 +10714,7 @@ zpool_do_wait(int argc, char **argv)
|
||||
"scrub", "trim", NULL };
|
||||
|
||||
/* Reset activities array */
|
||||
bzero(&wd.wd_enabled, sizeof (wd.wd_enabled));
|
||||
memset(&wd.wd_enabled, 0, sizeof (wd.wd_enabled));
|
||||
while (*optarg != '\0') {
|
||||
int activity = getsubopt(&optarg, col_subopts,
|
||||
&value);
|
||||
|
||||
@@ -229,7 +229,7 @@ zfs_redup_stream(int infd, int outfd, boolean_t verbose)
|
||||
* We need to regenerate the checksum.
|
||||
*/
|
||||
if (drr->drr_type != DRR_BEGIN) {
|
||||
bzero(&drr->drr_u.drr_checksum.drr_checksum,
|
||||
memset(&drr->drr_u.drr_checksum.drr_checksum, 0,
|
||||
sizeof (drr->drr_u.drr_checksum.drr_checksum));
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ zfs_redup_stream(int infd, int outfd, boolean_t verbose)
|
||||
* a checksum.
|
||||
*/
|
||||
if (drr->drr_type != DRR_BEGIN) {
|
||||
bzero(&drr->drr_u.drr_checksum.drr_checksum,
|
||||
memset(&drr->drr_u.drr_checksum.drr_checksum, 0,
|
||||
sizeof (drr->drr_u.drr_checksum.drr_checksum));
|
||||
}
|
||||
if (dump_record(drr, buf, payload_size,
|
||||
|
||||
+40
-39
@@ -930,9 +930,9 @@ process_options(int argc, char **argv)
|
||||
int opt;
|
||||
uint64_t value;
|
||||
char altdir[MAXNAMELEN] = { 0 };
|
||||
char raid_kind[8] = { "random" };
|
||||
char raid_kind[8] = "random";
|
||||
|
||||
bcopy(&ztest_opts_defaults, zo, sizeof (*zo));
|
||||
memcpy(zo, &ztest_opts_defaults, sizeof (*zo));
|
||||
|
||||
init_options();
|
||||
|
||||
@@ -1887,7 +1887,7 @@ ztest_log_create(ztest_ds_t *zd, dmu_tx_t *tx, lr_create_t *lr)
|
||||
return;
|
||||
|
||||
itx = zil_itx_create(TX_CREATE, sizeof (*lr) + namesize);
|
||||
bcopy(&lr->lr_common + 1, &itx->itx_lr + 1,
|
||||
memcpy(&itx->itx_lr + 1, &lr->lr_common + 1,
|
||||
sizeof (*lr) + namesize - sizeof (lr_t));
|
||||
|
||||
zil_itx_assign(zd->zd_zilog, itx, tx);
|
||||
@@ -1904,7 +1904,7 @@ ztest_log_remove(ztest_ds_t *zd, dmu_tx_t *tx, lr_remove_t *lr, uint64_t object)
|
||||
return;
|
||||
|
||||
itx = zil_itx_create(TX_REMOVE, sizeof (*lr) + namesize);
|
||||
bcopy(&lr->lr_common + 1, &itx->itx_lr + 1,
|
||||
memcpy(&itx->itx_lr + 1, &lr->lr_common + 1,
|
||||
sizeof (*lr) + namesize - sizeof (lr_t));
|
||||
|
||||
itx->itx_oid = object;
|
||||
@@ -1937,7 +1937,7 @@ ztest_log_write(ztest_ds_t *zd, dmu_tx_t *tx, lr_write_t *lr)
|
||||
itx->itx_wr_state = write_state;
|
||||
itx->itx_sync = (ztest_random(8) == 0);
|
||||
|
||||
bcopy(&lr->lr_common + 1, &itx->itx_lr + 1,
|
||||
memcpy(&itx->itx_lr + 1, &lr->lr_common + 1,
|
||||
sizeof (*lr) - sizeof (lr_t));
|
||||
|
||||
zil_itx_assign(zd->zd_zilog, itx, tx);
|
||||
@@ -1952,7 +1952,7 @@ ztest_log_truncate(ztest_ds_t *zd, dmu_tx_t *tx, lr_truncate_t *lr)
|
||||
return;
|
||||
|
||||
itx = zil_itx_create(TX_TRUNCATE, sizeof (*lr));
|
||||
bcopy(&lr->lr_common + 1, &itx->itx_lr + 1,
|
||||
memcpy(&itx->itx_lr + 1, &lr->lr_common + 1,
|
||||
sizeof (*lr) - sizeof (lr_t));
|
||||
|
||||
itx->itx_sync = B_FALSE;
|
||||
@@ -1968,7 +1968,7 @@ ztest_log_setattr(ztest_ds_t *zd, dmu_tx_t *tx, lr_setattr_t *lr)
|
||||
return;
|
||||
|
||||
itx = zil_itx_create(TX_SETATTR, sizeof (*lr));
|
||||
bcopy(&lr->lr_common + 1, &itx->itx_lr + 1,
|
||||
memcpy(&itx->itx_lr + 1, &lr->lr_common + 1,
|
||||
sizeof (*lr) - sizeof (lr_t));
|
||||
|
||||
itx->itx_sync = B_FALSE;
|
||||
@@ -2233,7 +2233,7 @@ ztest_replay_write(void *arg1, void *arg2, boolean_t byteswap)
|
||||
if (abuf == NULL) {
|
||||
dmu_write(os, lr->lr_foid, offset, length, data, tx);
|
||||
} else {
|
||||
bcopy(data, abuf->b_data, length);
|
||||
memcpy(abuf->b_data, data, length);
|
||||
dmu_assign_arcbuf_by_dbuf(db, offset, abuf, tx);
|
||||
}
|
||||
|
||||
@@ -2506,7 +2506,7 @@ ztest_lr_alloc(size_t lrsize, char *name)
|
||||
lr = umem_zalloc(lrsize + namesize, UMEM_NOFAIL);
|
||||
|
||||
if (name)
|
||||
bcopy(name, lr + lrsize, namesize);
|
||||
memcpy(lr + lrsize, name, namesize);
|
||||
|
||||
return (lr);
|
||||
}
|
||||
@@ -2663,7 +2663,7 @@ ztest_write(ztest_ds_t *zd, uint64_t object, uint64_t offset, uint64_t size,
|
||||
lr->lr_blkoff = 0;
|
||||
BP_ZERO(&lr->lr_blkptr);
|
||||
|
||||
bcopy(data, lr + 1, size);
|
||||
memcpy(lr + 1, data, size);
|
||||
|
||||
error = ztest_replay_write(zd, lr, B_FALSE);
|
||||
|
||||
@@ -2787,7 +2787,7 @@ ztest_io(ztest_ds_t *zd, uint64_t object, uint64_t offset)
|
||||
break;
|
||||
|
||||
case ZTEST_IO_WRITE_ZEROES:
|
||||
bzero(data, blocksize);
|
||||
memset(data, 0, blocksize);
|
||||
(void) ztest_write(zd, object, offset, blocksize, data);
|
||||
break;
|
||||
|
||||
@@ -4844,16 +4844,16 @@ ztest_dmu_read_write(ztest_ds_t *zd, uint64_t id)
|
||||
"got %"PRIx64", wanted %"PRIx64"+%"PRIx64"",
|
||||
pack->bw_index, n, i);
|
||||
|
||||
if (bcmp(pack, bigH, sizeof (bufwad_t)) != 0)
|
||||
if (memcmp(pack, bigH, sizeof (bufwad_t)) != 0)
|
||||
fatal(B_FALSE, "pack/bigH mismatch in %p/%p",
|
||||
pack, bigH);
|
||||
|
||||
if (bcmp(pack, bigT, sizeof (bufwad_t)) != 0)
|
||||
if (memcmp(pack, bigT, sizeof (bufwad_t)) != 0)
|
||||
fatal(B_FALSE, "pack/bigT mismatch in %p/%p",
|
||||
pack, bigT);
|
||||
|
||||
if (freeit) {
|
||||
bzero(pack, sizeof (bufwad_t));
|
||||
memset(pack, 0, sizeof (bufwad_t));
|
||||
} else {
|
||||
pack->bw_index = n + i;
|
||||
pack->bw_txg = txg;
|
||||
@@ -4899,8 +4899,8 @@ ztest_dmu_read_write(ztest_ds_t *zd, uint64_t id)
|
||||
VERIFY0(dmu_read(os, bigobj, bigoff,
|
||||
bigsize, bigcheck, DMU_READ_PREFETCH));
|
||||
|
||||
ASSERT0(bcmp(packbuf, packcheck, packsize));
|
||||
ASSERT0(bcmp(bigbuf, bigcheck, bigsize));
|
||||
ASSERT0(memcmp(packbuf, packcheck, packsize));
|
||||
ASSERT0(memcmp(bigbuf, bigcheck, bigsize));
|
||||
|
||||
umem_free(packcheck, packsize);
|
||||
umem_free(bigcheck, bigsize);
|
||||
@@ -4947,11 +4947,11 @@ compare_and_update_pbbufs(uint64_t s, bufwad_t *packbuf, bufwad_t *bigbuf,
|
||||
"got %"PRIx64", wanted %"PRIx64"+%"PRIx64"",
|
||||
pack->bw_index, n, i);
|
||||
|
||||
if (bcmp(pack, bigH, sizeof (bufwad_t)) != 0)
|
||||
if (memcmp(pack, bigH, sizeof (bufwad_t)) != 0)
|
||||
fatal(B_FALSE, "pack/bigH mismatch in %p/%p",
|
||||
pack, bigH);
|
||||
|
||||
if (bcmp(pack, bigT, sizeof (bufwad_t)) != 0)
|
||||
if (memcmp(pack, bigT, sizeof (bufwad_t)) != 0)
|
||||
fatal(B_FALSE, "pack/bigT mismatch in %p/%p",
|
||||
pack, bigT);
|
||||
|
||||
@@ -5139,15 +5139,16 @@ ztest_dmu_read_write_zcopy(ztest_ds_t *zd, uint64_t id)
|
||||
for (off = bigoff, j = 0; j < s; j++, off += chunksize) {
|
||||
dmu_buf_t *dbt;
|
||||
if (i != 5 || chunksize < (SPA_MINBLOCKSIZE * 2)) {
|
||||
bcopy((caddr_t)bigbuf + (off - bigoff),
|
||||
bigbuf_arcbufs[j]->b_data, chunksize);
|
||||
memcpy(bigbuf_arcbufs[j]->b_data,
|
||||
(caddr_t)bigbuf + (off - bigoff),
|
||||
chunksize);
|
||||
} else {
|
||||
bcopy((caddr_t)bigbuf + (off - bigoff),
|
||||
bigbuf_arcbufs[2 * j]->b_data,
|
||||
memcpy(bigbuf_arcbufs[2 * j]->b_data,
|
||||
(caddr_t)bigbuf + (off - bigoff),
|
||||
chunksize / 2);
|
||||
bcopy((caddr_t)bigbuf + (off - bigoff) +
|
||||
memcpy(bigbuf_arcbufs[2 * j + 1]->b_data,
|
||||
(caddr_t)bigbuf + (off - bigoff) +
|
||||
chunksize / 2,
|
||||
bigbuf_arcbufs[2 * j + 1]->b_data,
|
||||
chunksize / 2);
|
||||
}
|
||||
|
||||
@@ -5183,8 +5184,8 @@ ztest_dmu_read_write_zcopy(ztest_ds_t *zd, uint64_t id)
|
||||
VERIFY0(dmu_read(os, bigobj, bigoff,
|
||||
bigsize, bigcheck, DMU_READ_PREFETCH));
|
||||
|
||||
ASSERT0(bcmp(packbuf, packcheck, packsize));
|
||||
ASSERT0(bcmp(bigbuf, bigcheck, bigsize));
|
||||
ASSERT0(memcmp(packbuf, packcheck, packsize));
|
||||
ASSERT0(memcmp(bigbuf, bigcheck, bigsize));
|
||||
|
||||
umem_free(packcheck, packsize);
|
||||
umem_free(bigcheck, bigsize);
|
||||
@@ -5337,7 +5338,7 @@ ztest_zap(ztest_ds_t *zd, uint64_t id)
|
||||
prop = ztest_random(ZTEST_ZAP_MAX_PROPS);
|
||||
(void) sprintf(propname, "prop_%"PRIu64"", prop);
|
||||
(void) sprintf(txgname, "txg_%"PRIu64"", prop);
|
||||
bzero(value, sizeof (value));
|
||||
memset(value, 0, sizeof (value));
|
||||
last_txg = 0;
|
||||
|
||||
/*
|
||||
@@ -5529,11 +5530,11 @@ ztest_zap_parallel(ztest_ds_t *zd, uint64_t id)
|
||||
umem_free(od, sizeof (ztest_od_t));
|
||||
return;
|
||||
}
|
||||
bcopy(name, string_value, namelen);
|
||||
memcpy(string_value, name, namelen);
|
||||
} else {
|
||||
tx = NULL;
|
||||
txg = 0;
|
||||
bzero(string_value, namelen);
|
||||
memset(string_value, 0, namelen);
|
||||
}
|
||||
|
||||
switch (i) {
|
||||
@@ -5552,7 +5553,7 @@ ztest_zap_parallel(ztest_ds_t *zd, uint64_t id)
|
||||
error = zap_lookup(os, object, name, wsize, wc, data);
|
||||
if (error == 0) {
|
||||
if (data == string_value &&
|
||||
bcmp(name, data, namelen) != 0)
|
||||
memcmp(name, data, namelen) != 0)
|
||||
fatal(B_FALSE, "name '%s' != val '%s' len %d",
|
||||
name, (char *)data, namelen);
|
||||
} else {
|
||||
@@ -6436,8 +6437,8 @@ ztest_fletcher(ztest_ds_t *zd, uint64_t id)
|
||||
fletcher_4_byteswap(buf, size, NULL, &zc_byteswap);
|
||||
fletcher_4_native(buf, size, NULL, &zc);
|
||||
|
||||
VERIFY0(bcmp(&zc, &zc_ref, sizeof (zc)));
|
||||
VERIFY0(bcmp(&zc_byteswap, &zc_ref_byteswap,
|
||||
VERIFY0(memcmp(&zc, &zc_ref, sizeof (zc)));
|
||||
VERIFY0(memcmp(&zc_byteswap, &zc_ref_byteswap,
|
||||
sizeof (zc_byteswap)));
|
||||
|
||||
/* Test ABD - data */
|
||||
@@ -6445,8 +6446,8 @@ ztest_fletcher(ztest_ds_t *zd, uint64_t id)
|
||||
&zc_byteswap);
|
||||
abd_fletcher_4_native(abd_data, size, NULL, &zc);
|
||||
|
||||
VERIFY0(bcmp(&zc, &zc_ref, sizeof (zc)));
|
||||
VERIFY0(bcmp(&zc_byteswap, &zc_ref_byteswap,
|
||||
VERIFY0(memcmp(&zc, &zc_ref, sizeof (zc)));
|
||||
VERIFY0(memcmp(&zc_byteswap, &zc_ref_byteswap,
|
||||
sizeof (zc_byteswap)));
|
||||
|
||||
/* Test ABD - metadata */
|
||||
@@ -6454,8 +6455,8 @@ ztest_fletcher(ztest_ds_t *zd, uint64_t id)
|
||||
&zc_byteswap);
|
||||
abd_fletcher_4_native(abd_meta, size, NULL, &zc);
|
||||
|
||||
VERIFY0(bcmp(&zc, &zc_ref, sizeof (zc)));
|
||||
VERIFY0(bcmp(&zc_byteswap, &zc_ref_byteswap,
|
||||
VERIFY0(memcmp(&zc, &zc_ref, sizeof (zc)));
|
||||
VERIFY0(memcmp(&zc_byteswap, &zc_ref_byteswap,
|
||||
sizeof (zc_byteswap)));
|
||||
|
||||
}
|
||||
@@ -7960,7 +7961,7 @@ ztest_run_init(void)
|
||||
* Create and initialize our storage pool.
|
||||
*/
|
||||
for (i = 1; i <= ztest_opts.zo_init; i++) {
|
||||
bzero(zs, sizeof (ztest_shared_t));
|
||||
memset(zs, 0, sizeof (*zs));
|
||||
if (ztest_opts.zo_verbose >= 3 &&
|
||||
ztest_opts.zo_init != 1) {
|
||||
(void) printf("ztest_init(), pass %d\n", i);
|
||||
@@ -8041,12 +8042,12 @@ main(int argc, char **argv)
|
||||
setup_data_fd();
|
||||
setup_hdr();
|
||||
setup_data();
|
||||
bcopy(&ztest_opts, ztest_shared_opts,
|
||||
memcpy(ztest_shared_opts, &ztest_opts,
|
||||
sizeof (*ztest_shared_opts));
|
||||
} else {
|
||||
ztest_fd_data = atoi(fd_data_str);
|
||||
setup_data();
|
||||
bcopy(ztest_shared_opts, &ztest_opts, sizeof (ztest_opts));
|
||||
memcpy(&ztest_opts, ztest_shared_opts, sizeof (ztest_opts));
|
||||
}
|
||||
ASSERT3U(ztest_opts.zo_datasets, ==, ztest_shared_hdr->zh_ds_count);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user