Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Destroy legacy string functions. Clean out vtoc.h #12996

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
f107d00
tests: zfs_set_common: check_prop_inherit: print faulty values
nabijaczleweli Feb 20, 2022
5452de8
tests: zfs_002_pos: simplify ZFS_ABORT tests
nabijaczleweli Feb 23, 2022
1545b0d
tests: replace explicit $? || log_fail with log_must
nabijaczleweli Feb 23, 2022
b12da84
libspl: include: sys/vtoc.h: reduce to absolute barest minimum
nabijaczleweli Jan 21, 2022
51586a0
Remove bcopy(), bzero(), bcmp()
nabijaczleweli Feb 25, 2022
2dd3564
Forbid b{copy,zero,cmp}(). Don't include <strings.h> for <string.h>
nabijaczleweli Jan 22, 2022
944be82
Integrate carcass of libspl/i/s/vtoc.h into i/s/efi_partition.h
nabijaczleweli Jan 22, 2022
50d5b5a
Replace FMD_B_{TRUE,FALSE} with B_{TRUE,FALSE}
nabijaczleweli Jan 22, 2022
1333cb2
zpool: wait: only accept whole columns for -t, not col[=whatever]
nabijaczleweli Jan 21, 2022
dc905ee
zpool: get: only accept whole columns for -o, not col[=whatever]
nabijaczleweli Jan 22, 2022
7b08e5b
zfs: wait: only accept whole activity for -t, not act[=whatever]
nabijaczleweli Jan 22, 2022
2964ec4
zpool: get: there's one fewer column than in zfs get
nabijaczleweli Jan 22, 2022
ec6e67c
zfs: get: only accept whole column for -o, not col[=whatever]
nabijaczleweli Jan 22, 2022
64b056e
zfs: get: only accept whole source for -s, not src[=whatever]
nabijaczleweli Jan 22, 2022
f05644f
zfs: get: only accept whole type for -t, not tp[=whatever]
nabijaczleweli Jan 22, 2022
e212544
libzfs: tokenise consistently with zfs and zpool
nabijaczleweli Jan 22, 2022
dc5e5f8
zfs: list: only accept whole type for -t, not tp[=whatever]
nabijaczleweli Jan 22, 2022
1ddfbf0
zfs-list.8: mention -S after -s it calls back to
nabijaczleweli Jan 23, 2022
c3ccdf0
tests: validate getsubopt(3) expulsion
nabijaczleweli Mar 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/raidz_test/raidz_bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions cmd/raidz_test/raidz_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions cmd/raidz_test/raidz_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
41 changes: 13 additions & 28 deletions cmd/zdb/zdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 |
Expand All @@ -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 " : "",
Expand All @@ -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);

/*
Expand Down Expand Up @@ -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));

Expand Down Expand Up @@ -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");

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -8368,12 +8354,11 @@ zdb_read_block(char *thing, spa_t *spa)
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,
Expand Down Expand Up @@ -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 *));
Expand Down
14 changes: 7 additions & 7 deletions cmd/zed/agents/fmd_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <sys/fm/protocol.h>
#include <uuid/uuid.h>
#include <signal.h>
#include <strings.h>
#include <string.h>
#include <time.h>

#include "fmd_api.h"
Expand Down Expand Up @@ -342,11 +342,11 @@ fmd_case_uuresolved(fmd_hdl_t *hdl, const char *uuid)
fmd_hdl_debug(hdl, "case resolved by uuid (%s)", uuid);
}

int
boolean_t
fmd_case_solved(fmd_hdl_t *hdl, fmd_case_t *cp)
{
(void) hdl;
return ((cp->ci_state >= FMD_CASE_SOLVED) ? FMD_B_TRUE : FMD_B_FALSE);
return (cp->ci_state >= FMD_CASE_SOLVED);
}

void
Expand Down Expand Up @@ -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
Expand All @@ -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 */
Expand Down Expand Up @@ -560,7 +560,7 @@ fmd_serd_record(fmd_hdl_t *hdl, const char *name, fmd_event_t *ep)
if ((sgp = fmd_serd_eng_lookup(&mp->mod_serds, name)) == NULL) {
zed_log_msg(LOG_ERR, "failed to add record to SERD engine '%s'",
name);
return (FMD_B_FALSE);
return (0);
}
err = fmd_serd_eng_record(sgp, ep->ev_hrt);

Expand All @@ -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 */
Expand Down
7 changes: 1 addition & 6 deletions cmd/zed/agents/fmd_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ typedef struct fmd_case {
} fmd_case_t;


#define FMD_B_FALSE 0 /* false value for booleans as int */
#define FMD_B_TRUE 1 /* true value for booleans as int */


#define FMD_CASE_UNSOLVED 0 /* case is not yet solved (waiting) */
#define FMD_CASE_SOLVED 1 /* case is solved (suspects added) */
#define FMD_CASE_CLOSE_WAIT 2 /* case is executing fmdo_close() */
Expand Down Expand Up @@ -176,8 +172,7 @@ extern int fmd_case_uuclosed(fmd_hdl_t *, const char *);
extern int fmd_case_uuisresolved(fmd_hdl_t *, const char *);
extern void fmd_case_uuresolved(fmd_hdl_t *, const char *);

extern int fmd_case_solved(fmd_hdl_t *, fmd_case_t *);
extern int fmd_case_closed(fmd_hdl_t *, fmd_case_t *);
extern boolean_t fmd_case_solved(fmd_hdl_t *, fmd_case_t *);

extern void fmd_case_add_ereport(fmd_hdl_t *, fmd_case_t *, fmd_event_t *);
extern void fmd_case_add_serd(fmd_hdl_t *, fmd_case_t *, const char *);
Expand Down
12 changes: 6 additions & 6 deletions cmd/zed/agents/fmd_serd.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <assert.h>
#include <stddef.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <sys/list.h>
#include <sys/time.h>

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -234,7 +234,7 @@ fmd_serd_eng_record(fmd_serd_eng_t *sgp, hrtime_t hrt)
if (sgp->sg_flags & FMD_SERD_FIRED) {
serd_log_msg(" SERD Engine: record %s already fired!",
sgp->sg_name);
return (FMD_B_FALSE);
return (B_FALSE);
}

while (sgp->sg_count >= sgp->sg_n)
Expand All @@ -259,11 +259,11 @@ fmd_serd_eng_record(fmd_serd_eng_t *sgp, hrtime_t hrt)
fmd_event_delta(oep->se_hrt, sep->se_hrt) <= sgp->sg_t) {
sgp->sg_flags |= FMD_SERD_FIRED | FMD_SERD_DIRTY;
serd_log_msg(" SERD Engine: fired %s", sgp->sg_name);
return (FMD_B_TRUE);
return (B_TRUE);
}

sgp->sg_flags |= FMD_SERD_DIRTY;
return (FMD_B_FALSE);
return (B_FALSE);
}

int
Expand Down
1 change: 0 additions & 1 deletion cmd/zed/agents/zfs_diagnosis.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

#include <stddef.h>
#include <string.h>
#include <strings.h>
#include <libuutil.h>
#include <libzfs.h>
#include <sys/types.h>
Expand Down
1 change: 0 additions & 1 deletion cmd/zfs/zfs_iter.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>

#include <libzfs.h>

Expand Down
Loading