zfs: merge openzfs/zfs@bc3f12bfa (master) into main
Notable upstream pull request merges:
#12083 libzfs: FreeBSD doesn't resize partitions for you
#13106 add physical device size to SIZE column in 'zpool list -v'
#13158 Allow zfs send to exclude datasets
#13190 module: zfs: zio_inject: zio_match_handler: don't << -1
#13219 FreeBSD: add missing replay check to an assert in zfs_xvattr_set
#13220 module: freebsd: avoid a taking a destroyed lock in zfs_zevent bits
#13221 Fix ACL checks for NFS kernel server
Obtained from: OpenZFS
OpenZFS commit: bc3f12bfac
This commit is contained in:
commit
da5137abdf
@ -242,7 +242,7 @@ CDDL_C= ${CC} -c ${CDDL_CFLAGS} ${WERROR} ${.IMPSRC}
|
||||
# Special flags for managing the compat compiles for ZFS
|
||||
ZFS_CFLAGS+= ${CDDL_CFLAGS} -DBUILDING_ZFS -DHAVE_UIO_ZEROCOPY \
|
||||
-DWITH_NETDUMP -D__KERNEL__ -D_SYS_CONDVAR_H_ -DSMP \
|
||||
-DIN_FREEBSD_BASE -DHAVE_KSID
|
||||
-DIN_FREEBSD_BASE
|
||||
|
||||
.if ${MACHINE_ARCH} == "amd64"
|
||||
ZFS_CFLAGS+= -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_SSE2 -DHAVE_AVX512F \
|
||||
|
@ -60,7 +60,7 @@ jobs:
|
||||
- name: Tests
|
||||
run: |
|
||||
set -o pipefail
|
||||
/usr/share/zfs/zfs-tests.sh -vR -s 3G | scripts/zfs-tests-color.sh
|
||||
/usr/share/zfs/zfs-tests.sh -vKR -s 3G | scripts/zfs-tests-color.sh
|
||||
shell: bash
|
||||
timeout-minutes: 330
|
||||
- name: Prepare artifacts
|
||||
|
@ -56,7 +56,7 @@ jobs:
|
||||
- name: Tests
|
||||
run: |
|
||||
set -o pipefail
|
||||
/usr/share/zfs/zfs-tests.sh -vR -s 3G -r sanity | scripts/zfs-tests-color.sh
|
||||
/usr/share/zfs/zfs-tests.sh -vKR -s 3G -r sanity | scripts/zfs-tests-color.sh
|
||||
shell: bash
|
||||
timeout-minutes: 330
|
||||
- name: Prepare artifacts
|
||||
|
@ -6,5 +6,5 @@ Release: 1
|
||||
Release-Tags: relext
|
||||
License: CDDL
|
||||
Author: OpenZFS
|
||||
Linux-Maximum: 5.15
|
||||
Linux-Maximum: 5.17
|
||||
Linux-Minimum: 3.10
|
||||
|
@ -103,7 +103,7 @@ endif
|
||||
endif
|
||||
|
||||
PHONY += codecheck
|
||||
codecheck: cstyle shellcheck checkbashisms flake8 mancheck testscheck vcscheck
|
||||
codecheck: cstyle shellcheck checkbashisms flake8 mancheck testscheck vcscheck zstdcheck
|
||||
|
||||
PHONY += checkstyle
|
||||
checkstyle: codecheck commitcheck
|
||||
@ -125,6 +125,7 @@ cstyle:
|
||||
-o -type f -name '*.[hc]' \
|
||||
! -name 'zfs_config.*' ! -name '*.mod.c' \
|
||||
! -name 'opt_global.h' ! -name '*_if*.h' \
|
||||
! -name 'zstd_compat_wrapper.h' \
|
||||
! -path './module/zstd/lib/*' \
|
||||
! -path './include/sys/lua/*' \
|
||||
! -path './module/lua/l*.[ch]' \
|
||||
@ -164,6 +165,10 @@ vcscheck:
|
||||
awk '{c++; print} END {if(c>0) exit 1}' ; \
|
||||
fi
|
||||
|
||||
PHONY += zstdcheck
|
||||
zstdcheck:
|
||||
@$(MAKE) -C module/zstd checksymbols
|
||||
|
||||
PHONY += lint
|
||||
lint: cppcheck paxcheck
|
||||
|
||||
|
@ -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;
|
||||
@ -840,7 +839,7 @@ static kcondvar_t sem_cv;
|
||||
static int max_free_slots;
|
||||
static int free_slots;
|
||||
|
||||
static _Noreturn void
|
||||
static __attribute__((noreturn)) void
|
||||
sweep_thread(void *arg)
|
||||
{
|
||||
int err = 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"
|
||||
|
@ -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 @@ 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,
|
||||
@ -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 *));
|
||||
|
@ -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"
|
||||
@ -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
|
||||
@ -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 */
|
||||
@ -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);
|
||||
|
||||
@ -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 */
|
||||
|
@ -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() */
|
||||
@ -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 *);
|
||||
|
@ -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>
|
||||
|
||||
@ -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
|
||||
@ -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)
|
||||
@ -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
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <libuutil.h>
|
||||
#include <libzfs.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
|
||||
#include <libzfs.h>
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <zone.h>
|
||||
@ -315,8 +315,9 @@ get_usage(zfs_help_t idx)
|
||||
case HELP_ROLLBACK:
|
||||
return (gettext("\trollback [-rRf] <snapshot>\n"));
|
||||
case HELP_SEND:
|
||||
return (gettext("\tsend [-DnPpRvLecwhb] [-[i|I] snapshot] "
|
||||
"<snapshot>\n"
|
||||
return (gettext("\tsend [-DnPpRvLecwhb] "
|
||||
"[-X dataset[,dataset]...] "
|
||||
"[-[i|I] snapshot] <snapshot>\n"
|
||||
"\tsend [-DnvPLecw] [-i snapshot|bookmark] "
|
||||
"<filesystem|volume|snapshot>\n"
|
||||
"\tsend [-DnPpvLec] [-i bookmark|snapshot] "
|
||||
@ -498,7 +499,7 @@ usage_prop_cb(int prop, void *cb)
|
||||
* that command. Otherwise, iterate over the entire command table and display
|
||||
* a complete usage message.
|
||||
*/
|
||||
static void
|
||||
static __attribute__((noreturn)) void
|
||||
usage(boolean_t requested)
|
||||
{
|
||||
int i;
|
||||
@ -1997,7 +1998,7 @@ zfs_do_get(int argc, char **argv)
|
||||
zprop_get_cbdata_t cb = { 0 };
|
||||
int i, c, flags = ZFS_ITER_ARGS_CAN_BE_PATHS;
|
||||
int types = ZFS_TYPE_DATASET | ZFS_TYPE_BOOKMARK;
|
||||
char *value, *fields;
|
||||
char *fields;
|
||||
int ret = 0;
|
||||
int limit = 0;
|
||||
zprop_list_t fake_name = { 0 };
|
||||
@ -2037,12 +2038,18 @@ 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[] =
|
||||
{ "name", "property", "value", "received",
|
||||
"source", "all", NULL };
|
||||
for (char *tok; (tok = strsep(&optarg, ",")); ) {
|
||||
static const char *const col_subopts[] =
|
||||
{ "name", "property", "value",
|
||||
"received", "source", "all" };
|
||||
static const zfs_get_column_t col_subopt_col[] =
|
||||
{ GET_COL_NAME, GET_COL_PROPERTY, GET_COL_VALUE,
|
||||
GET_COL_RECVD, GET_COL_SOURCE };
|
||||
static const int col_subopt_flags[] =
|
||||
{ 0, 0, 0, ZFS_ITER_RECVD_PROPS, 0 };
|
||||
|
||||
if (i == ZFS_GET_NCOLS) {
|
||||
(void) fprintf(stderr, gettext("too "
|
||||
@ -2051,25 +2058,16 @@ zfs_do_get(int argc, char **argv)
|
||||
usage(B_FALSE);
|
||||
}
|
||||
|
||||
switch (getsubopt(&optarg, col_subopts,
|
||||
&value)) {
|
||||
case 0:
|
||||
cb.cb_columns[i++] = GET_COL_NAME;
|
||||
break;
|
||||
case 1:
|
||||
cb.cb_columns[i++] = GET_COL_PROPERTY;
|
||||
break;
|
||||
case 2:
|
||||
cb.cb_columns[i++] = GET_COL_VALUE;
|
||||
break;
|
||||
case 3:
|
||||
cb.cb_columns[i++] = GET_COL_RECVD;
|
||||
flags |= ZFS_ITER_RECVD_PROPS;
|
||||
break;
|
||||
case 4:
|
||||
cb.cb_columns[i++] = GET_COL_SOURCE;
|
||||
break;
|
||||
case 5:
|
||||
for (c = 0; c < ARRAY_SIZE(col_subopts); ++c)
|
||||
if (strcmp(tok, col_subopts[c]) == 0)
|
||||
goto found;
|
||||
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid column name '%s'\n"), tok);
|
||||
usage(B_FALSE);
|
||||
|
||||
found:
|
||||
if (c >= 5) {
|
||||
if (i > 0) {
|
||||
(void) fprintf(stderr,
|
||||
gettext("\"all\" conflicts "
|
||||
@ -2077,94 +2075,70 @@ zfs_do_get(int argc, char **argv)
|
||||
"given to -o option\n"));
|
||||
usage(B_FALSE);
|
||||
}
|
||||
cb.cb_columns[0] = GET_COL_NAME;
|
||||
cb.cb_columns[1] = GET_COL_PROPERTY;
|
||||
cb.cb_columns[2] = GET_COL_VALUE;
|
||||
cb.cb_columns[3] = GET_COL_RECVD;
|
||||
cb.cb_columns[4] = GET_COL_SOURCE;
|
||||
|
||||
memcpy(cb.cb_columns, col_subopt_col,
|
||||
sizeof (col_subopt_col));
|
||||
flags |= ZFS_ITER_RECVD_PROPS;
|
||||
i = ZFS_GET_NCOLS;
|
||||
break;
|
||||
default:
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid column name "
|
||||
"'%s'\n"), value);
|
||||
usage(B_FALSE);
|
||||
} else {
|
||||
cb.cb_columns[i++] = col_subopt_col[c];
|
||||
flags |= col_subopt_flags[c];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 's':
|
||||
cb.cb_sources = 0;
|
||||
while (*optarg != '\0') {
|
||||
static char *source_subopts[] = {
|
||||
"local", "default", "inherited",
|
||||
"received", "temporary", "none",
|
||||
NULL };
|
||||
|
||||
switch (getsubopt(&optarg, source_subopts,
|
||||
&value)) {
|
||||
case 0:
|
||||
cb.cb_sources |= ZPROP_SRC_LOCAL;
|
||||
break;
|
||||
case 1:
|
||||
cb.cb_sources |= ZPROP_SRC_DEFAULT;
|
||||
break;
|
||||
case 2:
|
||||
cb.cb_sources |= ZPROP_SRC_INHERITED;
|
||||
break;
|
||||
case 3:
|
||||
cb.cb_sources |= ZPROP_SRC_RECEIVED;
|
||||
break;
|
||||
case 4:
|
||||
cb.cb_sources |= ZPROP_SRC_TEMPORARY;
|
||||
break;
|
||||
case 5:
|
||||
cb.cb_sources |= ZPROP_SRC_NONE;
|
||||
break;
|
||||
default:
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid source "
|
||||
"'%s'\n"), value);
|
||||
usage(B_FALSE);
|
||||
}
|
||||
for (char *tok; (tok = strsep(&optarg, ",")); ) {
|
||||
static const char *const source_opt[] = {
|
||||
"local", "default",
|
||||
"inherited", "received",
|
||||
"temporary", "none" };
|
||||
static const int source_flg[] = {
|
||||
ZPROP_SRC_LOCAL, ZPROP_SRC_DEFAULT,
|
||||
ZPROP_SRC_INHERITED, ZPROP_SRC_RECEIVED,
|
||||
ZPROP_SRC_TEMPORARY, ZPROP_SRC_NONE };
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(source_opt); ++i)
|
||||
if (strcmp(tok, source_opt[i]) == 0) {
|
||||
cb.cb_sources |= source_flg[i];
|
||||
goto found2;
|
||||
}
|
||||
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid source '%s'\n"), tok);
|
||||
usage(B_FALSE);
|
||||
found2:;
|
||||
}
|
||||
break;
|
||||
|
||||
case 't':
|
||||
types = 0;
|
||||
flags &= ~ZFS_ITER_PROP_LISTSNAPS;
|
||||
while (*optarg != '\0') {
|
||||
static char *type_subopts[] = { "filesystem",
|
||||
"volume", "snapshot", "snap", "bookmark",
|
||||
"all", NULL };
|
||||
|
||||
switch (getsubopt(&optarg, type_subopts,
|
||||
&value)) {
|
||||
case 0:
|
||||
types |= ZFS_TYPE_FILESYSTEM;
|
||||
break;
|
||||
case 1:
|
||||
types |= ZFS_TYPE_VOLUME;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
types |= ZFS_TYPE_SNAPSHOT;
|
||||
break;
|
||||
case 4:
|
||||
types |= ZFS_TYPE_BOOKMARK;
|
||||
break;
|
||||
case 5:
|
||||
types = ZFS_TYPE_DATASET |
|
||||
ZFS_TYPE_BOOKMARK;
|
||||
break;
|
||||
for (char *tok; (tok = strsep(&optarg, ",")); ) {
|
||||
static const char *const type_opts[] = {
|
||||
"filesystem", "volume",
|
||||
"snapshot", "snap",
|
||||
"bookmark",
|
||||
"all" };
|
||||
static const int type_types[] = {
|
||||
ZFS_TYPE_FILESYSTEM, ZFS_TYPE_VOLUME,
|
||||
ZFS_TYPE_SNAPSHOT, ZFS_TYPE_SNAPSHOT,
|
||||
ZFS_TYPE_BOOKMARK,
|
||||
ZFS_TYPE_DATASET | ZFS_TYPE_BOOKMARK };
|
||||
|
||||
default:
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid type '%s'\n"),
|
||||
value);
|
||||
usage(B_FALSE);
|
||||
}
|
||||
for (i = 0; i < ARRAY_SIZE(type_opts); ++i)
|
||||
if (strcmp(tok, type_opts[i]) == 0) {
|
||||
types |= type_types[i];
|
||||
goto found3;
|
||||
}
|
||||
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid type '%s'\n"), tok);
|
||||
usage(B_FALSE);
|
||||
found3:;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -3578,13 +3552,12 @@ static int
|
||||
zfs_do_list(int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
static char default_fields[] =
|
||||
char default_fields[] =
|
||||
"name,used,available,referenced,mountpoint";
|
||||
int types = ZFS_TYPE_DATASET;
|
||||
boolean_t types_specified = B_FALSE;
|
||||
char *fields = NULL;
|
||||
char *fields = default_fields;
|
||||
list_cbdata_t cb = { 0 };
|
||||
char *value;
|
||||
int limit = 0;
|
||||
int ret = 0;
|
||||
zfs_sort_column_t *sortcol = NULL;
|
||||
@ -3629,36 +3602,29 @@ zfs_do_list(int argc, char **argv)
|
||||
types = 0;
|
||||
types_specified = B_TRUE;
|
||||
flags &= ~ZFS_ITER_PROP_LISTSNAPS;
|
||||
while (*optarg != '\0') {
|
||||
static char *type_subopts[] = { "filesystem",
|
||||
"volume", "snapshot", "snap", "bookmark",
|
||||
"all", NULL };
|
||||
|
||||
switch (getsubopt(&optarg, type_subopts,
|
||||
&value)) {
|
||||
case 0:
|
||||
types |= ZFS_TYPE_FILESYSTEM;
|
||||
break;
|
||||
case 1:
|
||||
types |= ZFS_TYPE_VOLUME;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
types |= ZFS_TYPE_SNAPSHOT;
|
||||
break;
|
||||
case 4:
|
||||
types |= ZFS_TYPE_BOOKMARK;
|
||||
break;
|
||||
case 5:
|
||||
types = ZFS_TYPE_DATASET |
|
||||
ZFS_TYPE_BOOKMARK;
|
||||
break;
|
||||
default:
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid type '%s'\n"),
|
||||
value);
|
||||
usage(B_FALSE);
|
||||
}
|
||||
for (char *tok; (tok = strsep(&optarg, ",")); ) {
|
||||
static const char *const type_subopts[] = {
|
||||
"filesystem", "volume",
|
||||
"snapshot", "snap",
|
||||
"bookmark",
|
||||
"all" };
|
||||
static const int type_types[] = {
|
||||
ZFS_TYPE_FILESYSTEM, ZFS_TYPE_VOLUME,
|
||||
ZFS_TYPE_SNAPSHOT, ZFS_TYPE_SNAPSHOT,
|
||||
ZFS_TYPE_BOOKMARK,
|
||||
ZFS_TYPE_DATASET | ZFS_TYPE_BOOKMARK };
|
||||
|
||||
for (c = 0; c < ARRAY_SIZE(type_subopts); ++c)
|
||||
if (strcmp(tok, type_subopts[c]) == 0) {
|
||||
types |= type_types[c];
|
||||
goto found3;
|
||||
}
|
||||
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid type '%s'\n"), tok);
|
||||
usage(B_FALSE);
|
||||
found3:;
|
||||
}
|
||||
break;
|
||||
case ':':
|
||||
@ -3676,9 +3642,6 @@ zfs_do_list(int argc, char **argv)
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (fields == NULL)
|
||||
fields = default_fields;
|
||||
|
||||
/*
|
||||
* If we are only going to list snapshot names and sort by name,
|
||||
* then we can use faster version.
|
||||
@ -4355,6 +4318,77 @@ zfs_do_snapshot(int argc, char **argv)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
typedef struct zfs_send_exclude_arg {
|
||||
size_t count;
|
||||
char **list;
|
||||
} zfs_send_exclude_arg_t;
|
||||
|
||||
/*
|
||||
* This function creates the zfs_send_exclude_arg_t
|
||||
* object described above; it can be called multiple
|
||||
* times, and the input can be comma-separated.
|
||||
* This is NOT the most efficient data layout; however,
|
||||
* I couldn't think of a non-pathological case where
|
||||
* it should have more than a couple dozen instances
|
||||
* of excludes. If that turns out to be used in
|
||||
* practice, we might want to instead use a tree.
|
||||
*/
|
||||
static void
|
||||
add_dataset_excludes(char *exclude, zfs_send_exclude_arg_t *context)
|
||||
{
|
||||
char *tok;
|
||||
while ((tok = strsep(&exclude, ",")) != NULL) {
|
||||
if (!zfs_name_valid(tok, ZFS_TYPE_DATASET) ||
|
||||
strchr(tok, '/') == NULL) {
|
||||
(void) fprintf(stderr, gettext("-X %s: "
|
||||
"not a valid non-root dataset name.\n"), tok);
|
||||
usage(B_FALSE);
|
||||
}
|
||||
context->list = safe_realloc(context->list,
|
||||
(sizeof (char *)) * (context->count + 1));
|
||||
context->list[context->count++] = tok;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
free_dataset_excludes(zfs_send_exclude_arg_t *exclude_list)
|
||||
{
|
||||
free(exclude_list->list);
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the call back used by zfs_send to
|
||||
* determine if a dataset should be skipped.
|
||||
* As stated above, this is not the most efficient
|
||||
* data structure to use, but as long as the
|
||||
* number of excluded datasets is relatively
|
||||
* small (a couple of dozen or so), it won't
|
||||
* have a big impact on performance on modern
|
||||
* processors. Since it's excluding hierarchies,
|
||||
* we'd probably want to move to a more complex
|
||||
* tree structure in that case.
|
||||
*/
|
||||
static boolean_t
|
||||
zfs_do_send_exclude(zfs_handle_t *zhp, void *context)
|
||||
{
|
||||
zfs_send_exclude_arg_t *exclude = context;
|
||||
const char *name = zfs_get_name(zhp);
|
||||
|
||||
for (size_t indx = 0; indx < exclude->count; indx++) {
|
||||
char *exclude_name = exclude->list[indx];
|
||||
size_t len = strlen(exclude_name);
|
||||
/* If it's shorter, it can't possibly match */
|
||||
if (strlen(name) < len)
|
||||
continue;
|
||||
if (strncmp(name, exclude_name, len) == 0 &&
|
||||
(name[len] == '/' || name[len] == '\0' ||
|
||||
name[len] == '@')) {
|
||||
return (B_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
return (B_TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Send a backup stream to stdout.
|
||||
@ -4371,6 +4405,7 @@ zfs_do_send(int argc, char **argv)
|
||||
int c, err;
|
||||
nvlist_t *dbgnv = NULL;
|
||||
char *redactbook = NULL;
|
||||
zfs_send_exclude_arg_t exclude_context = { 0 };
|
||||
|
||||
struct option long_options[] = {
|
||||
{"replicate", no_argument, NULL, 'R'},
|
||||
@ -4389,13 +4424,17 @@ zfs_do_send(int argc, char **argv)
|
||||
{"backup", no_argument, NULL, 'b'},
|
||||
{"holds", no_argument, NULL, 'h'},
|
||||
{"saved", no_argument, NULL, 'S'},
|
||||
{"exclude", required_argument, NULL, 'X'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
/* check options */
|
||||
while ((c = getopt_long(argc, argv, ":i:I:RsDpvnPLeht:cwbd:S",
|
||||
while ((c = getopt_long(argc, argv, ":i:I:RsDpvnPLeht:cwbd:SX:",
|
||||
long_options, NULL)) != -1) {
|
||||
switch (c) {
|
||||
case 'X':
|
||||
add_dataset_excludes(optarg, &exclude_context);
|
||||
break;
|
||||
case 'i':
|
||||
if (fromname)
|
||||
usage(B_FALSE);
|
||||
@ -4505,6 +4544,13 @@ zfs_do_send(int argc, char **argv)
|
||||
if (flags.parsable && flags.verbosity == 0)
|
||||
flags.verbosity = 1;
|
||||
|
||||
if (exclude_context.count > 0 && !flags.replicate) {
|
||||
(void) fprintf(stderr, gettext("Cannot specify "
|
||||
"dataset exclusion (-X) on a non-recursive "
|
||||
"send.\n"));
|
||||
return (1);
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
@ -4686,8 +4732,11 @@ zfs_do_send(int argc, char **argv)
|
||||
if (flags.replicate && fromname == NULL)
|
||||
flags.doall = B_TRUE;
|
||||
|
||||
err = zfs_send(zhp, fromname, toname, &flags, STDOUT_FILENO, NULL, 0,
|
||||
flags.verbosity >= 3 ? &dbgnv : NULL);
|
||||
err = zfs_send(zhp, fromname, toname, &flags, STDOUT_FILENO,
|
||||
exclude_context.count > 0 ? zfs_do_send_exclude : NULL,
|
||||
&exclude_context, flags.verbosity >= 3 ? &dbgnv : NULL);
|
||||
|
||||
free_dataset_excludes(&exclude_context);
|
||||
|
||||
if (flags.verbosity >= 3 && dbgnv != NULL) {
|
||||
/*
|
||||
@ -5104,7 +5153,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 +5220,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 +5254,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)
|
||||
@ -8503,27 +8552,25 @@ zfs_do_wait(int argc, char **argv)
|
||||
while ((c = getopt(argc, argv, "t:")) != -1) {
|
||||
switch (c) {
|
||||
case 't':
|
||||
{
|
||||
static char *col_subopts[] = { "deleteq", NULL };
|
||||
char *value;
|
||||
|
||||
/* Reset activities array */
|
||||
bzero(&enabled, sizeof (enabled));
|
||||
while (*optarg != '\0') {
|
||||
int activity = getsubopt(&optarg, col_subopts,
|
||||
&value);
|
||||
memset(&enabled, 0, sizeof (enabled));
|
||||
|
||||
if (activity < 0) {
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid activity '%s'\n"),
|
||||
value);
|
||||
usage(B_FALSE);
|
||||
}
|
||||
for (char *tok; (tok = strsep(&optarg, ",")); ) {
|
||||
static const char *const col_subopts[
|
||||
ZFS_WAIT_NUM_ACTIVITIES] = { "deleteq" };
|
||||
|
||||
enabled[activity] = B_TRUE;
|
||||
for (i = 0; i < ARRAY_SIZE(col_subopts); ++i)
|
||||
if (strcmp(tok, col_subopts[i]) == 0) {
|
||||
enabled[i] = B_TRUE;
|
||||
goto found;
|
||||
}
|
||||
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid activity '%s'\n"), tok);
|
||||
usage(B_FALSE);
|
||||
found:;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case '?':
|
||||
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
|
||||
optopt);
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <getopt.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static _Noreturn void
|
||||
static __attribute__((noreturn)) void
|
||||
usage(void)
|
||||
{
|
||||
(void) fprintf(stderr,
|
||||
|
@ -57,7 +57,7 @@ static importargs_t g_importargs;
|
||||
static char *g_pool;
|
||||
static boolean_t g_readonly;
|
||||
|
||||
static _Noreturn void
|
||||
static __attribute__((noreturn)) void
|
||||
usage(void)
|
||||
{
|
||||
(void) fprintf(stderr,
|
||||
@ -87,7 +87,7 @@ usage(void)
|
||||
}
|
||||
|
||||
|
||||
static __attribute__((format(printf, 3, 4))) _Noreturn void
|
||||
static __attribute__((format(printf, 3, 4))) __attribute__((noreturn)) void
|
||||
fatal(spa_t *spa, void *tag, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
@ -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;
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/mntent.h>
|
||||
#include <sys/mnttab.h>
|
||||
@ -186,6 +186,7 @@ initialize_range(err_type_t type, int level, char *range,
|
||||
switch (type) {
|
||||
default:
|
||||
break;
|
||||
|
||||
case TYPE_DATA:
|
||||
break;
|
||||
|
||||
|
@ -144,6 +144,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@ -159,7 +160,7 @@
|
||||
libzfs_handle_t *g_zfs;
|
||||
int zfs_fd;
|
||||
|
||||
static const char *errtable[TYPE_INVAL] = {
|
||||
static const char *const errtable[TYPE_INVAL] = {
|
||||
"data",
|
||||
"dnode",
|
||||
"mos",
|
||||
|
@ -81,7 +81,6 @@
|
||||
#include <scsi/sg.h>
|
||||
#include <sys/efi_partition.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/vtoc.h>
|
||||
#include <sys/mntent.h>
|
||||
#include <uuid/uuid.h>
|
||||
#include <blkid/blkid.h>
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <thread_pool.h>
|
||||
|
||||
#include <libzfs.h>
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
@ -519,7 +518,7 @@ print_vdev_prop_cb(int prop, void *cb)
|
||||
* that command. Otherwise, iterate over the entire command table and display
|
||||
* a complete usage message.
|
||||
*/
|
||||
static void
|
||||
static __attribute__((noreturn)) void
|
||||
usage(boolean_t requested)
|
||||
{
|
||||
FILE *fp = requested ? stdout : stderr;
|
||||
@ -6067,6 +6066,7 @@ print_one_column(zpool_prop_t prop, uint64_t value, const char *str,
|
||||
size_t width = zprop_width(prop, &fixed, ZFS_TYPE_POOL);
|
||||
|
||||
switch (prop) {
|
||||
case ZPOOL_PROP_SIZE:
|
||||
case ZPOOL_PROP_EXPANDSZ:
|
||||
case ZPOOL_PROP_CHECKPOINT:
|
||||
case ZPOOL_PROP_DEDUPRATIO:
|
||||
@ -6162,8 +6162,12 @@ print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
|
||||
* 'toplevel' boolean value is passed to the print_one_column()
|
||||
* to indicate that the value is valid.
|
||||
*/
|
||||
print_one_column(ZPOOL_PROP_SIZE, vs->vs_space, NULL, scripted,
|
||||
toplevel, format);
|
||||
if (vs->vs_pspace)
|
||||
print_one_column(ZPOOL_PROP_SIZE, vs->vs_pspace, NULL,
|
||||
scripted, B_TRUE, format);
|
||||
else
|
||||
print_one_column(ZPOOL_PROP_SIZE, vs->vs_space, NULL,
|
||||
scripted, toplevel, format);
|
||||
print_one_column(ZPOOL_PROP_ALLOCATED, vs->vs_alloc, NULL,
|
||||
scripted, toplevel, format);
|
||||
print_one_column(ZPOOL_PROP_FREE, vs->vs_space - vs->vs_alloc,
|
||||
@ -10065,7 +10069,6 @@ zpool_do_get(int argc, char **argv)
|
||||
zprop_list_t fake_name = { 0 };
|
||||
int ret;
|
||||
int c, i;
|
||||
char *value;
|
||||
char *propstr = NULL;
|
||||
|
||||
cb.cb_first = B_TRUE;
|
||||
@ -10092,35 +10095,34 @@ 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[] =
|
||||
{ "name", "property", "value", "source",
|
||||
"all", NULL };
|
||||
|
||||
if (i == ZFS_GET_NCOLS) {
|
||||
for (char *tok; (tok = strsep(&optarg, ",")); ) {
|
||||
static const char *const col_opts[] =
|
||||
{ "name", "property", "value", "source",
|
||||
"all" };
|
||||
static const zfs_get_column_t col_cols[] =
|
||||
{ GET_COL_NAME, GET_COL_PROPERTY, GET_COL_VALUE,
|
||||
GET_COL_SOURCE };
|
||||
|
||||
if (i == ZFS_GET_NCOLS - 1) {
|
||||
(void) fprintf(stderr, gettext("too "
|
||||
"many fields given to -o "
|
||||
"option\n"));
|
||||
usage(B_FALSE);
|
||||
}
|
||||
|
||||
switch (getsubopt(&optarg, col_subopts,
|
||||
&value)) {
|
||||
case 0:
|
||||
cb.cb_columns[i++] = GET_COL_NAME;
|
||||
break;
|
||||
case 1:
|
||||
cb.cb_columns[i++] = GET_COL_PROPERTY;
|
||||
break;
|
||||
case 2:
|
||||
cb.cb_columns[i++] = GET_COL_VALUE;
|
||||
break;
|
||||
case 3:
|
||||
cb.cb_columns[i++] = GET_COL_SOURCE;
|
||||
break;
|
||||
case 4:
|
||||
for (c = 0; c < ARRAY_SIZE(col_opts); ++c)
|
||||
if (strcmp(tok, col_opts[c]) == 0)
|
||||
goto found;
|
||||
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid column name '%s'\n"), tok);
|
||||
usage(B_FALSE);
|
||||
|
||||
found:
|
||||
if (c >= 4) {
|
||||
if (i > 0) {
|
||||
(void) fprintf(stderr,
|
||||
gettext("\"all\" conflicts "
|
||||
@ -10128,18 +10130,12 @@ zpool_do_get(int argc, char **argv)
|
||||
"given to -o option\n"));
|
||||
usage(B_FALSE);
|
||||
}
|
||||
cb.cb_columns[0] = GET_COL_NAME;
|
||||
cb.cb_columns[1] = GET_COL_PROPERTY;
|
||||
cb.cb_columns[2] = GET_COL_VALUE;
|
||||
cb.cb_columns[3] = GET_COL_SOURCE;
|
||||
i = ZFS_GET_NCOLS;
|
||||
break;
|
||||
default:
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid column name "
|
||||
"'%s'\n"), value);
|
||||
usage(B_FALSE);
|
||||
}
|
||||
|
||||
memcpy(cb.cb_columns, col_cols,
|
||||
sizeof (col_cols));
|
||||
i = ZFS_GET_NCOLS - 1;
|
||||
} else
|
||||
cb.cb_columns[i++] = col_cols[c];
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
@ -10667,9 +10663,7 @@ int
|
||||
zpool_do_wait(int argc, char **argv)
|
||||
{
|
||||
boolean_t verbose = B_FALSE;
|
||||
int c;
|
||||
char *value;
|
||||
int i;
|
||||
int c, i;
|
||||
unsigned long count;
|
||||
pthread_t status_thr;
|
||||
int error = 0;
|
||||
@ -10703,28 +10697,26 @@ zpool_do_wait(int argc, char **argv)
|
||||
get_timestamp_arg(*optarg);
|
||||
break;
|
||||
case 't':
|
||||
{
|
||||
static char *col_subopts[] = { "discard", "free",
|
||||
"initialize", "replace", "remove", "resilver",
|
||||
"scrub", "trim", NULL };
|
||||
|
||||
/* Reset activities array */
|
||||
bzero(&wd.wd_enabled, sizeof (wd.wd_enabled));
|
||||
while (*optarg != '\0') {
|
||||
int activity = getsubopt(&optarg, col_subopts,
|
||||
&value);
|
||||
memset(&wd.wd_enabled, 0, sizeof (wd.wd_enabled));
|
||||
|
||||
if (activity < 0) {
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid activity '%s'\n"),
|
||||
value);
|
||||
usage(B_FALSE);
|
||||
}
|
||||
for (char *tok; (tok = strsep(&optarg, ",")); ) {
|
||||
static const char *const col_opts[] = {
|
||||
"discard", "free", "initialize", "replace",
|
||||
"remove", "resilver", "scrub", "trim" };
|
||||
|
||||
wd.wd_enabled[activity] = B_TRUE;
|
||||
for (i = 0; i < ARRAY_SIZE(col_opts); ++i)
|
||||
if (strcmp(tok, col_opts[i]) == 0) {
|
||||
wd.wd_enabled[i] = B_TRUE;
|
||||
goto found;
|
||||
}
|
||||
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid activity '%s'\n"), tok);
|
||||
usage(B_FALSE);
|
||||
found:;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case '?':
|
||||
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
|
||||
optopt);
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <libintl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "zpool_util.h"
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <libintl.h>
|
||||
#include <stddef.h>
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include <libnvpair.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stddef.h>
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <umem.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/debug.h>
|
||||
@ -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,
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include <libnvpair.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stddef.h>
|
||||
|
||||
|
@ -558,7 +558,7 @@ enum ztest_object {
|
||||
ZTEST_OBJECTS
|
||||
};
|
||||
|
||||
static _Noreturn void usage(boolean_t);
|
||||
static __attribute__((noreturn)) void usage(boolean_t requested);
|
||||
static int ztest_scrub_impl(spa_t *spa);
|
||||
|
||||
/*
|
||||
@ -622,7 +622,7 @@ static void sig_handler(int signo)
|
||||
|
||||
char *fatal_msg;
|
||||
|
||||
static __attribute__((format(printf, 2, 3))) _Noreturn void
|
||||
static __attribute__((format(printf, 2, 3))) __attribute__((noreturn)) void
|
||||
fatal(int do_perror, char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
@ -831,7 +831,7 @@ fini_options(void)
|
||||
short_opts = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
static __attribute__((noreturn)) void
|
||||
usage(boolean_t requested)
|
||||
{
|
||||
char option[80];
|
||||
@ -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)));
|
||||
|
||||
}
|
||||
@ -6993,7 +6994,7 @@ ztest_resume(spa_t *spa)
|
||||
(void) zio_resume(spa);
|
||||
}
|
||||
|
||||
static _Noreturn void
|
||||
static __attribute__((noreturn)) void
|
||||
ztest_resume_thread(void *arg)
|
||||
{
|
||||
spa_t *spa = arg;
|
||||
@ -7019,7 +7020,7 @@ ztest_resume_thread(void *arg)
|
||||
thread_exit();
|
||||
}
|
||||
|
||||
static _Noreturn void
|
||||
static __attribute__((noreturn)) void
|
||||
ztest_deadman_thread(void *arg)
|
||||
{
|
||||
ztest_shared_t *zs = arg;
|
||||
@ -7097,7 +7098,7 @@ ztest_execute(int test, ztest_info_t *zi, uint64_t id)
|
||||
(double)functime / NANOSEC, zi->zi_funcname);
|
||||
}
|
||||
|
||||
static _Noreturn void
|
||||
static __attribute__((noreturn)) void
|
||||
ztest_thread(void *arg)
|
||||
{
|
||||
int rand;
|
||||
@ -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);
|
||||
|
||||
|
@ -58,6 +58,9 @@ AM_CPPFLAGS += -D"strtok(...)=strtok(__VA_ARGS__) __attribute__((deprecated(\"Us
|
||||
AM_CPPFLAGS += -D"__xpg_basename(...)=__xpg_basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))"
|
||||
AM_CPPFLAGS += -D"basename(...)=basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))"
|
||||
AM_CPPFLAGS += -D"dirname(...)=dirname(__VA_ARGS__) __attribute__((deprecated(\"dirname(3) is underspecified. Use zfs_dirnamelen() instead!\")))"
|
||||
AM_CPPFLAGS += -D"bcopy(...)=__attribute__((deprecated(\"bcopy(3) is deprecated. Use memcpy(3)/memmove(3) instead!\"))) bcopy(__VA_ARGS__)"
|
||||
AM_CPPFLAGS += -D"bcmp(...)=__attribute__((deprecated(\"bcmp(3) is deprecated. Use memcmp(3) instead!\"))) bcmp(__VA_ARGS__)"
|
||||
AM_CPPFLAGS += -D"bzero(...)=__attribute__((deprecated(\"bzero(3) is deprecated. Use memset(3) instead!\"))) bzero(__VA_ARGS__)"
|
||||
|
||||
if ASAN_ENABLED
|
||||
AM_CPPFLAGS += -DZFS_ASAN_ENABLED
|
||||
|
@ -2,10 +2,6 @@ dnl #
|
||||
dnl # Set the target cpu architecture. This allows the
|
||||
dnl # following syntax to be used in a Makefile.am.
|
||||
dnl #
|
||||
dnl # ifeq ($(TARGET_CPU),x86_64)
|
||||
dnl # ...
|
||||
dnl # endif
|
||||
dnl #
|
||||
dnl # if TARGET_CPU_POWERPC
|
||||
dnl # ...
|
||||
dnl # else
|
||||
@ -29,13 +25,11 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_ARCH], [
|
||||
sparc64)
|
||||
TARGET_CPU=sparc64
|
||||
;;
|
||||
*)
|
||||
TARGET_CPU=$target_cpu
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(TARGET_CPU)
|
||||
|
||||
AM_CONDITIONAL([TARGET_CPU_I386], test $TARGET_CPU = i386)
|
||||
AM_CONDITIONAL([TARGET_CPU_X86_64], test $TARGET_CPU = x86_64)
|
||||
AM_CONDITIONAL([TARGET_CPU_POWERPC], test $TARGET_CPU = powerpc)
|
||||
AM_CONDITIONAL([TARGET_CPU_AARCH64], test $TARGET_CPU = aarch64)
|
||||
AM_CONDITIONAL([TARGET_CPU_SPARC64], test $TARGET_CPU = sparc64)
|
||||
])
|
||||
|
@ -62,6 +62,7 @@ deb-utils: deb-local rpm-utils-initramfs
|
||||
pkg8=$${name}-dracut-$${version}.noarch.rpm; \
|
||||
pkg9=$${name}-initramfs-$${version}.$${arch}.rpm; \
|
||||
pkg10=`ls python*-pyzfs-$${version}* | tail -1`; \
|
||||
pkg11=pam_zfs_key-$${version}.$${arch}.rpm; \
|
||||
## Arguments need to be passed to dh_shlibdeps. Alien provides no mechanism
|
||||
## to do this, so we install a shim onto the path which calls the real
|
||||
## dh_shlibdeps with the required arguments.
|
||||
@ -77,10 +78,10 @@ deb-utils: deb-local rpm-utils-initramfs
|
||||
env PATH=$${path_prepend}:$${PATH} \
|
||||
fakeroot $(ALIEN) --bump=0 --scripts --to-deb --target=$$debarch \
|
||||
$$pkg1 $$pkg2 $$pkg3 $$pkg4 $$pkg5 $$pkg6 $$pkg7 \
|
||||
$$pkg8 $$pkg9 $$pkg10 || exit 1; \
|
||||
$$pkg8 $$pkg9 $$pkg10 $$pkg11 || exit 1; \
|
||||
$(RM) $${path_prepend}/dh_shlibdeps; \
|
||||
rmdir $${path_prepend}; \
|
||||
$(RM) $$pkg1 $$pkg2 $$pkg3 $$pkg4 $$pkg5 $$pkg6 $$pkg7 \
|
||||
$$pkg8 $$pkg9 $$pkg10;
|
||||
$$pkg8 $$pkg9 $$pkg10 $$pkg11;
|
||||
|
||||
deb: deb-kmod deb-dkms deb-utils
|
||||
|
@ -3,16 +3,15 @@ dnl # 5.16 API change
|
||||
dnl # add_disk grew a must-check return code
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_ADD_DISK], [
|
||||
|
||||
ZFS_LINUX_TEST_SRC([add_disk_ret], [
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/blkdev.h>
|
||||
], [
|
||||
struct gendisk *disk = NULL;
|
||||
int err = add_disk(disk);
|
||||
err = err;
|
||||
])
|
||||
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_ADD_DISK], [
|
||||
AC_MSG_CHECKING([whether add_disk() returns int])
|
||||
ZFS_LINUX_TEST_RESULT([add_disk_ret],
|
||||
|
@ -474,6 +474,41 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_CGROUP_HEADER], [
|
||||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # Linux 5.18 API
|
||||
dnl #
|
||||
dnl # In 07888c665b405b1cd3577ddebfeb74f4717a84c4 ("block: pass a block_device and opf to bio_alloc")
|
||||
dnl # bio_alloc(gfp_t gfp_mask, unsigned short nr_iovecs)
|
||||
dnl # became
|
||||
dnl # bio_alloc(struct block_device *bdev, unsigned short nr_vecs, unsigned int opf, gfp_t gfp_mask)
|
||||
dnl # however
|
||||
dnl # > NULL/0 can be passed, both for the
|
||||
dnl # > passthrough case on a raw request_queue and to temporarily avoid
|
||||
dnl # > refactoring some nasty code.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_ALLOC_4ARG], [
|
||||
ZFS_LINUX_TEST_SRC([bio_alloc_4arg], [
|
||||
#include <linux/bio.h>
|
||||
],[
|
||||
gfp_t gfp_mask = 0;
|
||||
unsigned short nr_iovecs = 0;
|
||||
struct block_device *bdev = NULL;
|
||||
unsigned int opf = 0;
|
||||
|
||||
struct bio *__attribute__((unused)) allocated = bio_alloc(bdev, nr_iovecs, opf, gfp_mask);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BIO_ALLOC_4ARG], [
|
||||
AC_MSG_CHECKING([for 4-argument bio_alloc()])
|
||||
ZFS_LINUX_TEST_RESULT([bio_alloc_4arg],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_BIO_ALLOC_4ARG], 1, [bio_alloc() takes 4 arguments])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO], [
|
||||
ZFS_AC_KERNEL_SRC_REQ
|
||||
ZFS_AC_KERNEL_SRC_BIO_OPS
|
||||
@ -488,6 +523,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO], [
|
||||
ZFS_AC_KERNEL_SRC_BDEV_SUBMIT_BIO_RETURNS_VOID
|
||||
ZFS_AC_KERNEL_SRC_BIO_SET_DEV_MACRO
|
||||
ZFS_AC_KERNEL_SRC_BLK_CGROUP_HEADER
|
||||
ZFS_AC_KERNEL_SRC_BIO_ALLOC_4ARG
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BIO], [
|
||||
@ -512,4 +548,5 @@ AC_DEFUN([ZFS_AC_KERNEL_BIO], [
|
||||
ZFS_AC_KERNEL_BIO_BDEV_DISK
|
||||
ZFS_AC_KERNEL_BDEV_SUBMIT_BIO_RETURNS_VOID
|
||||
ZFS_AC_KERNEL_BLK_CGROUP_HEADER
|
||||
ZFS_AC_KERNEL_BIO_ALLOC_4ARG
|
||||
])
|
||||
|
@ -2,12 +2,6 @@ dnl #
|
||||
dnl # Handle differences in kernel FPU code.
|
||||
dnl #
|
||||
dnl # Kernel
|
||||
dnl # 5.16: XCR code put into asm/fpu/xcr.h
|
||||
dnl # HAVE_KERNEL_FPU_XCR_HEADER
|
||||
dnl #
|
||||
dnl # XSTATE_XSAVE and XSTATE_XRESTORE aren't accessible any more
|
||||
dnl # HAVE_KERNEL_FPU_XSAVE_INTERNAL
|
||||
dnl #
|
||||
dnl # 5.11: kernel_fpu_begin() is an inlined function now, so don't check
|
||||
dnl # for it inside the kernel symbols.
|
||||
dnl #
|
||||
@ -34,20 +28,8 @@ AC_DEFUN([ZFS_AC_KERNEL_FPU_HEADER], [
|
||||
AC_DEFINE(HAVE_KERNEL_FPU_API_HEADER, 1,
|
||||
[kernel has asm/fpu/api.h])
|
||||
AC_MSG_RESULT(asm/fpu/api.h)
|
||||
AC_MSG_CHECKING([whether fpu/xcr header is available])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/module.h>
|
||||
#include <asm/fpu/xcr.h>
|
||||
],[
|
||||
],[
|
||||
AC_DEFINE(HAVE_KERNEL_FPU_XCR_HEADER, 1,
|
||||
[kernel has asm/fpu/xcr.h])
|
||||
AC_MSG_RESULT(asm/fpu/xcr.h)
|
||||
],[
|
||||
AC_MSG_RESULT(no asm/fpu/xcr.h)
|
||||
])
|
||||
],[
|
||||
AC_MSG_RESULT(i387.h & xcr.h)
|
||||
AC_MSG_RESULT(i387.h)
|
||||
])
|
||||
])
|
||||
|
||||
@ -56,9 +38,9 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FPU], [
|
||||
#include <linux/types.h>
|
||||
#ifdef HAVE_KERNEL_FPU_API_HEADER
|
||||
#include <asm/fpu/api.h>
|
||||
#include <asm/fpu/internal.h>
|
||||
#else
|
||||
#include <asm/i387.h>
|
||||
#include <asm/xcr.h>
|
||||
#endif
|
||||
], [
|
||||
kernel_fpu_begin();
|
||||
@ -69,80 +51,15 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FPU], [
|
||||
#include <linux/types.h>
|
||||
#ifdef HAVE_KERNEL_FPU_API_HEADER
|
||||
#include <asm/fpu/api.h>
|
||||
#include <asm/fpu/internal.h>
|
||||
#else
|
||||
#include <asm/i387.h>
|
||||
#include <asm/xcr.h>
|
||||
#endif
|
||||
], [
|
||||
__kernel_fpu_begin();
|
||||
__kernel_fpu_end();
|
||||
], [], [ZFS_META_LICENSE])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([fpu_internal], [
|
||||
#if defined(__x86_64) || defined(__x86_64__) || \
|
||||
defined(__i386) || defined(__i386__)
|
||||
#if !defined(__x86)
|
||||
#define __x86
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(__x86)
|
||||
#error Unsupported architecture
|
||||
#endif
|
||||
|
||||
#include <linux/types.h>
|
||||
#ifdef HAVE_KERNEL_FPU_API_HEADER
|
||||
#include <asm/fpu/api.h>
|
||||
#include <asm/fpu/internal.h>
|
||||
#else
|
||||
#include <asm/i387.h>
|
||||
#include <asm/xcr.h>
|
||||
#endif
|
||||
|
||||
#if !defined(XSTATE_XSAVE)
|
||||
#error XSTATE_XSAVE not defined
|
||||
#endif
|
||||
|
||||
#if !defined(XSTATE_XRESTORE)
|
||||
#error XSTATE_XRESTORE not defined
|
||||
#endif
|
||||
],[
|
||||
struct fpu *fpu = ¤t->thread.fpu;
|
||||
union fpregs_state *st = &fpu->state;
|
||||
struct fregs_state *fr __attribute__ ((unused)) = &st->fsave;
|
||||
struct fxregs_state *fxr __attribute__ ((unused)) = &st->fxsave;
|
||||
struct xregs_state *xr __attribute__ ((unused)) = &st->xsave;
|
||||
])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([fpu_xsave_internal], [
|
||||
#include <linux/sched.h>
|
||||
#if defined(__x86_64) || defined(__x86_64__) || \
|
||||
defined(__i386) || defined(__i386__)
|
||||
#if !defined(__x86)
|
||||
#define __x86
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(__x86)
|
||||
#error Unsupported architecture
|
||||
#endif
|
||||
|
||||
#include <linux/types.h>
|
||||
#ifdef HAVE_KERNEL_FPU_API_HEADER
|
||||
#include <asm/fpu/api.h>
|
||||
#include <asm/fpu/internal.h>
|
||||
#else
|
||||
#include <asm/i387.h>
|
||||
#include <asm/xcr.h>
|
||||
#endif
|
||||
|
||||
],[
|
||||
struct fpu *fpu = ¤t->thread.fpu;
|
||||
union fpregs_state *st = &fpu->fpstate->regs;
|
||||
struct fregs_state *fr __attribute__ ((unused)) = &st->fsave;
|
||||
struct fxregs_state *fxr __attribute__ ((unused)) = &st->fxsave;
|
||||
struct xregs_state *xr __attribute__ ((unused)) = &st->xsave;
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_FPU], [
|
||||
@ -169,19 +86,9 @@ AC_DEFUN([ZFS_AC_KERNEL_FPU], [
|
||||
AC_DEFINE(KERNEL_EXPORTS_X86_FPU, 1,
|
||||
[kernel exports FPU functions])
|
||||
],[
|
||||
ZFS_LINUX_TEST_RESULT([fpu_internal], [
|
||||
AC_MSG_RESULT(internal)
|
||||
AC_DEFINE(HAVE_KERNEL_FPU_INTERNAL, 1,
|
||||
[kernel fpu internal])
|
||||
],[
|
||||
ZFS_LINUX_TEST_RESULT([fpu_xsave_internal], [
|
||||
AC_MSG_RESULT(internal with internal XSAVE)
|
||||
AC_DEFINE(HAVE_KERNEL_FPU_XSAVE_INTERNAL, 1,
|
||||
[kernel fpu and XSAVE internal])
|
||||
],[
|
||||
AC_MSG_RESULT(unavailable)
|
||||
])
|
||||
])
|
||||
AC_MSG_RESULT(internal)
|
||||
AC_DEFINE(HAVE_KERNEL_FPU_INTERNAL, 1,
|
||||
[kernel fpu internal])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
@ -8,14 +8,14 @@ dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_REVALIDATE_DISK], [
|
||||
|
||||
ZFS_LINUX_TEST_SRC([revalidate_disk_size], [
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/blkdev.h>
|
||||
], [
|
||||
struct gendisk *disk = NULL;
|
||||
(void) revalidate_disk_size(disk, false);
|
||||
])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([revalidate_disk], [
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/blkdev.h>
|
||||
], [
|
||||
struct gendisk *disk = NULL;
|
||||
(void) revalidate_disk(disk);
|
||||
|
27
sys/contrib/openzfs/config/kernel-zero_page.m4
Normal file
27
sys/contrib/openzfs/config/kernel-zero_page.m4
Normal file
@ -0,0 +1,27 @@
|
||||
dnl #
|
||||
dnl # ZERO_PAGE() is an alias for emtpy_zero_page. On certain architectures
|
||||
dnl # this is a GPL exported variable.
|
||||
dnl #
|
||||
|
||||
dnl #
|
||||
dnl # Checking if ZERO_PAGE is exported GPL-only
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_ZERO_PAGE], [
|
||||
ZFS_LINUX_TEST_SRC([zero_page], [
|
||||
#include <asm/pgtable.h>
|
||||
], [
|
||||
struct page *p __attribute__ ((unused));
|
||||
p = ZERO_PAGE(0);
|
||||
], [], [ZFS_META_LICENSE])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_ZERO_PAGE], [
|
||||
AC_MSG_CHECKING([whether ZERO_PAGE() is GPL-only])
|
||||
ZFS_LINUX_TEST_RESULT([zero_page_license], [
|
||||
AC_MSG_RESULT(no)
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_ZERO_PAGE_GPL_ONLY, 1,
|
||||
[ZERO_PAGE() is GPL-only])
|
||||
])
|
||||
])
|
@ -137,6 +137,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
|
||||
ZFS_AC_KERNEL_SRC_PAGEMAP_FOLIO_WAIT_BIT
|
||||
ZFS_AC_KERNEL_SRC_ADD_DISK
|
||||
ZFS_AC_KERNEL_SRC_KTHREAD
|
||||
ZFS_AC_KERNEL_SRC_ZERO_PAGE
|
||||
|
||||
AC_MSG_CHECKING([for available kernel interfaces])
|
||||
ZFS_LINUX_TEST_COMPILE_ALL([kabi])
|
||||
@ -247,6 +248,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
|
||||
ZFS_AC_KERNEL_PAGEMAP_FOLIO_WAIT_BIT
|
||||
ZFS_AC_KERNEL_ADD_DISK
|
||||
ZFS_AC_KERNEL_KTHREAD
|
||||
ZFS_AC_KERNEL_ZERO_PAGE
|
||||
])
|
||||
|
||||
dnl #
|
||||
|
7
sys/contrib/openzfs/config/user-aio.h.m4
Normal file
7
sys/contrib/openzfs/config/user-aio.h.m4
Normal file
@ -0,0 +1,7 @@
|
||||
dnl #
|
||||
dnl # POSIX specifies <aio.h> as part of realtime extensions,
|
||||
dnl # and is missing from at least uClibc – force fallbacks there
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_CONFIG_USER_AIO_H], [
|
||||
ZFS_AC_FIND_SYSTEM_LIBRARY(AIO_H, [], [aio.h], [], [rt], [lio_listio])
|
||||
])
|
@ -1,5 +1,5 @@
|
||||
dnl #
|
||||
dnl # Check for libaio - only used for libaiot test cases.
|
||||
dnl # Check for libaio - only used for mmap_libaio test cases.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_CONFIG_USER_LIBAIO], [
|
||||
ZFS_AC_FIND_SYSTEM_LIBRARY(LIBAIO, [], [libaio.h], [], [aio], [], [user_libaio=yes], [user_libaio=no])
|
||||
|
@ -23,6 +23,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [
|
||||
ZFS_AC_CONFIG_USER_LIBAIO
|
||||
ZFS_AC_CONFIG_USER_LIBATOMIC
|
||||
ZFS_AC_CONFIG_USER_LIBFETCH
|
||||
ZFS_AC_CONFIG_USER_AIO_H
|
||||
ZFS_AC_CONFIG_USER_CLOCK_GETTIME
|
||||
ZFS_AC_CONFIG_USER_PAM
|
||||
ZFS_AC_CONFIG_USER_RUNSTATEDIR
|
||||
|
@ -152,7 +152,7 @@ alloc_pw_string(const char *source)
|
||||
static void
|
||||
pw_free(pw_password_t *pw)
|
||||
{
|
||||
bzero(pw->value, pw->len);
|
||||
memset(pw->value, 0, pw->len);
|
||||
if (try_lock(munlock, pw->value, pw->len) == 0) {
|
||||
(void) munmap(pw->value, pw->len);
|
||||
}
|
||||
|
@ -85,13 +85,13 @@ extern void uu_warn(const char *, ...)
|
||||
__attribute__((format(printf, 1, 2)));
|
||||
extern void uu_vwarn(const char *, va_list)
|
||||
__attribute__((format(printf, 1, 0)));
|
||||
extern _Noreturn void uu_die(const char *, ...)
|
||||
extern __attribute__((noreturn)) void uu_die(const char *, ...)
|
||||
__attribute__((format(printf, 1, 2)));
|
||||
extern _Noreturn void uu_vdie(const char *, va_list)
|
||||
extern __attribute__((noreturn)) void uu_vdie(const char *, va_list)
|
||||
__attribute__((format(printf, 1, 0)));
|
||||
extern _Noreturn void uu_xdie(int, const char *, ...)
|
||||
extern __attribute__((noreturn)) void uu_xdie(int, const char *, ...)
|
||||
__attribute__((format(printf, 2, 3)));
|
||||
extern _Noreturn void uu_vxdie(int, const char *, va_list)
|
||||
extern __attribute__((noreturn)) void uu_vxdie(int, const char *, va_list)
|
||||
__attribute__((format(printf, 2, 0)));
|
||||
|
||||
/*
|
||||
|
@ -22,7 +22,6 @@ KERNEL_H = \
|
||||
inttypes.h \
|
||||
isa_defs.h \
|
||||
kmem_cache.h \
|
||||
kidmap.h \
|
||||
kmem.h \
|
||||
kstat.h \
|
||||
list_impl.h \
|
||||
@ -48,7 +47,6 @@ KERNEL_H = \
|
||||
simd.h \
|
||||
spl_condvar.h \
|
||||
string.h \
|
||||
strings.h \
|
||||
sunddi.h \
|
||||
sysmacros.h \
|
||||
systeminfo.h \
|
||||
|
@ -132,7 +132,7 @@ typedef struct callb_cpr {
|
||||
#define CALLB_CPR_INIT(cp, lockp, func, name) { \
|
||||
strlcpy(curthread->td_name, (name), \
|
||||
sizeof (curthread->td_name)); \
|
||||
bzero((caddr_t)(cp), sizeof (callb_cpr_t)); \
|
||||
memset(cp, 0, sizeof (callb_cpr_t)); \
|
||||
(cp)->cc_lockp = lockp; \
|
||||
(cp)->cc_id = callb_add(func, (void *)(cp), \
|
||||
CB_CL_CPR_DAEMON, name); \
|
||||
|
@ -48,138 +48,20 @@ extern "C" {
|
||||
typedef struct ucred cred_t;
|
||||
|
||||
#define CRED() curthread->td_ucred
|
||||
|
||||
/*
|
||||
* kcred is used when you need all privileges.
|
||||
*/
|
||||
#define kcred (thread0.td_ucred)
|
||||
|
||||
#define KUID_TO_SUID(x) (x)
|
||||
#define KGID_TO_SGID(x) (x)
|
||||
#define crgetuid(cred) ((cred)->cr_uid)
|
||||
#define crgetruid(cred) ((cred)->cr_ruid)
|
||||
#define crgetgid(cred) ((cred)->cr_gid)
|
||||
#define crgetgroups(cred) ((cred)->cr_groups)
|
||||
#define crgetngroups(cred) ((cred)->cr_ngroups)
|
||||
#define crgetsid(cred, i) (NULL)
|
||||
|
||||
struct proc; /* cred.h is included in proc.h */
|
||||
struct prcred;
|
||||
struct ksid;
|
||||
struct ksidlist;
|
||||
struct credklpd;
|
||||
struct credgrp;
|
||||
|
||||
struct auditinfo_addr; /* cred.h is included in audit.h */
|
||||
|
||||
extern int ngroups_max;
|
||||
/*
|
||||
* kcred is used when you need all privileges.
|
||||
*/
|
||||
|
||||
extern void cred_init(void);
|
||||
extern void crfree(cred_t *);
|
||||
extern cred_t *cralloc(void); /* all but ref uninitialized */
|
||||
extern cred_t *cralloc_ksid(void); /* cralloc() + ksid alloc'ed */
|
||||
extern cred_t *crget(void); /* initialized */
|
||||
extern void crcopy_to(cred_t *, cred_t *);
|
||||
extern cred_t *crdup(cred_t *);
|
||||
extern void crdup_to(cred_t *, cred_t *);
|
||||
extern cred_t *crgetcred(void);
|
||||
extern void crset(struct proc *, cred_t *);
|
||||
extern void crset_zone_privall(cred_t *);
|
||||
extern int supgroupmember(gid_t, const cred_t *);
|
||||
extern int hasprocperm(const cred_t *, const cred_t *);
|
||||
extern int prochasprocperm(struct proc *, struct proc *, const cred_t *);
|
||||
extern int crcmp(const cred_t *, const cred_t *);
|
||||
extern cred_t *zone_kcred(void);
|
||||
|
||||
extern gid_t crgetrgid(const cred_t *);
|
||||
extern gid_t crgetsgid(const cred_t *);
|
||||
|
||||
#define crgetzoneid(cr) ((cr)->cr_prison->pr_id)
|
||||
extern projid_t crgetprojid(const cred_t *);
|
||||
|
||||
extern cred_t *crgetmapped(const cred_t *);
|
||||
|
||||
|
||||
extern const struct auditinfo_addr *crgetauinfo(const cred_t *);
|
||||
extern struct auditinfo_addr *crgetauinfo_modifiable(cred_t *);
|
||||
|
||||
extern uint_t crgetref(const cred_t *);
|
||||
|
||||
extern const gid_t *crgetggroups(const struct credgrp *);
|
||||
|
||||
|
||||
/*
|
||||
* Sets real, effective and/or saved uid/gid;
|
||||
* -1 argument accepted as "no change".
|
||||
*/
|
||||
extern int crsetresuid(cred_t *, uid_t, uid_t, uid_t);
|
||||
extern int crsetresgid(cred_t *, gid_t, gid_t, gid_t);
|
||||
|
||||
/*
|
||||
* Sets real, effective and saved uids/gids all to the same
|
||||
* values. Both values must be non-negative and <= MAXUID
|
||||
*/
|
||||
extern int crsetugid(cred_t *, uid_t, gid_t);
|
||||
|
||||
/*
|
||||
* Functions to handle the supplemental group list.
|
||||
*/
|
||||
extern struct credgrp *crgrpcopyin(int, gid_t *);
|
||||
extern void crgrprele(struct credgrp *);
|
||||
extern void crsetcredgrp(cred_t *, struct credgrp *);
|
||||
|
||||
/*
|
||||
* Private interface for setting zone association of credential.
|
||||
*/
|
||||
struct zone;
|
||||
extern void crsetzone(cred_t *, struct zone *);
|
||||
extern struct zone *crgetzone(const cred_t *);
|
||||
|
||||
/*
|
||||
* Private interface for setting project id in credential.
|
||||
*/
|
||||
extern void crsetprojid(cred_t *, projid_t);
|
||||
|
||||
/*
|
||||
* Private interface for nfs.
|
||||
*/
|
||||
extern cred_t *crnetadjust(cred_t *);
|
||||
|
||||
/*
|
||||
* Private interface for procfs.
|
||||
*/
|
||||
extern void cred2prcred(const cred_t *, struct prcred *);
|
||||
|
||||
/*
|
||||
* Private interfaces for Rampart Trusted Solaris.
|
||||
*/
|
||||
struct ts_label_s;
|
||||
extern struct ts_label_s *crgetlabel(const cred_t *);
|
||||
extern boolean_t crisremote(const cred_t *);
|
||||
|
||||
/*
|
||||
* Private interfaces for ephemeral uids.
|
||||
*/
|
||||
#define VALID_UID(id, zn) \
|
||||
((id) <= MAXUID || valid_ephemeral_uid((zn), (id)))
|
||||
|
||||
#define VALID_GID(id, zn) \
|
||||
((id) <= MAXUID || valid_ephemeral_gid((zn), (id)))
|
||||
|
||||
extern boolean_t valid_ephemeral_uid(struct zone *, uid_t);
|
||||
extern boolean_t valid_ephemeral_gid(struct zone *, gid_t);
|
||||
|
||||
extern int eph_uid_alloc(struct zone *, int, uid_t *, int);
|
||||
extern int eph_gid_alloc(struct zone *, int, gid_t *, int);
|
||||
|
||||
extern void crsetsid(cred_t *, struct ksid *, int);
|
||||
extern void crsetsidlist(cred_t *, struct ksidlist *);
|
||||
|
||||
extern struct ksidlist *crgetsidlist(const cred_t *);
|
||||
|
||||
extern int crsetpriv(cred_t *, ...);
|
||||
|
||||
extern struct credklpd *crgetcrklpd(const cred_t *);
|
||||
extern void crsetcrklpd(cred_t *, struct credklpd *);
|
||||
#define crgetuid(cr) ((cr)->cr_uid)
|
||||
#define crgetruid(cr) ((cr)->cr_ruid)
|
||||
#define crgetgid(cr) ((cr)->cr_gid)
|
||||
#define crgetgroups(cr) ((cr)->cr_groups)
|
||||
#define crgetngroups(cr) ((cr)->cr_ngroups)
|
||||
#define crgetzoneid(cr) ((cr)->cr_prison->pr_id)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _OPENSOLARIS_SYS_KIDMAP_H_
|
||||
#define _OPENSOLARIS_SYS_KIDMAP_H_
|
||||
|
||||
#include <sys/idmap.h>
|
||||
|
||||
typedef int32_t idmap_stat;
|
||||
typedef void idmap_get_handle_t;
|
||||
|
||||
#define kidmap_get_create() (NULL)
|
||||
#define kidmap_get_destroy(hdl) do { } while (0)
|
||||
#define kidmap_get_mappings(hdl) (NULL)
|
||||
|
||||
#endif /* _OPENSOLARIS_SYS_KIDMAP_H_ */
|
@ -29,7 +29,6 @@
|
||||
#ifndef _OPENSOLARIS_SYS_SID_H_
|
||||
#define _OPENSOLARIS_SYS_SID_H_
|
||||
#include <sys/idmap.h>
|
||||
#include <sys/kidmap.h>
|
||||
|
||||
typedef struct ksiddomain {
|
||||
char *kd_name; /* Domain part of SID */
|
||||
@ -59,28 +58,4 @@ ksiddomain_rele(ksiddomain_t *kd)
|
||||
kmem_free(kd, sizeof (*kd));
|
||||
}
|
||||
|
||||
static __inline uint_t
|
||||
ksid_getid(ksid_t *ks)
|
||||
{
|
||||
|
||||
panic("%s has been unexpectedly called", __func__);
|
||||
}
|
||||
|
||||
static __inline const char *
|
||||
ksid_getdomain(ksid_t *ks)
|
||||
{
|
||||
|
||||
panic("%s has been unexpectedly called", __func__);
|
||||
}
|
||||
|
||||
static __inline uint_t
|
||||
ksid_getrid(ksid_t *ks)
|
||||
{
|
||||
|
||||
panic("%s has been unexpectedly called", __func__);
|
||||
}
|
||||
|
||||
#define kidmap_getsidbyuid(zone, uid, sid_prefix, rid) (1)
|
||||
#define kidmap_getsidbygid(zone, gid, sid_prefix, rid) (1)
|
||||
|
||||
#endif /* _OPENSOLARIS_SYS_SID_H_ */
|
||||
|
@ -1 +0,0 @@
|
||||
/* do not delete */
|
@ -85,23 +85,19 @@
|
||||
#undef CONFIG_X86_DEBUG_FPU
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_KERNEL_FPU_API_HEADER)
|
||||
#include <asm/fpu/api.h>
|
||||
#include <asm/fpu/internal.h>
|
||||
#if defined(HAVE_KERNEL_FPU_XCR_HEADER)
|
||||
#include <asm/fpu/xcr.h>
|
||||
#endif
|
||||
#else
|
||||
#include <asm/i387.h>
|
||||
#include <asm/xcr.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following cases are for kernels which export either the
|
||||
* kernel_fpu_* or __kernel_fpu_* functions.
|
||||
*/
|
||||
#if defined(KERNEL_EXPORTS_X86_FPU)
|
||||
|
||||
#if defined(HAVE_KERNEL_FPU_API_HEADER)
|
||||
#include <asm/fpu/api.h>
|
||||
#include <asm/fpu/internal.h>
|
||||
#else
|
||||
#include <asm/i387.h>
|
||||
#endif
|
||||
|
||||
#define kfpu_allowed() 1
|
||||
#define kfpu_init() 0
|
||||
#define kfpu_fini() ((void) 0)
|
||||
@ -136,29 +132,74 @@
|
||||
* When the kernel_fpu_* symbols are unavailable then provide our own
|
||||
* versions which allow the FPU to be safely used.
|
||||
*/
|
||||
#if defined(HAVE_KERNEL_FPU_INTERNAL) || defined(HAVE_KERNEL_FPU_XSAVE_INTERNAL)
|
||||
|
||||
#if defined(HAVE_KERNEL_FPU_XSAVE_INTERNAL)
|
||||
/*
|
||||
* Some sanity checks.
|
||||
* HAVE_KERNEL_FPU_INTERNAL and HAVE_KERNEL_FPU_XSAVE_INTERNAL are exclusive.
|
||||
*/
|
||||
#if defined(HAVE_KERNEL_FPU_INTERNAL)
|
||||
#error "HAVE_KERNEL_FPU_INTERNAL and HAVE_KERNEL_FPU_XSAVE_INTERNAL defined"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* For kernels >= 5.16 we have to use inline assembly with the XSAVE{,OPT,S}
|
||||
* instructions, so we need the toolchain to support at least XSAVE.
|
||||
* For kernels not exporting *kfpu_{begin,end} we have to use inline assembly
|
||||
* with the XSAVE{,OPT,S} instructions, so we need the toolchain to support at
|
||||
* least XSAVE.
|
||||
*/
|
||||
#if !defined(HAVE_XSAVE)
|
||||
#error "Toolchain needs to support the XSAVE assembler instruction"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <linux/mm.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
extern union fpregs_state **zfs_kfpu_fpregs;
|
||||
extern uint8_t **zfs_kfpu_fpregs;
|
||||
|
||||
/*
|
||||
* Return the size in bytes required by the XSAVE instruction for an
|
||||
* XSAVE area containing all the user state components supported by this CPU.
|
||||
* See: Intel 64 and IA-32 Architectures Software Developer’s Manual.
|
||||
* Dec. 2021. Vol. 2A p. 3-222.
|
||||
*/
|
||||
static inline uint32_t
|
||||
get_xsave_area_size(void)
|
||||
{
|
||||
if (!boot_cpu_has(X86_FEATURE_OSXSAVE)) {
|
||||
return (0);
|
||||
}
|
||||
/*
|
||||
* Call CPUID with leaf 13 and subleaf 0. The size is in ecx.
|
||||
* We don't need to check for cpuid_max here, since if this CPU has
|
||||
* OSXSAVE set, it has leaf 13 (0x0D) as well.
|
||||
*/
|
||||
uint32_t eax, ebx, ecx, edx;
|
||||
|
||||
eax = 13U;
|
||||
ecx = 0U;
|
||||
__asm__ __volatile__("cpuid"
|
||||
: "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
|
||||
: "a" (eax), "c" (ecx));
|
||||
|
||||
return (ecx);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the allocation order of the maximum buffer size required to save the
|
||||
* FPU state on this architecture. The value returned is the same as Linux'
|
||||
* get_order() function would return (i.e. 2^order = nr. of pages required).
|
||||
* Currently this will always return 0 since the save area is below 4k even for
|
||||
* a full fledged AVX-512 implementation.
|
||||
*/
|
||||
static inline int
|
||||
get_fpuregs_save_area_order(void)
|
||||
{
|
||||
size_t area_size = (size_t)get_xsave_area_size();
|
||||
|
||||
/*
|
||||
* If we are dealing with a CPU not supporting XSAVE,
|
||||
* get_xsave_area_size() will return 0. Thus the maximum memory
|
||||
* required is the FXSAVE area size which is 512 bytes. See: Intel 64
|
||||
* and IA-32 Architectures Software Developer’s Manual. Dec. 2021.
|
||||
* Vol. 2A p. 3-451.
|
||||
*/
|
||||
if (area_size == 0) {
|
||||
area_size = 512;
|
||||
}
|
||||
return (get_order(area_size));
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize per-cpu variables to store FPU state.
|
||||
@ -167,11 +208,11 @@ static inline void
|
||||
kfpu_fini(void)
|
||||
{
|
||||
int cpu;
|
||||
int order = get_fpuregs_save_area_order();
|
||||
|
||||
for_each_possible_cpu(cpu) {
|
||||
if (zfs_kfpu_fpregs[cpu] != NULL) {
|
||||
free_pages((unsigned long)zfs_kfpu_fpregs[cpu],
|
||||
get_order(sizeof (union fpregs_state)));
|
||||
free_pages((unsigned long)zfs_kfpu_fpregs[cpu], order);
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,8 +222,9 @@ kfpu_fini(void)
|
||||
static inline int
|
||||
kfpu_init(void)
|
||||
{
|
||||
zfs_kfpu_fpregs = kzalloc(num_possible_cpus() *
|
||||
sizeof (union fpregs_state *), GFP_KERNEL);
|
||||
zfs_kfpu_fpregs = kzalloc(num_possible_cpus() * sizeof (uint8_t *),
|
||||
GFP_KERNEL);
|
||||
|
||||
if (zfs_kfpu_fpregs == NULL)
|
||||
return (-ENOMEM);
|
||||
|
||||
@ -191,8 +233,8 @@ kfpu_init(void)
|
||||
* the target memory. Since kmalloc() provides no alignment
|
||||
* guarantee instead use alloc_pages_node().
|
||||
*/
|
||||
unsigned int order = get_order(sizeof (union fpregs_state));
|
||||
int cpu;
|
||||
int order = get_fpuregs_save_area_order();
|
||||
|
||||
for_each_possible_cpu(cpu) {
|
||||
struct page *page = alloc_pages_node(cpu_to_node(cpu),
|
||||
@ -209,9 +251,6 @@ kfpu_init(void)
|
||||
}
|
||||
|
||||
#define kfpu_allowed() 1
|
||||
#if defined(HAVE_KERNEL_FPU_INTERNAL)
|
||||
#define ex_handler_fprestore ex_handler_default
|
||||
#endif
|
||||
|
||||
/*
|
||||
* FPU save and restore instructions.
|
||||
@ -226,21 +265,6 @@ kfpu_init(void)
|
||||
#define kfpu_fxsr_clean(rval) __asm("fnclex; emms; fildl %P[addr]" \
|
||||
: : [addr] "m" (rval));
|
||||
|
||||
#if defined(HAVE_KERNEL_FPU_INTERNAL)
|
||||
static inline void
|
||||
kfpu_save_xsave(struct xregs_state *addr, uint64_t mask)
|
||||
{
|
||||
uint32_t low, hi;
|
||||
int err;
|
||||
|
||||
low = mask;
|
||||
hi = mask >> 32;
|
||||
XSTATE_XSAVE(addr, low, hi, err);
|
||||
WARN_ON_ONCE(err);
|
||||
}
|
||||
#endif /* defined(HAVE_KERNEL_FPU_INTERNAL) */
|
||||
|
||||
#if defined(HAVE_KERNEL_FPU_XSAVE_INTERNAL)
|
||||
#define kfpu_do_xsave(instruction, addr, mask) \
|
||||
{ \
|
||||
uint32_t low, hi; \
|
||||
@ -252,10 +276,9 @@ kfpu_save_xsave(struct xregs_state *addr, uint64_t mask)
|
||||
: [dst] "m" (*(addr)), "a" (low), "d" (hi) \
|
||||
: "memory"); \
|
||||
}
|
||||
#endif /* defined(HAVE_KERNEL_FPU_XSAVE_INTERNAL) */
|
||||
|
||||
static inline void
|
||||
kfpu_save_fxsr(struct fxregs_state *addr)
|
||||
kfpu_save_fxsr(uint8_t *addr)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_X86_32))
|
||||
kfpu_fxsave(addr);
|
||||
@ -264,12 +287,11 @@ kfpu_save_fxsr(struct fxregs_state *addr)
|
||||
}
|
||||
|
||||
static inline void
|
||||
kfpu_save_fsave(struct fregs_state *addr)
|
||||
kfpu_save_fsave(uint8_t *addr)
|
||||
{
|
||||
kfpu_fnsave(addr);
|
||||
}
|
||||
|
||||
#if defined(HAVE_KERNEL_FPU_INTERNAL)
|
||||
static inline void
|
||||
kfpu_begin(void)
|
||||
{
|
||||
@ -286,70 +308,28 @@ kfpu_begin(void)
|
||||
* per-cpu variable, not in the task struct, this allows any user
|
||||
* FPU state to be correctly preserved and restored.
|
||||
*/
|
||||
union fpregs_state *state = zfs_kfpu_fpregs[smp_processor_id()];
|
||||
if (static_cpu_has(X86_FEATURE_XSAVE)) {
|
||||
kfpu_save_xsave(&state->xsave, ~0);
|
||||
} else if (static_cpu_has(X86_FEATURE_FXSR)) {
|
||||
kfpu_save_fxsr(&state->fxsave);
|
||||
} else {
|
||||
kfpu_save_fsave(&state->fsave);
|
||||
}
|
||||
}
|
||||
#endif /* defined(HAVE_KERNEL_FPU_INTERNAL) */
|
||||
|
||||
#if defined(HAVE_KERNEL_FPU_XSAVE_INTERNAL)
|
||||
static inline void
|
||||
kfpu_begin(void)
|
||||
{
|
||||
/*
|
||||
* Preemption and interrupts must be disabled for the critical
|
||||
* region where the FPU state is being modified.
|
||||
*/
|
||||
preempt_disable();
|
||||
local_irq_disable();
|
||||
|
||||
/*
|
||||
* The current FPU registers need to be preserved by kfpu_begin()
|
||||
* and restored by kfpu_end(). They are stored in a dedicated
|
||||
* per-cpu variable, not in the task struct, this allows any user
|
||||
* FPU state to be correctly preserved and restored.
|
||||
*/
|
||||
union fpregs_state *state = zfs_kfpu_fpregs[smp_processor_id()];
|
||||
uint8_t *state = zfs_kfpu_fpregs[smp_processor_id()];
|
||||
#if defined(HAVE_XSAVES)
|
||||
if (static_cpu_has(X86_FEATURE_XSAVES)) {
|
||||
kfpu_do_xsave("xsaves", &state->xsave, ~0);
|
||||
kfpu_do_xsave("xsaves", state, ~0);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#if defined(HAVE_XSAVEOPT)
|
||||
if (static_cpu_has(X86_FEATURE_XSAVEOPT)) {
|
||||
kfpu_do_xsave("xsaveopt", &state->xsave, ~0);
|
||||
kfpu_do_xsave("xsaveopt", state, ~0);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (static_cpu_has(X86_FEATURE_XSAVE)) {
|
||||
kfpu_do_xsave("xsave", &state->xsave, ~0);
|
||||
kfpu_do_xsave("xsave", state, ~0);
|
||||
} else if (static_cpu_has(X86_FEATURE_FXSR)) {
|
||||
kfpu_save_fxsr(&state->fxsave);
|
||||
kfpu_save_fxsr(state);
|
||||
} else {
|
||||
kfpu_save_fsave(&state->fsave);
|
||||
kfpu_save_fsave(state);
|
||||
}
|
||||
}
|
||||
#endif /* defined(HAVE_KERNEL_FPU_XSAVE_INTERNAL) */
|
||||
|
||||
#if defined(HAVE_KERNEL_FPU_INTERNAL)
|
||||
static inline void
|
||||
kfpu_restore_xsave(struct xregs_state *addr, uint64_t mask)
|
||||
{
|
||||
uint32_t low, hi;
|
||||
|
||||
low = mask;
|
||||
hi = mask >> 32;
|
||||
XSTATE_XRESTORE(addr, low, hi);
|
||||
}
|
||||
#endif /* defined(HAVE_KERNEL_FPU_INTERNAL) */
|
||||
|
||||
#if defined(HAVE_KERNEL_FPU_XSAVE_INTERNAL)
|
||||
#define kfpu_do_xrstor(instruction, addr, mask) \
|
||||
{ \
|
||||
uint32_t low, hi; \
|
||||
@ -361,10 +341,9 @@ kfpu_restore_xsave(struct xregs_state *addr, uint64_t mask)
|
||||
: [src] "m" (*(addr)), "a" (low), "d" (hi) \
|
||||
: "memory"); \
|
||||
}
|
||||
#endif /* defined(HAVE_KERNEL_FPU_XSAVE_INTERNAL) */
|
||||
|
||||
static inline void
|
||||
kfpu_restore_fxsr(struct fxregs_state *addr)
|
||||
kfpu_restore_fxsr(uint8_t *addr)
|
||||
{
|
||||
/*
|
||||
* On AuthenticAMD K7 and K8 processors the fxrstor instruction only
|
||||
@ -382,67 +361,40 @@ kfpu_restore_fxsr(struct fxregs_state *addr)
|
||||
}
|
||||
|
||||
static inline void
|
||||
kfpu_restore_fsave(struct fregs_state *addr)
|
||||
kfpu_restore_fsave(uint8_t *addr)
|
||||
{
|
||||
kfpu_frstor(addr);
|
||||
}
|
||||
|
||||
#if defined(HAVE_KERNEL_FPU_INTERNAL)
|
||||
static inline void
|
||||
kfpu_end(void)
|
||||
{
|
||||
union fpregs_state *state = zfs_kfpu_fpregs[smp_processor_id()];
|
||||
|
||||
if (static_cpu_has(X86_FEATURE_XSAVE)) {
|
||||
kfpu_restore_xsave(&state->xsave, ~0);
|
||||
} else if (static_cpu_has(X86_FEATURE_FXSR)) {
|
||||
kfpu_restore_fxsr(&state->fxsave);
|
||||
} else {
|
||||
kfpu_restore_fsave(&state->fsave);
|
||||
}
|
||||
|
||||
local_irq_enable();
|
||||
preempt_enable();
|
||||
}
|
||||
#endif /* defined(HAVE_KERNEL_FPU_INTERNAL) */
|
||||
|
||||
#if defined(HAVE_KERNEL_FPU_XSAVE_INTERNAL)
|
||||
static inline void
|
||||
kfpu_end(void)
|
||||
{
|
||||
union fpregs_state *state = zfs_kfpu_fpregs[smp_processor_id()];
|
||||
uint8_t *state = zfs_kfpu_fpregs[smp_processor_id()];
|
||||
#if defined(HAVE_XSAVES)
|
||||
if (static_cpu_has(X86_FEATURE_XSAVES)) {
|
||||
kfpu_do_xrstor("xrstors", &state->xsave, ~0);
|
||||
kfpu_do_xrstor("xrstors", state, ~0);
|
||||
goto out;
|
||||
}
|
||||
#endif
|
||||
if (static_cpu_has(X86_FEATURE_XSAVE)) {
|
||||
kfpu_do_xrstor("xrstor", &state->xsave, ~0);
|
||||
kfpu_do_xrstor("xrstor", state, ~0);
|
||||
} else if (static_cpu_has(X86_FEATURE_FXSR)) {
|
||||
kfpu_save_fxsr(&state->fxsave);
|
||||
kfpu_restore_fxsr(state);
|
||||
} else {
|
||||
kfpu_save_fsave(&state->fsave);
|
||||
kfpu_restore_fsave(state);
|
||||
}
|
||||
out:
|
||||
local_irq_enable();
|
||||
preempt_enable();
|
||||
|
||||
}
|
||||
#endif /* defined(HAVE_KERNEL_FPU_XSAVE_INTERNAL) */
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* FPU support is unavailable.
|
||||
*/
|
||||
#define kfpu_allowed() 0
|
||||
#define kfpu_begin() do {} while (0)
|
||||
#define kfpu_end() do {} while (0)
|
||||
#define kfpu_init() 0
|
||||
#define kfpu_fini() ((void) 0)
|
||||
#error "Exactly one of KERNEL_EXPORTS_X86_FPU or HAVE_KERNEL_FPU_INTERNAL" \
|
||||
" must be defined"
|
||||
|
||||
#endif /* defined(HAVE_KERNEL_FPU_INTERNAL || HAVE_KERNEL_FPU_XSAVE_INTERNAL) */
|
||||
#endif /* defined(HAVE_KERNEL_FPU_INTERNAL */
|
||||
#endif /* defined(KERNEL_EXPORTS_X86_FPU) */
|
||||
|
||||
/*
|
||||
@ -452,6 +404,25 @@ kfpu_end(void)
|
||||
/*
|
||||
* Detect register set support
|
||||
*/
|
||||
|
||||
/*
|
||||
* Check if OS supports AVX and AVX2 by checking XCR0
|
||||
* Only call this function if CPUID indicates that AVX feature is
|
||||
* supported by the CPU, otherwise it might be an illegal instruction.
|
||||
*/
|
||||
static inline uint64_t
|
||||
zfs_xgetbv(uint32_t index)
|
||||
{
|
||||
uint32_t eax, edx;
|
||||
/* xgetbv - instruction byte code */
|
||||
__asm__ __volatile__(".byte 0x0f; .byte 0x01; .byte 0xd0"
|
||||
: "=a" (eax), "=d" (edx)
|
||||
: "c" (index));
|
||||
|
||||
return ((((uint64_t)edx)<<32) | (uint64_t)eax);
|
||||
}
|
||||
|
||||
|
||||
static inline boolean_t
|
||||
__simd_state_enabled(const uint64_t state)
|
||||
{
|
||||
@ -466,7 +437,7 @@ __simd_state_enabled(const uint64_t state)
|
||||
if (!has_osxsave)
|
||||
return (B_FALSE);
|
||||
|
||||
xcr0 = xgetbv(0);
|
||||
xcr0 = zfs_xgetbv(0);
|
||||
return ((xcr0 & state) == state);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ KERNEL_H = \
|
||||
signal.h \
|
||||
simd.h \
|
||||
stat.h \
|
||||
strings.h \
|
||||
string.h \
|
||||
sunddi.h \
|
||||
sysmacros.h \
|
||||
systeminfo.h \
|
||||
|
@ -49,12 +49,7 @@ extern void crhold(cred_t *cr);
|
||||
extern void crfree(cred_t *cr);
|
||||
extern uid_t crgetuid(const cred_t *cr);
|
||||
extern uid_t crgetruid(const cred_t *cr);
|
||||
extern uid_t crgetsuid(const cred_t *cr);
|
||||
extern uid_t crgetfsuid(const cred_t *cr);
|
||||
extern gid_t crgetgid(const cred_t *cr);
|
||||
extern gid_t crgetrgid(const cred_t *cr);
|
||||
extern gid_t crgetsgid(const cred_t *cr);
|
||||
extern gid_t crgetfsgid(const cred_t *cr);
|
||||
extern int crgetngroups(const cred_t *cr);
|
||||
extern gid_t *crgetgroups(const cred_t *cr);
|
||||
extern int groupmember(gid_t gid, const cred_t *cr);
|
||||
|
1
sys/contrib/openzfs/include/os/linux/spl/sys/string.h
Normal file
1
sys/contrib/openzfs/include/os/linux/spl/sys/string.h
Normal file
@ -0,0 +1 @@
|
||||
#include <linux/string.h>
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Lawrence Livermore National Security, LLC.
|
||||
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
|
||||
* UCRL-CODE-235197
|
||||
*
|
||||
* This file is part of the SPL, Solaris Porting Layer.
|
||||
*
|
||||
* The SPL is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* The SPL is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with the SPL. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef _SPL_SYS_STRINGS_H
|
||||
#define _SPL_SYS_STRINGS_H
|
||||
|
||||
#include <linux/string.h>
|
||||
|
||||
#define bzero(ptr, size) memset(ptr, 0, size)
|
||||
#define bcopy(src, dest, size) memmove(dest, src, size)
|
||||
#define bcmp(src, dest, size) memcmp((src), (dest), (size_t)(size))
|
||||
|
||||
#endif /* _SPL_SYS_STRINGS_H */
|
@ -53,7 +53,7 @@ typedef void (*thread_func_t)(void *);
|
||||
__thread_create(stk, stksize, (thread_func_t)func, #func, \
|
||||
arg, len, pp, state, pri)
|
||||
|
||||
#define thread_exit() __thread_exit()
|
||||
#define thread_exit() spl_thread_exit()
|
||||
#define thread_join(t) VERIFY(0)
|
||||
#define curthread current
|
||||
#define getcomm() current->comm
|
||||
@ -62,10 +62,16 @@ typedef void (*thread_func_t)(void *);
|
||||
extern kthread_t *__thread_create(caddr_t stk, size_t stksize,
|
||||
thread_func_t func, const char *name, void *args, size_t len, proc_t *pp,
|
||||
int state, pri_t pri);
|
||||
extern __attribute__((noreturn)) void __thread_exit(void);
|
||||
extern struct task_struct *spl_kthread_create(int (*func)(void *),
|
||||
void *data, const char namefmt[], ...);
|
||||
|
||||
static inline __attribute__((noreturn)) void
|
||||
spl_thread_exit(void)
|
||||
{
|
||||
tsd_exit();
|
||||
SPL_KTHREAD_COMPLETE_AND_EXIT(NULL, 0);
|
||||
}
|
||||
|
||||
extern proc_t p0;
|
||||
|
||||
#ifdef HAVE_SIGINFO
|
||||
|
@ -73,18 +73,15 @@ typedef struct efi_gpe_Attrs {
|
||||
RequiredPartition :1;
|
||||
} efi_gpe_Attrs_t;
|
||||
|
||||
/* MBR partition identification tags */
|
||||
#define V_UNASSIGNED 0x00 /* unassigned partition */
|
||||
#define V_USR 0x04 /* Usr filesystem */
|
||||
#define V_RESERVED 0x0b /* SMI reserved data */
|
||||
|
||||
/*
|
||||
* 6a96237f-1dd2-11b2-99a6-080020736631 V_UNASSIGNED (not used as such)
|
||||
* 6a82cb45-1dd2-11b2-99a6-080020736631 V_BOOT
|
||||
* 6a85cf4d-1dd2-11b2-99a6-080020736631 V_ROOT
|
||||
* 6a87c46f-1dd2-11b2-99a6-080020736631 V_SWAP
|
||||
* 6a898cc3-1dd2-11b2-99a6-080020736631 V_USR
|
||||
* 6a8b642b-1dd2-11b2-99a6-080020736631 V_BACKUP
|
||||
* 6a8d2ac7-1dd2-11b2-99a6-080020736631 V_STAND (not used)
|
||||
* 6a8ef2e9-1dd2-11b2-99a6-080020736631 V_VAR
|
||||
* 6a90ba39-1dd2-11b2-99a6-080020736631 V_HOME
|
||||
* 6a9283a5-1dd2-11b2-99a6-080020736631 V_ALTSCTR
|
||||
* 6a945a3b-1dd2-11b2-99a6-080020736631 V_CACHE
|
||||
* 6a945a3b-1dd2-11b2-99a6-080020736631 V_RESERVED
|
||||
*/
|
||||
|
||||
#define EFI_UNUSED { 0x00000000, 0x0000, 0x0000, 0x00, 0x00, \
|
||||
@ -363,6 +360,11 @@ struct partition64 {
|
||||
#endif
|
||||
|
||||
#ifndef _KERNEL
|
||||
#define VT_ERROR (-2) /* errno supplies specific error */
|
||||
#define VT_EIO (-3) /* I/O error accessing vtoc */
|
||||
#define VT_EINVAL (-4) /* illegal value in vtoc or request */
|
||||
#define VT_ENOSPC (-6) /* requested space not found */
|
||||
|
||||
_SYS_EFI_PARTITION_H int efi_debug;
|
||||
_SYS_EFI_PARTITION_H int efi_alloc_and_init(int, uint32_t, struct dk_gpt **);
|
||||
_SYS_EFI_PARTITION_H int efi_alloc_and_read(int, struct dk_gpt **);
|
||||
|
@ -1185,6 +1185,7 @@ typedef struct vdev_stat {
|
||||
uint64_t vs_logical_ashift; /* vdev_logical_ashift */
|
||||
uint64_t vs_physical_ashift; /* vdev_physical_ashift */
|
||||
uint64_t vs_noalloc; /* allocations halted? */
|
||||
uint64_t vs_pspace; /* physical capacity */
|
||||
} vdev_stat_t;
|
||||
|
||||
#define VDEV_STAT_VALID(field, uint64_t_field_count) \
|
||||
|
@ -40,7 +40,7 @@
|
||||
#define _SYS_XVATTR_H
|
||||
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/strings.h>
|
||||
#include <sys/string.h>
|
||||
|
||||
#define AV_SCANSTAMP_SZ 32 /* length of anti-virus scanstamp */
|
||||
|
||||
@ -282,7 +282,7 @@ typedef struct xvattr {
|
||||
static inline void
|
||||
xva_init(xvattr_t *xvap)
|
||||
{
|
||||
bzero(xvap, sizeof (xvattr_t));
|
||||
memset(xvap, 0, sizeof (xvattr_t));
|
||||
xvap->xva_mapsize = XVA_MAPSIZE;
|
||||
xvap->xva_magic = XVA_MAGIC;
|
||||
xvap->xva_vattr.va_mask = ATTR_XVATTR;
|
||||
|
@ -55,7 +55,7 @@ extern "C" {
|
||||
#include <sys/disp.h>
|
||||
#include <sys/debug.h>
|
||||
#include <sys/random.h>
|
||||
#include <sys/strings.h>
|
||||
#include <sys/string.h>
|
||||
#include <sys/byteorder.h>
|
||||
#include <sys/list.h>
|
||||
#include <sys/time.h>
|
||||
@ -91,7 +91,6 @@ extern "C" {
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <pthread.h>
|
||||
#include <setjmp.h>
|
||||
#include <assert.h>
|
||||
@ -153,13 +152,8 @@ extern void dprintf_setup(int *argc, char **argv);
|
||||
|
||||
extern void cmn_err(int, const char *, ...);
|
||||
extern void vcmn_err(int, const char *, va_list);
|
||||
#if defined(__cplusplus) && __cplusplus >= 201103L
|
||||
extern void panic(const char *, ...) __attribute__((__noreturn__));
|
||||
extern void vpanic(const char *, va_list) __attribute__((__noreturn__));
|
||||
#else
|
||||
extern _Noreturn void panic(const char *, ...);
|
||||
extern _Noreturn void vpanic(const char *, va_list);
|
||||
#endif
|
||||
extern __attribute__((noreturn)) void panic(const char *, ...);
|
||||
extern __attribute__((noreturn)) void vpanic(const char *, va_list);
|
||||
|
||||
#define fm_panic panic
|
||||
|
||||
|
@ -29,14 +29,12 @@
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <unistd.h>
|
||||
#include <uuid/uuid.h>
|
||||
#include <zlib.h>
|
||||
#include <libintl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/dkio.h>
|
||||
#include <sys/vtoc.h>
|
||||
#include <sys/mhd.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/dktp/fdisk.h>
|
||||
@ -857,7 +855,6 @@ efi_read(int fd, struct dk_gpt *vtoc)
|
||||
}
|
||||
|
||||
for (i = 0; i < vtoc->efi_nparts; i++) {
|
||||
|
||||
UUID_LE_CONVERT(vtoc->efi_parts[i].p_guid,
|
||||
efi_parts[i].efi_gpe_PartitionTypeGUID);
|
||||
|
||||
@ -865,7 +862,7 @@ efi_read(int fd, struct dk_gpt *vtoc)
|
||||
j < sizeof (conversion_array)
|
||||
/ sizeof (struct uuid_to_ptag); j++) {
|
||||
|
||||
if (bcmp(&vtoc->efi_parts[i].p_guid,
|
||||
if (memcmp(&vtoc->efi_parts[i].p_guid,
|
||||
&conversion_array[j].uuid,
|
||||
sizeof (struct uuid)) == 0) {
|
||||
vtoc->efi_parts[i].p_tag = j;
|
||||
@ -920,18 +917,17 @@ write_pmbr(int fd, struct dk_gpt *vtoc)
|
||||
/* LINTED -- always longlong aligned */
|
||||
dk_ioc.dki_data = (efi_gpt_t *)buf;
|
||||
if (efi_ioctl(fd, DKIOCGETEFI, &dk_ioc) == -1) {
|
||||
(void) memcpy(&mb, buf, sizeof (mb));
|
||||
bzero(&mb, sizeof (mb));
|
||||
memset(&mb, 0, sizeof (mb));
|
||||
mb.signature = LE_16(MBB_MAGIC);
|
||||
} else {
|
||||
(void) memcpy(&mb, buf, sizeof (mb));
|
||||
if (mb.signature != LE_16(MBB_MAGIC)) {
|
||||
bzero(&mb, sizeof (mb));
|
||||
memset(&mb, 0, sizeof (mb));
|
||||
mb.signature = LE_16(MBB_MAGIC);
|
||||
}
|
||||
}
|
||||
|
||||
bzero(&mb.parts, sizeof (mb.parts));
|
||||
memset(&mb.parts, 0, sizeof (mb.parts));
|
||||
cp = (uchar_t *)&mb.parts[0];
|
||||
/* bootable or not */
|
||||
*cp++ = 0;
|
||||
@ -1455,8 +1451,8 @@ efi_write(int fd, struct dk_gpt *vtoc)
|
||||
(void) uuid_generate((uchar_t *)
|
||||
&vtoc->efi_parts[i].p_uguid);
|
||||
}
|
||||
bcopy(&vtoc->efi_parts[i].p_uguid,
|
||||
&efi_parts[i].efi_gpe_UniquePartitionGUID,
|
||||
memcpy(&efi_parts[i].efi_gpe_UniquePartitionGUID,
|
||||
&vtoc->efi_parts[i].p_uguid,
|
||||
sizeof (uuid_t));
|
||||
}
|
||||
efi->efi_gpt_PartitionEntryArrayCRC32 =
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <sys/debug.h>
|
||||
|
||||
@ -46,12 +46,10 @@
|
||||
static int
|
||||
nvlist_print_json_string(FILE *fp, const char *input)
|
||||
{
|
||||
mbstate_t mbr;
|
||||
mbstate_t mbr = {0};
|
||||
wchar_t c;
|
||||
size_t sz;
|
||||
|
||||
bzero(&mbr, sizeof (mbr));
|
||||
|
||||
FPRINTF(fp, "\"");
|
||||
while ((sz = mbrtowc(&c, input, MB_CUR_MAX, &mbr)) > 0) {
|
||||
if (sz == (size_t)-1 || sz == (size_t)-2) {
|
||||
|
@ -27,8 +27,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <strings.h>
|
||||
#include <libintl.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include <dirent.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/file.h>
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
@ -29,7 +29,7 @@ libspl_HEADERS = \
|
||||
simd.h \
|
||||
stack.h \
|
||||
stdtypes.h \
|
||||
strings.h \
|
||||
string.h \
|
||||
stropts.h \
|
||||
sunddi.h \
|
||||
systeminfo.h \
|
||||
@ -43,6 +43,5 @@ libspl_HEADERS = \
|
||||
va_list.h \
|
||||
varargs.h \
|
||||
vnode.h \
|
||||
vtoc.h \
|
||||
wmsum.h \
|
||||
zone.h
|
||||
|
@ -383,9 +383,9 @@ typedef struct kstat32 {
|
||||
*
|
||||
* ksp->ks_snaptime = gethrtime();
|
||||
* if (rw == KSTAT_WRITE)
|
||||
* bcopy(buf, ksp->ks_data, ksp->ks_data_size);
|
||||
* memcpy(ksp->ks_data, buf, ksp->ks_data_size);
|
||||
* else
|
||||
* bcopy(ksp->ks_data, buf, ksp->ks_data_size);
|
||||
* memcpy(buf, ksp->ks_data, ksp->ks_data_size);
|
||||
* return (0);
|
||||
*
|
||||
* A more illuminating example is taking a snapshot of a linked list:
|
||||
@ -394,7 +394,7 @@ typedef struct kstat32 {
|
||||
* if (rw == KSTAT_WRITE)
|
||||
* return (EACCES); ... See below ...
|
||||
* for (foo = first_foo; foo; foo = foo->next) {
|
||||
* bcopy((char *) foo, (char *) buf, sizeof (struct foo));
|
||||
* memcpy(buf, foo, sizeof (struct foo));
|
||||
* buf = ((struct foo *) buf) + 1;
|
||||
* }
|
||||
* return (0);
|
||||
@ -423,12 +423,12 @@ typedef struct kstat32 {
|
||||
* uint_t i;
|
||||
*
|
||||
* ... Do the regular copy ...
|
||||
* bcopy(ksp->ks_data, buf, sizeof (kstat_named_t) * ksp->ks_ndata);
|
||||
* memcpy(buf, ksp->ks_data, sizeof (kstat_named_t) * ksp->ks_ndata);
|
||||
*
|
||||
* for (i = 0; i < ksp->ks_ndata; i++, knp++) {
|
||||
* if (knp[i].data_type == KSTAT_DATA_STRING &&
|
||||
* KSTAT_NAMED_STR_PTR(knp) != NULL) {
|
||||
* bcopy(KSTAT_NAMED_STR_PTR(knp), end,
|
||||
* memcpy(end, KSTAT_NAMED_STR_PTR(knp),
|
||||
* KSTAT_NAMED_STR_BUFLEN(knp));
|
||||
* KSTAT_NAMED_STR_PTR(knp) = end;
|
||||
* end += KSTAT_NAMED_STR_BUFLEN(knp);
|
||||
|
1
sys/contrib/openzfs/lib/libspl/include/sys/string.h
Normal file
1
sys/contrib/openzfs/lib/libspl/include/sys/string.h
Normal file
@ -0,0 +1 @@
|
||||
#include <string.h>
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_STRINGS_H
|
||||
#define _LIBSPL_SYS_STRINGS_H
|
||||
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
|
||||
#endif
|
@ -1,350 +0,0 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
|
||||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
|
||||
#ifndef _SYS_VTOC_H
|
||||
#define _SYS_VTOC_H
|
||||
|
||||
#include <sys/dklabel.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Note: the VTOC is not implemented fully, nor in the manner
|
||||
* that AT&T implements it. AT&T puts the vtoc structure
|
||||
* into a sector, usually the second sector (pdsector is first).
|
||||
*
|
||||
* Sun incorporates the tag, flag, version, and volume vtoc fields into
|
||||
* its Disk Label, which already has some vtoc-equivalent fields.
|
||||
* Upon reading the vtoc with read_vtoc(), the following exceptions
|
||||
* occur:
|
||||
* v_bootinfo [all] returned as zero
|
||||
* v_sanity returned as VTOC_SANE
|
||||
* if Disk Label was sane
|
||||
* v_sectorsz returned as 512
|
||||
* v_reserved [all] returned as zero
|
||||
* timestamp [all] returned as zero
|
||||
*
|
||||
* See dklabel.h, read_vtoc(), and write_vtoc().
|
||||
*/
|
||||
|
||||
#define V_NUMPAR NDKMAP /* The number of partitions */
|
||||
/* (from dkio.h) */
|
||||
|
||||
#define VTOC_SANE 0x600DDEEE /* Indicates a sane VTOC */
|
||||
#define V_VERSION 0x01 /* layout version number */
|
||||
#define V_EXTVERSION V_VERSION /* extvtoc layout version number */
|
||||
|
||||
/*
|
||||
* Partition identification tags
|
||||
*/
|
||||
#define V_UNASSIGNED 0x00 /* unassigned partition */
|
||||
#define V_BOOT 0x01 /* Boot partition */
|
||||
#define V_ROOT 0x02 /* Root filesystem */
|
||||
#define V_SWAP 0x03 /* Swap filesystem */
|
||||
#define V_USR 0x04 /* Usr filesystem */
|
||||
#define V_BACKUP 0x05 /* full disk */
|
||||
#define V_STAND 0x06 /* Stand partition */
|
||||
#define V_VAR 0x07 /* Var partition */
|
||||
#define V_HOME 0x08 /* Home partition */
|
||||
#define V_ALTSCTR 0x09 /* Alternate sector partition */
|
||||
#define V_CACHE 0x0a /* Cache (cachefs) partition */
|
||||
#define V_RESERVED 0x0b /* SMI reserved data */
|
||||
|
||||
/*
|
||||
* Partition permission flags
|
||||
*/
|
||||
#define V_UNMNT 0x01 /* Unmountable partition */
|
||||
#define V_RONLY 0x10 /* Read only */
|
||||
|
||||
/*
|
||||
* error codes for reading & writing vtoc
|
||||
*/
|
||||
#define VT_ERROR (-2) /* errno supplies specific error */
|
||||
#define VT_EIO (-3) /* I/O error accessing vtoc */
|
||||
#define VT_EINVAL (-4) /* illegal value in vtoc or request */
|
||||
#define VT_ENOTSUP (-5) /* VTOC op. not supported */
|
||||
#define VT_ENOSPC (-6) /* requested space not found */
|
||||
#define VT_EOVERFLOW (-7) /* VTOC op. data struct limited */
|
||||
|
||||
struct partition {
|
||||
ushort_t p_tag; /* ID tag of partition */
|
||||
ushort_t p_flag; /* permission flags */
|
||||
uint64_t p_start; /* start sector no of partition */
|
||||
long p_size; /* # of blocks in partition */
|
||||
};
|
||||
|
||||
struct vtoc {
|
||||
unsigned long v_bootinfo[3]; /* info needed by mboot (unsupported) */
|
||||
unsigned long v_sanity; /* to verify vtoc sanity */
|
||||
unsigned long v_version; /* layout version */
|
||||
char v_volume[LEN_DKL_VVOL]; /* volume name */
|
||||
ushort_t v_sectorsz; /* sector size in bytes */
|
||||
ushort_t v_nparts; /* number of partitions */
|
||||
unsigned long v_reserved[10]; /* free space */
|
||||
struct partition v_part[V_NUMPAR]; /* partition headers */
|
||||
time_t timestamp[V_NUMPAR]; /* partition timestamp (unsupported) */
|
||||
char v_asciilabel[LEN_DKL_ASCII]; /* for compatibility */
|
||||
};
|
||||
|
||||
struct extpartition {
|
||||
ushort_t p_tag; /* ID tag of partition */
|
||||
ushort_t p_flag; /* permission flags */
|
||||
ushort_t p_pad[2];
|
||||
diskaddr_t p_start; /* start sector no of partition */
|
||||
diskaddr_t p_size; /* # of blocks in partition */
|
||||
};
|
||||
|
||||
|
||||
struct extvtoc {
|
||||
uint64_t v_bootinfo[3]; /* info needed by mboot (unsupported) */
|
||||
uint64_t v_sanity; /* to verify vtoc sanity */
|
||||
uint64_t v_version; /* layout version */
|
||||
char v_volume[LEN_DKL_VVOL]; /* volume name */
|
||||
ushort_t v_sectorsz; /* sector size in bytes */
|
||||
ushort_t v_nparts; /* number of partitions */
|
||||
ushort_t pad[2];
|
||||
uint64_t v_reserved[10];
|
||||
struct extpartition v_part[V_NUMPAR]; /* partition headers */
|
||||
uint64_t timestamp[V_NUMPAR]; /* partition timestamp (unsupported) */
|
||||
char v_asciilabel[LEN_DKL_ASCII]; /* for compatibility */
|
||||
};
|
||||
|
||||
#ifdef _KERNEL
|
||||
#define extvtoctovtoc(extv, v) \
|
||||
{ \
|
||||
int i; \
|
||||
v.v_bootinfo[0] = (unsigned long)extv.v_bootinfo[0]; \
|
||||
v.v_bootinfo[1] = (unsigned long)extv.v_bootinfo[1]; \
|
||||
v.v_bootinfo[2] = (unsigned long)extv.v_bootinfo[2]; \
|
||||
v.v_sanity = (unsigned long)extv.v_sanity; \
|
||||
v.v_version = (unsigned long)extv.v_version; \
|
||||
bcopy(extv.v_volume, v.v_volume, LEN_DKL_VVOL); \
|
||||
v.v_sectorsz = extv.v_sectorsz; \
|
||||
v.v_nparts = extv.v_nparts; \
|
||||
for (i = 0; i < 10; i++) \
|
||||
v.v_reserved[i] = (unsigned long)extv.v_reserved[i]; \
|
||||
for (i = 0; i < V_NUMPAR; i++) { \
|
||||
v.v_part[i].p_tag = extv.v_part[i].p_tag; \
|
||||
v.v_part[i].p_flag = extv.v_part[i].p_flag; \
|
||||
v.v_part[i].p_start = (uint64_t)extv.v_part[i].p_start; \
|
||||
v.v_part[i].p_size = (long)extv.v_part[i].p_size; \
|
||||
v.timestamp[i] = (time_t)extv.timestamp[i]; \
|
||||
} \
|
||||
bcopy(extv.v_asciilabel, v.v_asciilabel, LEN_DKL_ASCII); \
|
||||
}
|
||||
|
||||
#define vtoctoextvtoc(v, extv) \
|
||||
{ \
|
||||
int i; \
|
||||
extv.v_bootinfo[0] = (uint64_t)v.v_bootinfo[0]; \
|
||||
extv.v_bootinfo[1] = (uint64_t)v.v_bootinfo[1]; \
|
||||
extv.v_bootinfo[2] = (uint64_t)v.v_bootinfo[2]; \
|
||||
extv.v_sanity = (uint64_t)v.v_sanity; \
|
||||
extv.v_version = (uint64_t)v.v_version; \
|
||||
bcopy(v.v_volume, extv.v_volume, LEN_DKL_VVOL); \
|
||||
extv.v_sectorsz = v.v_sectorsz; \
|
||||
extv.v_nparts = v.v_nparts; \
|
||||
for (i = 0; i < 10; i++) \
|
||||
extv.v_reserved[i] = (uint64_t)v.v_reserved[i]; \
|
||||
for (i = 0; i < V_NUMPAR; i++) { \
|
||||
extv.v_part[i].p_tag = v.v_part[i].p_tag; \
|
||||
extv.v_part[i].p_flag = v.v_part[i].p_flag; \
|
||||
extv.v_part[i].p_start = \
|
||||
(diskaddr_t)(unsigned long)v.v_part[i].p_start; \
|
||||
extv.v_part[i].p_size = \
|
||||
(diskaddr_t)(unsigned long)v.v_part[i].p_size; \
|
||||
extv.timestamp[i] = (uint64_t)v.timestamp[i]; \
|
||||
} \
|
||||
bcopy(v.v_asciilabel, extv.v_asciilabel, LEN_DKL_ASCII); \
|
||||
}
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#if defined(_SYSCALL32)
|
||||
struct partition32 {
|
||||
uint16_t p_tag; /* ID tag of partition */
|
||||
uint16_t p_flag; /* permission flags */
|
||||
daddr32_t p_start; /* start sector no of partition */
|
||||
int32_t p_size; /* # of blocks in partition */
|
||||
};
|
||||
|
||||
struct vtoc32 {
|
||||
uint32_t v_bootinfo[3]; /* info needed by mboot (unsupported) */
|
||||
uint32_t v_sanity; /* to verify vtoc sanity */
|
||||
uint32_t v_version; /* layout version */
|
||||
char v_volume[LEN_DKL_VVOL]; /* volume name */
|
||||
uint16_t v_sectorsz; /* sector size in bytes */
|
||||
uint16_t v_nparts; /* number of partitions */
|
||||
uint32_t v_reserved[10]; /* free space */
|
||||
struct partition32 v_part[V_NUMPAR]; /* partition headers */
|
||||
time32_t timestamp[V_NUMPAR]; /* partition timestamp (unsupported) */
|
||||
char v_asciilabel[LEN_DKL_ASCII]; /* for compatibility */
|
||||
};
|
||||
|
||||
#define vtoc32tovtoc(v32, v) \
|
||||
{ \
|
||||
int i; \
|
||||
v.v_bootinfo[0] = v32.v_bootinfo[0]; \
|
||||
v.v_bootinfo[1] = v32.v_bootinfo[1]; \
|
||||
v.v_bootinfo[2] = v32.v_bootinfo[2]; \
|
||||
v.v_sanity = v32.v_sanity; \
|
||||
v.v_version = v32.v_version; \
|
||||
bcopy(v32.v_volume, v.v_volume, LEN_DKL_VVOL); \
|
||||
v.v_sectorsz = v32.v_sectorsz; \
|
||||
v.v_nparts = v32.v_nparts; \
|
||||
v.v_version = v32.v_version; \
|
||||
for (i = 0; i < 10; i++) \
|
||||
v.v_reserved[i] = v32.v_reserved[i]; \
|
||||
for (i = 0; i < V_NUMPAR; i++) { \
|
||||
v.v_part[i].p_tag = (ushort_t)v32.v_part[i].p_tag; \
|
||||
v.v_part[i].p_flag = (ushort_t)v32.v_part[i].p_flag; \
|
||||
v.v_part[i].p_start = (unsigned)v32.v_part[i].p_start; \
|
||||
v.v_part[i].p_size = (unsigned)v32.v_part[i].p_size; \
|
||||
} \
|
||||
for (i = 0; i < V_NUMPAR; i++) \
|
||||
v.timestamp[i] = (time_t)v32.timestamp[i]; \
|
||||
bcopy(v32.v_asciilabel, v.v_asciilabel, LEN_DKL_ASCII); \
|
||||
}
|
||||
|
||||
#define vtoc32toextvtoc(v32, extv) \
|
||||
{ \
|
||||
int i; \
|
||||
extv.v_bootinfo[0] = v32.v_bootinfo[0]; \
|
||||
extv.v_bootinfo[1] = v32.v_bootinfo[1]; \
|
||||
extv.v_bootinfo[2] = v32.v_bootinfo[2]; \
|
||||
extv.v_sanity = v32.v_sanity; \
|
||||
extv.v_version = v32.v_version; \
|
||||
bcopy(v32.v_volume, extv.v_volume, LEN_DKL_VVOL); \
|
||||
extv.v_sectorsz = v32.v_sectorsz; \
|
||||
extv.v_nparts = v32.v_nparts; \
|
||||
extv.v_version = v32.v_version; \
|
||||
for (i = 0; i < 10; i++) \
|
||||
extv.v_reserved[i] = v32.v_reserved[i]; \
|
||||
for (i = 0; i < V_NUMPAR; i++) { \
|
||||
extv.v_part[i].p_tag = (ushort_t)v32.v_part[i].p_tag; \
|
||||
extv.v_part[i].p_flag = (ushort_t)v32.v_part[i].p_flag; \
|
||||
extv.v_part[i].p_start = (diskaddr_t)v32.v_part[i].p_start; \
|
||||
extv.v_part[i].p_size = (diskaddr_t)v32.v_part[i].p_size; \
|
||||
extv.timestamp[i] = (time_t)v32.timestamp[i]; \
|
||||
} \
|
||||
bcopy(v32.v_asciilabel, extv.v_asciilabel, LEN_DKL_ASCII); \
|
||||
}
|
||||
|
||||
|
||||
#define vtoctovtoc32(v, v32) \
|
||||
{ \
|
||||
int i; \
|
||||
v32.v_bootinfo[0] = v.v_bootinfo[0]; \
|
||||
v32.v_bootinfo[1] = v.v_bootinfo[1]; \
|
||||
v32.v_bootinfo[2] = v.v_bootinfo[2]; \
|
||||
v32.v_sanity = v.v_sanity; \
|
||||
v32.v_version = v.v_version; \
|
||||
bcopy(v.v_volume, v32.v_volume, LEN_DKL_VVOL); \
|
||||
v32.v_sectorsz = v.v_sectorsz; \
|
||||
v32.v_nparts = v.v_nparts; \
|
||||
v32.v_version = v.v_version; \
|
||||
for (i = 0; i < 10; i++) \
|
||||
v32.v_reserved[i] = v.v_reserved[i]; \
|
||||
for (i = 0; i < V_NUMPAR; i++) { \
|
||||
v32.v_part[i].p_tag = (ushort_t)v.v_part[i].p_tag; \
|
||||
v32.v_part[i].p_flag = (ushort_t)v.v_part[i].p_flag; \
|
||||
v32.v_part[i].p_start = (unsigned)v.v_part[i].p_start; \
|
||||
v32.v_part[i].p_size = (unsigned)v.v_part[i].p_size; \
|
||||
} \
|
||||
for (i = 0; i < V_NUMPAR; i++) { \
|
||||
if (v.timestamp[i] > TIME32_MAX) \
|
||||
v32.timestamp[i] = TIME32_MAX; \
|
||||
else \
|
||||
v32.timestamp[i] = (time32_t)v.timestamp[i]; \
|
||||
} \
|
||||
bcopy(v.v_asciilabel, v32.v_asciilabel, LEN_DKL_ASCII); \
|
||||
}
|
||||
|
||||
#define extvtoctovtoc32(extv, v32) \
|
||||
{ \
|
||||
int i; \
|
||||
v32.v_bootinfo[0] = extv.v_bootinfo[0]; \
|
||||
v32.v_bootinfo[1] = extv.v_bootinfo[1]; \
|
||||
v32.v_bootinfo[2] = extv.v_bootinfo[2]; \
|
||||
v32.v_sanity = extv.v_sanity; \
|
||||
v32.v_version = extv.v_version; \
|
||||
bcopy(extv.v_volume, v32.v_volume, LEN_DKL_VVOL); \
|
||||
v32.v_sectorsz = extv.v_sectorsz; \
|
||||
v32.v_nparts = extv.v_nparts; \
|
||||
v32.v_version = extv.v_version; \
|
||||
for (i = 0; i < 10; i++) \
|
||||
v32.v_reserved[i] = extv.v_reserved[i]; \
|
||||
for (i = 0; i < V_NUMPAR; i++) { \
|
||||
v32.v_part[i].p_tag = (ushort_t)extv.v_part[i].p_tag; \
|
||||
v32.v_part[i].p_flag = (ushort_t)extv.v_part[i].p_flag; \
|
||||
v32.v_part[i].p_start = (unsigned)extv.v_part[i].p_start; \
|
||||
v32.v_part[i].p_size = (unsigned)extv.v_part[i].p_size; \
|
||||
} \
|
||||
for (i = 0; i < V_NUMPAR; i++) { \
|
||||
if (extv.timestamp[i] > TIME32_MAX) \
|
||||
v32.timestamp[i] = TIME32_MAX; \
|
||||
else \
|
||||
v32.timestamp[i] = (time32_t)extv.timestamp[i]; \
|
||||
} \
|
||||
bcopy(extv.v_asciilabel, v32.v_asciilabel, LEN_DKL_ASCII); \
|
||||
}
|
||||
|
||||
|
||||
#endif /* _SYSCALL32 */
|
||||
|
||||
/*
|
||||
* These defines are the mode parameter for the checksum routines.
|
||||
*/
|
||||
#define CK_CHECKSUM 0 /* check checksum */
|
||||
#define CK_MAKESUM 1 /* generate checksum */
|
||||
|
||||
#if defined(__STDC__)
|
||||
|
||||
extern int read_vtoc(int, struct vtoc *);
|
||||
extern int write_vtoc(int, struct vtoc *);
|
||||
extern int read_extvtoc(int, struct extvtoc *);
|
||||
extern int write_extvtoc(int, struct extvtoc *);
|
||||
|
||||
#else
|
||||
|
||||
extern int read_vtoc();
|
||||
extern int write_vtoc();
|
||||
extern int read_extvtoc();
|
||||
extern int write_extvtoc();
|
||||
|
||||
#endif /* __STDC__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_VTOC_H */
|
@ -40,7 +40,7 @@
|
||||
|
||||
static const char *pname;
|
||||
|
||||
static _Noreturn void
|
||||
static __attribute__((noreturn)) void
|
||||
uu_die_internal(int status, const char *format, va_list alist);
|
||||
|
||||
int uu_exit_ok_value = EXIT_SUCCESS;
|
||||
@ -110,7 +110,7 @@ uu_warn(const char *format, ...)
|
||||
va_end(alist);
|
||||
}
|
||||
|
||||
static __attribute__((format(printf, 2, 0))) _Noreturn void
|
||||
static __attribute__((format(printf, 2, 0))) __attribute__((noreturn)) void
|
||||
uu_die_internal(int status, const char *format, va_list alist)
|
||||
{
|
||||
uu_warn_internal(errno, format, alist);
|
||||
|
@ -193,7 +193,7 @@ namespace_reload(libzfs_handle_t *hdl)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
verify(nvpair_value_nvlist(elem, &child) == 0);
|
||||
child = fnvpair_value_nvlist(elem);
|
||||
if (nvlist_dup(child, &cn->cn_config, 0) != 0) {
|
||||
free(cn->cn_name);
|
||||
free(cn);
|
||||
|
@ -614,7 +614,6 @@ get_key_material_https(libzfs_handle_t *hdl, const char *uri,
|
||||
kfdok:
|
||||
if ((key = fdopen(kfd, "r+")) == NULL) {
|
||||
ret = errno;
|
||||
free(path);
|
||||
(void) close(kfd);
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"Couldn't reopen temporary file: %s"), strerror(ret));
|
||||
@ -789,7 +788,7 @@ derive_key(libzfs_handle_t *hdl, zfs_keyformat_t format, uint64_t iters,
|
||||
|
||||
switch (format) {
|
||||
case ZFS_KEYFORMAT_RAW:
|
||||
bcopy(key_material, key, WRAPPING_KEY_LEN);
|
||||
memcpy(key, key_material, WRAPPING_KEY_LEN);
|
||||
break;
|
||||
case ZFS_KEYFORMAT_HEX:
|
||||
ret = hex_key_to_raw((char *)key_material,
|
||||
|
@ -234,7 +234,6 @@ process_user_props(zfs_handle_t *zhp, nvlist_t *props)
|
||||
{
|
||||
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
||||
nvpair_t *elem;
|
||||
nvlist_t *propval;
|
||||
nvlist_t *nvl;
|
||||
|
||||
if (nvlist_alloc(&nvl, NV_UNIQUE_NAME, 0) != 0) {
|
||||
@ -247,7 +246,7 @@ process_user_props(zfs_handle_t *zhp, nvlist_t *props)
|
||||
if (!zfs_prop_user(nvpair_name(elem)))
|
||||
continue;
|
||||
|
||||
verify(nvpair_value_nvlist(elem, &propval) == 0);
|
||||
nvlist_t *propval = fnvpair_value_nvlist(elem);
|
||||
if (nvlist_add_nvlist(nvl, nvpair_name(elem), propval) != 0) {
|
||||
nvlist_free(nvl);
|
||||
(void) no_memory(hdl);
|
||||
@ -1315,8 +1314,7 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl,
|
||||
/* Replace the label string with the internal form. */
|
||||
(void) nvlist_remove(ret, zfs_prop_to_name(prop),
|
||||
DATA_TYPE_STRING);
|
||||
verify(nvlist_add_string(ret, zfs_prop_to_name(prop),
|
||||
hex) == 0);
|
||||
fnvlist_add_string(ret, zfs_prop_to_name(prop), hex);
|
||||
free(hex);
|
||||
|
||||
break;
|
||||
@ -2056,7 +2054,7 @@ getprop_uint64(zfs_handle_t *zhp, zfs_prop_t prop, char **source)
|
||||
*source = NULL;
|
||||
if (nvlist_lookup_nvlist(zhp->zfs_props,
|
||||
zfs_prop_to_name(prop), &nv) == 0) {
|
||||
verify(nvlist_lookup_uint64(nv, ZPROP_VALUE, &value) == 0);
|
||||
value = fnvlist_lookup_uint64(nv, ZPROP_VALUE);
|
||||
(void) nvlist_lookup_string(nv, ZPROP_SOURCE, source);
|
||||
} else {
|
||||
verify(!zhp->zfs_props_table ||
|
||||
@ -2385,8 +2383,7 @@ zfs_prop_get_recvd(zfs_handle_t *zhp, const char *propname, char *propbuf,
|
||||
if (nvlist_lookup_nvlist(zhp->zfs_recvd_props,
|
||||
propname, &propval) != 0)
|
||||
return (-1);
|
||||
verify(nvlist_lookup_string(propval, ZPROP_VALUE,
|
||||
&recvdval) == 0);
|
||||
recvdval = fnvlist_lookup_string(propval, ZPROP_VALUE);
|
||||
(void) strlcpy(propbuf, recvdval, proplen);
|
||||
}
|
||||
|
||||
@ -2500,13 +2497,11 @@ zfs_get_clones_nvl(zfs_handle_t *zhp)
|
||||
}
|
||||
nvlist_free(nv);
|
||||
nvlist_free(value);
|
||||
verify(0 == nvlist_lookup_nvlist(zhp->zfs_props,
|
||||
zfs_prop_to_name(ZFS_PROP_CLONES), &nv));
|
||||
nv = fnvlist_lookup_nvlist(zhp->zfs_props,
|
||||
zfs_prop_to_name(ZFS_PROP_CLONES));
|
||||
}
|
||||
|
||||
verify(nvlist_lookup_nvlist(nv, ZPROP_VALUE, &value) == 0);
|
||||
|
||||
return (value);
|
||||
return (fnvlist_lookup_nvlist(nv, ZPROP_VALUE));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -3863,7 +3858,7 @@ zfs_check_snap_cb(zfs_handle_t *zhp, void *arg)
|
||||
return (EINVAL);
|
||||
|
||||
if (lzc_exists(name))
|
||||
verify(nvlist_add_boolean(dd->nvl, name) == 0);
|
||||
fnvlist_add_boolean(dd->nvl, name);
|
||||
|
||||
rv = zfs_iter_filesystems(zhp, zfs_check_snap_cb, dd);
|
||||
zfs_close(zhp);
|
||||
@ -3880,7 +3875,7 @@ zfs_destroy_snaps(zfs_handle_t *zhp, char *snapname, boolean_t defer)
|
||||
struct destroydata dd = { 0 };
|
||||
|
||||
dd.snapname = snapname;
|
||||
verify(nvlist_alloc(&dd.nvl, NV_UNIQUE_NAME, 0) == 0);
|
||||
dd.nvl = fnvlist_alloc();
|
||||
(void) zfs_check_snap_cb(zfs_handle_dup(zhp), &dd);
|
||||
|
||||
if (nvlist_empty(dd.nvl)) {
|
||||
@ -3890,7 +3885,7 @@ zfs_destroy_snaps(zfs_handle_t *zhp, char *snapname, boolean_t defer)
|
||||
} else {
|
||||
ret = zfs_destroy_snaps_nvl(zhp->zfs_hdl, dd.nvl, defer);
|
||||
}
|
||||
nvlist_free(dd.nvl);
|
||||
fnvlist_free(dd.nvl);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@ -4221,7 +4216,7 @@ zfs_snapshot(libzfs_handle_t *hdl, const char *path, boolean_t recursive,
|
||||
return (-1);
|
||||
}
|
||||
|
||||
verify(nvlist_alloc(&sd.sd_nvl, NV_UNIQUE_NAME, 0) == 0);
|
||||
sd.sd_nvl = fnvlist_alloc();
|
||||
if (recursive) {
|
||||
(void) zfs_snapshot_cb(zfs_handle_dup(zhp), &sd);
|
||||
} else {
|
||||
@ -4229,7 +4224,7 @@ zfs_snapshot(libzfs_handle_t *hdl, const char *path, boolean_t recursive,
|
||||
}
|
||||
|
||||
ret = zfs_snapshot_nvl(hdl, sd.sd_nvl, props);
|
||||
nvlist_free(sd.sd_nvl);
|
||||
fnvlist_free(sd.sd_nvl);
|
||||
zfs_close(zhp);
|
||||
return (ret);
|
||||
}
|
||||
@ -4712,8 +4707,8 @@ zfs_expand_proplist(zfs_handle_t *zhp, zprop_list_t **plp, boolean_t received,
|
||||
} else {
|
||||
if (nvlist_lookup_nvlist(userprops, entry->pl_user_prop,
|
||||
&propval) == 0) {
|
||||
verify(nvlist_lookup_string(propval,
|
||||
ZPROP_VALUE, &strval) == 0);
|
||||
strval = fnvlist_lookup_string(propval,
|
||||
ZPROP_VALUE);
|
||||
if (strlen(strval) > entry->pl_width)
|
||||
entry->pl_width = strlen(strval);
|
||||
}
|
||||
|
@ -48,7 +48,6 @@ pool_active(libzfs_handle_t *hdl, const char *name, uint64_t guid,
|
||||
boolean_t *isactive)
|
||||
{
|
||||
zpool_handle_t *zhp;
|
||||
uint64_t theguid;
|
||||
|
||||
if (zpool_open_silent(hdl, name, &zhp) != 0)
|
||||
return (-1);
|
||||
@ -58,8 +57,8 @@ pool_active(libzfs_handle_t *hdl, const char *name, uint64_t guid,
|
||||
return (0);
|
||||
}
|
||||
|
||||
verify(nvlist_lookup_uint64(zhp->zpool_config, ZPOOL_CONFIG_POOL_GUID,
|
||||
&theguid) == 0);
|
||||
uint64_t theguid = fnvlist_lookup_uint64(zhp->zpool_config,
|
||||
ZPOOL_CONFIG_POOL_GUID);
|
||||
|
||||
zpool_close(zhp);
|
||||
|
||||
@ -239,12 +238,10 @@ zpool_clear_label(int fd)
|
||||
static boolean_t
|
||||
find_guid(nvlist_t *nv, uint64_t guid)
|
||||
{
|
||||
uint64_t tmp;
|
||||
nvlist_t **child;
|
||||
uint_t c, children;
|
||||
|
||||
verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID, &tmp) == 0);
|
||||
if (tmp == guid)
|
||||
if (fnvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID) == guid)
|
||||
return (B_TRUE);
|
||||
|
||||
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
|
||||
@ -268,18 +265,16 @@ find_aux(zpool_handle_t *zhp, void *data)
|
||||
{
|
||||
aux_cbdata_t *cbp = data;
|
||||
nvlist_t **list;
|
||||
uint_t i, count;
|
||||
uint64_t guid;
|
||||
nvlist_t *nvroot;
|
||||
uint_t count;
|
||||
|
||||
verify(nvlist_lookup_nvlist(zhp->zpool_config, ZPOOL_CONFIG_VDEV_TREE,
|
||||
&nvroot) == 0);
|
||||
nvlist_t *nvroot = fnvlist_lookup_nvlist(zhp->zpool_config,
|
||||
ZPOOL_CONFIG_VDEV_TREE);
|
||||
|
||||
if (nvlist_lookup_nvlist_array(nvroot, cbp->cb_type,
|
||||
&list, &count) == 0) {
|
||||
for (i = 0; i < count; i++) {
|
||||
verify(nvlist_lookup_uint64(list[i],
|
||||
ZPOOL_CONFIG_GUID, &guid) == 0);
|
||||
for (uint_t i = 0; i < count; i++) {
|
||||
uint64_t guid = fnvlist_lookup_uint64(list[i],
|
||||
ZPOOL_CONFIG_GUID);
|
||||
if (guid == cbp->cb_guid) {
|
||||
cbp->cb_zhp = zhp;
|
||||
return (1);
|
||||
@ -301,9 +296,9 @@ zpool_in_use(libzfs_handle_t *hdl, int fd, pool_state_t *state, char **namestr,
|
||||
boolean_t *inuse)
|
||||
{
|
||||
nvlist_t *config;
|
||||
char *name;
|
||||
char *name = NULL;
|
||||
boolean_t ret;
|
||||
uint64_t guid, vdev_guid;
|
||||
uint64_t guid = 0, vdev_guid;
|
||||
zpool_handle_t *zhp;
|
||||
nvlist_t *pool_config;
|
||||
uint64_t stateval, isspare;
|
||||
@ -320,16 +315,12 @@ zpool_in_use(libzfs_handle_t *hdl, int fd, pool_state_t *state, char **namestr,
|
||||
if (config == NULL)
|
||||
return (0);
|
||||
|
||||
verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE,
|
||||
&stateval) == 0);
|
||||
verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_GUID,
|
||||
&vdev_guid) == 0);
|
||||
stateval = fnvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE);
|
||||
vdev_guid = fnvlist_lookup_uint64(config, ZPOOL_CONFIG_GUID);
|
||||
|
||||
if (stateval != POOL_STATE_SPARE && stateval != POOL_STATE_L2CACHE) {
|
||||
verify(nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME,
|
||||
&name) == 0);
|
||||
verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID,
|
||||
&guid) == 0);
|
||||
name = fnvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME);
|
||||
guid = fnvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID);
|
||||
}
|
||||
|
||||
switch (stateval) {
|
||||
@ -378,10 +369,8 @@ zpool_in_use(libzfs_handle_t *hdl, int fd, pool_state_t *state, char **namestr,
|
||||
if ((zhp = zpool_open_canfail(hdl, name)) != NULL &&
|
||||
(pool_config = zpool_get_config(zhp, NULL))
|
||||
!= NULL) {
|
||||
nvlist_t *nvroot;
|
||||
|
||||
verify(nvlist_lookup_nvlist(pool_config,
|
||||
ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0);
|
||||
nvlist_t *nvroot = fnvlist_lookup_nvlist(
|
||||
pool_config, ZPOOL_CONFIG_VDEV_TREE);
|
||||
ret = find_guid(nvroot, vdev_guid);
|
||||
} else {
|
||||
ret = B_FALSE;
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stddef.h>
|
||||
#include <libintl.h>
|
||||
|
@ -74,7 +74,7 @@
|
||||
#include <libintl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <zone.h>
|
||||
#include <sys/mntent.h>
|
||||
|
@ -123,15 +123,13 @@ zpool_get_prop_string(zpool_handle_t *zhp, zpool_prop_t prop,
|
||||
zprop_source_t *src)
|
||||
{
|
||||
nvlist_t *nv, *nvl;
|
||||
uint64_t ival;
|
||||
char *value;
|
||||
zprop_source_t source;
|
||||
|
||||
nvl = zhp->zpool_props;
|
||||
if (nvlist_lookup_nvlist(nvl, zpool_prop_to_name(prop), &nv) == 0) {
|
||||
verify(nvlist_lookup_uint64(nv, ZPROP_SOURCE, &ival) == 0);
|
||||
source = ival;
|
||||
verify(nvlist_lookup_string(nv, ZPROP_VALUE, &value) == 0);
|
||||
source = fnvlist_lookup_uint64(nv, ZPROP_SOURCE);
|
||||
value = fnvlist_lookup_string(nv, ZPROP_VALUE);
|
||||
} else {
|
||||
source = ZPROP_SRC_DEFAULT;
|
||||
if ((value = (char *)zpool_prop_default_string(prop)) == NULL)
|
||||
@ -169,9 +167,8 @@ zpool_get_prop_int(zpool_handle_t *zhp, zpool_prop_t prop, zprop_source_t *src)
|
||||
|
||||
nvl = zhp->zpool_props;
|
||||
if (nvlist_lookup_nvlist(nvl, zpool_prop_to_name(prop), &nv) == 0) {
|
||||
verify(nvlist_lookup_uint64(nv, ZPROP_SOURCE, &value) == 0);
|
||||
source = value;
|
||||
verify(nvlist_lookup_uint64(nv, ZPROP_VALUE, &value) == 0);
|
||||
source = fnvlist_lookup_uint64(nv, ZPROP_SOURCE);
|
||||
value = fnvlist_lookup_uint64(nv, ZPROP_VALUE);
|
||||
} else {
|
||||
source = ZPROP_SRC_DEFAULT;
|
||||
value = zpool_prop_default_numeric(prop);
|
||||
@ -255,9 +252,6 @@ zpool_get_state_str(zpool_handle_t *zhp)
|
||||
{
|
||||
zpool_errata_t errata;
|
||||
zpool_status_t status;
|
||||
nvlist_t *nvroot;
|
||||
vdev_stat_t *vs;
|
||||
uint_t vsc;
|
||||
const char *str;
|
||||
|
||||
status = zpool_get_status(zhp, NULL, &errata);
|
||||
@ -268,11 +262,11 @@ zpool_get_state_str(zpool_handle_t *zhp)
|
||||
status == ZPOOL_STATUS_IO_FAILURE_MMP) {
|
||||
str = gettext("SUSPENDED");
|
||||
} else {
|
||||
verify(nvlist_lookup_nvlist(zpool_get_config(zhp, NULL),
|
||||
ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0);
|
||||
verify(nvlist_lookup_uint64_array(nvroot,
|
||||
ZPOOL_CONFIG_VDEV_STATS, (uint64_t **)&vs, &vsc)
|
||||
== 0);
|
||||
nvlist_t *nvroot = fnvlist_lookup_nvlist(
|
||||
zpool_get_config(zhp, NULL), ZPOOL_CONFIG_VDEV_TREE);
|
||||
uint_t vsc;
|
||||
vdev_stat_t *vs = (vdev_stat_t *)fnvlist_lookup_uint64_array(
|
||||
nvroot, ZPOOL_CONFIG_VDEV_STATS, &vsc);
|
||||
str = zpool_state_to_name(vs->vs_state, vs->vs_aux);
|
||||
}
|
||||
return (str);
|
||||
@ -986,8 +980,7 @@ vdev_expand_proplist(zpool_handle_t *zhp, const char *vdevname,
|
||||
if (nvpair_value_nvlist(elem, &propval) != 0)
|
||||
continue;
|
||||
|
||||
verify(nvlist_lookup_string(propval, ZPROP_VALUE,
|
||||
&strval) == 0);
|
||||
strval = fnvlist_lookup_string(propval, ZPROP_VALUE);
|
||||
|
||||
if ((entry = zfs_alloc(zhp->zpool_hdl,
|
||||
sizeof (zprop_list_t))) == NULL)
|
||||
@ -1996,20 +1989,13 @@ void
|
||||
zpool_print_unsup_feat(nvlist_t *config)
|
||||
{
|
||||
nvlist_t *nvinfo, *unsup_feat;
|
||||
nvpair_t *nvp;
|
||||
|
||||
verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_LOAD_INFO, &nvinfo) ==
|
||||
0);
|
||||
verify(nvlist_lookup_nvlist(nvinfo, ZPOOL_CONFIG_UNSUP_FEAT,
|
||||
&unsup_feat) == 0);
|
||||
|
||||
for (nvp = nvlist_next_nvpair(unsup_feat, NULL); nvp != NULL;
|
||||
nvp = nvlist_next_nvpair(unsup_feat, nvp)) {
|
||||
char *desc;
|
||||
|
||||
verify(nvpair_type(nvp) == DATA_TYPE_STRING);
|
||||
verify(nvpair_value_string(nvp, &desc) == 0);
|
||||
nvinfo = fnvlist_lookup_nvlist(config, ZPOOL_CONFIG_LOAD_INFO);
|
||||
unsup_feat = fnvlist_lookup_nvlist(nvinfo, ZPOOL_CONFIG_UNSUP_FEAT);
|
||||
|
||||
for (nvpair_t *nvp = nvlist_next_nvpair(unsup_feat, NULL);
|
||||
nvp != NULL; nvp = nvlist_next_nvpair(unsup_feat, nvp)) {
|
||||
char *desc = fnvpair_value_string(nvp);
|
||||
if (strlen(desc) > 0)
|
||||
(void) printf("\t%s (%s)\n", nvpair_name(nvp), desc);
|
||||
else
|
||||
@ -2038,8 +2024,7 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
|
||||
int error = 0;
|
||||
char errbuf[1024];
|
||||
|
||||
verify(nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME,
|
||||
&origname) == 0);
|
||||
origname = fnvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME);
|
||||
|
||||
(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
|
||||
"cannot import pool '%s'"), origname);
|
||||
@ -2058,8 +2043,7 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
|
||||
uint64_t version;
|
||||
prop_flags_t flags = { .create = B_FALSE, .import = B_TRUE };
|
||||
|
||||
verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION,
|
||||
&version) == 0);
|
||||
version = fnvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION);
|
||||
|
||||
if ((props = zpool_valid_proplist(hdl, origname,
|
||||
props, version, flags, errbuf)) == NULL)
|
||||
@ -2073,8 +2057,7 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
|
||||
|
||||
(void) strlcpy(zc.zc_name, thename, sizeof (zc.zc_name));
|
||||
|
||||
verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID,
|
||||
&zc.zc_guid) == 0);
|
||||
zc.zc_guid = fnvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID);
|
||||
|
||||
if (zcmd_write_conf_nvlist(hdl, &zc, config) != 0) {
|
||||
zcmd_free_nvlists(&zc);
|
||||
@ -2635,8 +2618,8 @@ zpool_scan(zpool_handle_t *zhp, pool_scan_func_t func, pool_scrub_cmd_t cmd)
|
||||
pool_scan_stat_t *ps = NULL;
|
||||
uint_t psc;
|
||||
|
||||
verify(nvlist_lookup_nvlist(zhp->zpool_config,
|
||||
ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0);
|
||||
nvroot = fnvlist_lookup_nvlist(zhp->zpool_config,
|
||||
ZPOOL_CONFIG_VDEV_TREE);
|
||||
(void) nvlist_lookup_uint64_array(nvroot,
|
||||
ZPOOL_CONFIG_SCAN_STATS, (uint64_t **)&ps, &psc);
|
||||
if (ps && ps->pss_func == POOL_SCAN_SCRUB &&
|
||||
@ -2684,11 +2667,9 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, boolean_t *avail_spare,
|
||||
switch (nvpair_type(pair)) {
|
||||
case DATA_TYPE_UINT64:
|
||||
if (strcmp(srchkey, ZPOOL_CONFIG_GUID) == 0) {
|
||||
uint64_t srchval, theguid;
|
||||
|
||||
verify(nvpair_value_uint64(pair, &srchval) == 0);
|
||||
verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID,
|
||||
&theguid) == 0);
|
||||
uint64_t srchval = fnvpair_value_uint64(pair);
|
||||
uint64_t theguid = fnvlist_lookup_uint64(nv,
|
||||
ZPOOL_CONFIG_GUID);
|
||||
if (theguid == srchval)
|
||||
return (nv);
|
||||
}
|
||||
@ -2697,7 +2678,7 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, boolean_t *avail_spare,
|
||||
case DATA_TYPE_STRING: {
|
||||
char *srchval, *val;
|
||||
|
||||
verify(nvpair_value_string(pair, &srchval) == 0);
|
||||
srchval = fnvpair_value_string(pair);
|
||||
if (nvlist_lookup_string(nv, srchkey, &val) != 0)
|
||||
break;
|
||||
|
||||
@ -2749,9 +2730,8 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, boolean_t *avail_spare,
|
||||
}
|
||||
|
||||
verify(zpool_vdev_is_interior(type));
|
||||
verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_ID,
|
||||
&id) == 0);
|
||||
|
||||
id = fnvlist_lookup_uint64(nv, ZPOOL_CONFIG_ID);
|
||||
errno = 0;
|
||||
vdev_id = strtoull(idx, &end, 10);
|
||||
|
||||
@ -2777,8 +2757,8 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, boolean_t *avail_spare,
|
||||
free(type);
|
||||
return (NULL);
|
||||
}
|
||||
verify(nvlist_lookup_uint64(nv,
|
||||
ZPOOL_CONFIG_NPARITY, &vdev_parity) == 0);
|
||||
vdev_parity = fnvlist_lookup_uint64(nv,
|
||||
ZPOOL_CONFIG_NPARITY);
|
||||
if ((int)vdev_parity != parity) {
|
||||
free(type);
|
||||
break;
|
||||
@ -2867,25 +2847,24 @@ zpool_find_vdev_by_physpath(zpool_handle_t *zhp, const char *ppath,
|
||||
uint64_t guid;
|
||||
char *end;
|
||||
|
||||
verify(nvlist_alloc(&search, NV_UNIQUE_NAME, KM_SLEEP) == 0);
|
||||
search = fnvlist_alloc();
|
||||
|
||||
guid = strtoull(ppath, &end, 0);
|
||||
if (guid != 0 && *end == '\0') {
|
||||
verify(nvlist_add_uint64(search, ZPOOL_CONFIG_GUID, guid) == 0);
|
||||
fnvlist_add_uint64(search, ZPOOL_CONFIG_GUID, guid);
|
||||
} else {
|
||||
verify(nvlist_add_string(search, ZPOOL_CONFIG_PHYS_PATH,
|
||||
ppath) == 0);
|
||||
fnvlist_add_string(search, ZPOOL_CONFIG_PHYS_PATH, ppath);
|
||||
}
|
||||
|
||||
verify(nvlist_lookup_nvlist(zhp->zpool_config, ZPOOL_CONFIG_VDEV_TREE,
|
||||
&nvroot) == 0);
|
||||
nvroot = fnvlist_lookup_nvlist(zhp->zpool_config,
|
||||
ZPOOL_CONFIG_VDEV_TREE);
|
||||
|
||||
*avail_spare = B_FALSE;
|
||||
*l2cache = B_FALSE;
|
||||
if (log != NULL)
|
||||
*log = B_FALSE;
|
||||
ret = vdev_to_nvlist_iter(nvroot, search, avail_spare, l2cache, log);
|
||||
nvlist_free(search);
|
||||
fnvlist_free(search);
|
||||
|
||||
return (ret);
|
||||
}
|
||||
@ -2918,26 +2897,26 @@ zpool_find_vdev(zpool_handle_t *zhp, const char *path, boolean_t *avail_spare,
|
||||
nvlist_t *nvroot, *search, *ret;
|
||||
uint64_t guid;
|
||||
|
||||
verify(nvlist_alloc(&search, NV_UNIQUE_NAME, KM_SLEEP) == 0);
|
||||
search = fnvlist_alloc();
|
||||
|
||||
guid = strtoull(path, &end, 0);
|
||||
if (guid != 0 && *end == '\0') {
|
||||
verify(nvlist_add_uint64(search, ZPOOL_CONFIG_GUID, guid) == 0);
|
||||
fnvlist_add_uint64(search, ZPOOL_CONFIG_GUID, guid);
|
||||
} else if (zpool_vdev_is_interior(path)) {
|
||||
verify(nvlist_add_string(search, ZPOOL_CONFIG_TYPE, path) == 0);
|
||||
fnvlist_add_string(search, ZPOOL_CONFIG_TYPE, path);
|
||||
} else {
|
||||
verify(nvlist_add_string(search, ZPOOL_CONFIG_PATH, path) == 0);
|
||||
fnvlist_add_string(search, ZPOOL_CONFIG_PATH, path);
|
||||
}
|
||||
|
||||
verify(nvlist_lookup_nvlist(zhp->zpool_config, ZPOOL_CONFIG_VDEV_TREE,
|
||||
&nvroot) == 0);
|
||||
nvroot = fnvlist_lookup_nvlist(zhp->zpool_config,
|
||||
ZPOOL_CONFIG_VDEV_TREE);
|
||||
|
||||
*avail_spare = B_FALSE;
|
||||
*l2cache = B_FALSE;
|
||||
if (log != NULL)
|
||||
*log = B_FALSE;
|
||||
ret = vdev_to_nvlist_iter(nvroot, search, avail_spare, l2cache, log);
|
||||
nvlist_free(search);
|
||||
fnvlist_free(search);
|
||||
|
||||
return (ret);
|
||||
}
|
||||
@ -3101,7 +3080,6 @@ static uint64_t
|
||||
zpool_vdev_path_to_guid_impl(zpool_handle_t *zhp, const char *path,
|
||||
boolean_t *is_spare, boolean_t *is_l2cache, boolean_t *is_log)
|
||||
{
|
||||
uint64_t guid;
|
||||
boolean_t spare = B_FALSE, l2cache = B_FALSE, log = B_FALSE;
|
||||
nvlist_t *tgt;
|
||||
|
||||
@ -3109,7 +3087,6 @@ zpool_vdev_path_to_guid_impl(zpool_handle_t *zhp, const char *path,
|
||||
&log)) == NULL)
|
||||
return (0);
|
||||
|
||||
verify(nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID, &guid) == 0);
|
||||
if (is_spare != NULL)
|
||||
*is_spare = spare;
|
||||
if (is_l2cache != NULL)
|
||||
@ -3117,7 +3094,7 @@ zpool_vdev_path_to_guid_impl(zpool_handle_t *zhp, const char *path,
|
||||
if (is_log != NULL)
|
||||
*is_log = log;
|
||||
|
||||
return (guid);
|
||||
return (fnvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID));
|
||||
}
|
||||
|
||||
/* Convert a vdev path to a GUID. Returns GUID or 0 on error. */
|
||||
@ -3137,11 +3114,9 @@ zpool_vdev_online(zpool_handle_t *zhp, const char *path, int flags,
|
||||
{
|
||||
zfs_cmd_t zc = {"\0"};
|
||||
char msg[1024];
|
||||
char *pathname;
|
||||
nvlist_t *tgt;
|
||||
boolean_t avail_spare, l2cache, islog;
|
||||
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
||||
int error;
|
||||
|
||||
if (flags & ZFS_ONLINE_EXPAND) {
|
||||
(void) snprintf(msg, sizeof (msg),
|
||||
@ -3156,11 +3131,13 @@ zpool_vdev_online(zpool_handle_t *zhp, const char *path, int flags,
|
||||
&islog)) == NULL)
|
||||
return (zfs_error(hdl, EZFS_NODEVICE, msg));
|
||||
|
||||
verify(nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID, &zc.zc_guid) == 0);
|
||||
zc.zc_guid = fnvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID);
|
||||
|
||||
if (avail_spare)
|
||||
return (zfs_error(hdl, EZFS_ISSPARE, msg));
|
||||
|
||||
#ifndef __FreeBSD__
|
||||
char *pathname;
|
||||
if ((flags & ZFS_ONLINE_EXPAND ||
|
||||
zpool_get_prop_int(zhp, ZPOOL_PROP_AUTOEXPAND, NULL)) &&
|
||||
nvlist_lookup_string(tgt, ZPOOL_CONFIG_PATH, &pathname) == 0) {
|
||||
@ -3181,6 +3158,7 @@ zpool_vdev_online(zpool_handle_t *zhp, const char *path, int flags,
|
||||
if (wholedisk) {
|
||||
const char *fullpath = path;
|
||||
char buf[MAXPATHLEN];
|
||||
int error;
|
||||
|
||||
if (path[0] != '/') {
|
||||
error = zfs_resolve_shortname(path, buf,
|
||||
@ -3197,6 +3175,7 @@ zpool_vdev_online(zpool_handle_t *zhp, const char *path, int flags,
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
zc.zc_cookie = VDEV_STATE_ONLINE;
|
||||
zc.zc_obj = flags;
|
||||
@ -3235,7 +3214,7 @@ zpool_vdev_offline(zpool_handle_t *zhp, const char *path, boolean_t istmp)
|
||||
NULL)) == NULL)
|
||||
return (zfs_error(hdl, EZFS_NODEVICE, msg));
|
||||
|
||||
verify(nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID, &zc.zc_guid) == 0);
|
||||
zc.zc_guid = fnvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID);
|
||||
|
||||
if (avail_spare)
|
||||
return (zfs_error(hdl, EZFS_ISSPARE, msg));
|
||||
@ -3333,13 +3312,10 @@ is_replacing_spare(nvlist_t *search, nvlist_t *tgt, int which)
|
||||
{
|
||||
nvlist_t **child;
|
||||
uint_t c, children;
|
||||
char *type;
|
||||
|
||||
if (nvlist_lookup_nvlist_array(search, ZPOOL_CONFIG_CHILDREN, &child,
|
||||
&children) == 0) {
|
||||
verify(nvlist_lookup_string(search, ZPOOL_CONFIG_TYPE,
|
||||
&type) == 0);
|
||||
|
||||
char *type = fnvlist_lookup_string(search, ZPOOL_CONFIG_TYPE);
|
||||
if ((strcmp(type, VDEV_TYPE_SPARE) == 0 ||
|
||||
strcmp(type, VDEV_TYPE_DRAID_SPARE) == 0) &&
|
||||
children == 2 && child[which] == tgt)
|
||||
@ -3391,7 +3367,7 @@ zpool_vdev_attach(zpool_handle_t *zhp, const char *old_disk,
|
||||
if (l2cache)
|
||||
return (zfs_error(hdl, EZFS_ISL2CACHE, msg));
|
||||
|
||||
verify(nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID, &zc.zc_guid) == 0);
|
||||
zc.zc_guid = fnvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID);
|
||||
zc.zc_cookie = replacing;
|
||||
zc.zc_simple = rebuild;
|
||||
|
||||
@ -3409,8 +3385,8 @@ zpool_vdev_attach(zpool_handle_t *zhp, const char *old_disk,
|
||||
return (zfs_error(hdl, EZFS_INVALCONFIG, msg));
|
||||
}
|
||||
|
||||
verify(nvlist_lookup_nvlist(zpool_get_config(zhp, NULL),
|
||||
ZPOOL_CONFIG_VDEV_TREE, &config_root) == 0);
|
||||
config_root = fnvlist_lookup_nvlist(zpool_get_config(zhp, NULL),
|
||||
ZPOOL_CONFIG_VDEV_TREE);
|
||||
|
||||
if ((newname = zpool_vdev_name(NULL, NULL, child[0], 0)) == NULL)
|
||||
return (-1);
|
||||
@ -3564,7 +3540,7 @@ zpool_vdev_detach(zpool_handle_t *zhp, const char *path)
|
||||
if (l2cache)
|
||||
return (zfs_error(hdl, EZFS_ISL2CACHE, msg));
|
||||
|
||||
verify(nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID, &zc.zc_guid) == 0);
|
||||
zc.zc_guid = fnvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID);
|
||||
|
||||
if (zfs_ioctl(hdl, ZFS_IOC_VDEV_DETACH, &zc) == 0)
|
||||
return (0);
|
||||
@ -3664,9 +3640,8 @@ zpool_vdev_split(zpool_handle_t *zhp, char *newname, nvlist_t **newroot,
|
||||
return (-1);
|
||||
}
|
||||
|
||||
verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &tree)
|
||||
== 0);
|
||||
verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION, &vers) == 0);
|
||||
tree = fnvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE);
|
||||
vers = fnvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION);
|
||||
|
||||
if (props) {
|
||||
prop_flags_t flags = { .create = B_FALSE, .import = B_TRUE };
|
||||
@ -3733,8 +3708,7 @@ zpool_vdev_split(zpool_handle_t *zhp, char *newname, nvlist_t **newroot,
|
||||
continue;
|
||||
}
|
||||
lastlog = 0;
|
||||
verify(nvlist_lookup_string(child[c], ZPOOL_CONFIG_TYPE, &type)
|
||||
== 0);
|
||||
type = fnvlist_lookup_string(child[c], ZPOOL_CONFIG_TYPE);
|
||||
|
||||
if (strcmp(type, VDEV_TYPE_INDIRECT) == 0) {
|
||||
vdev = child[c];
|
||||
@ -3957,14 +3931,13 @@ zpool_vdev_remove(zpool_handle_t *zhp, const char *path)
|
||||
int
|
||||
zpool_vdev_remove_cancel(zpool_handle_t *zhp)
|
||||
{
|
||||
zfs_cmd_t zc;
|
||||
zfs_cmd_t zc = {{0}};
|
||||
char msg[1024];
|
||||
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
||||
|
||||
(void) snprintf(msg, sizeof (msg),
|
||||
dgettext(TEXT_DOMAIN, "cannot cancel removal"));
|
||||
|
||||
bzero(&zc, sizeof (zc));
|
||||
(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
|
||||
zc.zc_cookie = 1;
|
||||
|
||||
@ -4041,8 +4014,7 @@ zpool_clear(zpool_handle_t *zhp, const char *path, nvlist_t *rewindnvl)
|
||||
if (avail_spare)
|
||||
return (zfs_error(hdl, EZFS_ISSPARE, msg));
|
||||
|
||||
verify(nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID,
|
||||
&zc.zc_guid) == 0);
|
||||
zc.zc_guid = fnvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID);
|
||||
}
|
||||
|
||||
zpool_get_load_policy(rewindnvl, &policy);
|
||||
@ -4195,7 +4167,7 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv,
|
||||
* vdev_name will be "root"/"root-0" for the root vdev, but it is the
|
||||
* zpool name that will be displayed to the user.
|
||||
*/
|
||||
verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_TYPE, &type) == 0);
|
||||
type = fnvlist_lookup_string(nv, ZPOOL_CONFIG_TYPE);
|
||||
if (zhp != NULL && strcmp(type, "root") == 0)
|
||||
return (zfs_strdup(hdl, zpool_get_name(zhp)));
|
||||
|
||||
@ -4252,8 +4224,7 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv,
|
||||
* If it's a raidz device, we need to stick in the parity level.
|
||||
*/
|
||||
if (strcmp(path, VDEV_TYPE_RAIDZ) == 0) {
|
||||
verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NPARITY,
|
||||
&value) == 0);
|
||||
value = fnvlist_lookup_uint64(nv, ZPOOL_CONFIG_NPARITY);
|
||||
(void) snprintf(buf, sizeof (buf), "%s%llu", path,
|
||||
(u_longlong_t)value);
|
||||
path = buf;
|
||||
@ -4269,12 +4240,12 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv,
|
||||
|
||||
verify(nvlist_lookup_nvlist_array(nv,
|
||||
ZPOOL_CONFIG_CHILDREN, &child, &children) == 0);
|
||||
verify(nvlist_lookup_uint64(nv,
|
||||
ZPOOL_CONFIG_NPARITY, &nparity) == 0);
|
||||
verify(nvlist_lookup_uint64(nv,
|
||||
ZPOOL_CONFIG_DRAID_NDATA, &ndata) == 0);
|
||||
verify(nvlist_lookup_uint64(nv,
|
||||
ZPOOL_CONFIG_DRAID_NSPARES, &nspares) == 0);
|
||||
nparity = fnvlist_lookup_uint64(nv,
|
||||
ZPOOL_CONFIG_NPARITY);
|
||||
ndata = fnvlist_lookup_uint64(nv,
|
||||
ZPOOL_CONFIG_DRAID_NDATA);
|
||||
nspares = fnvlist_lookup_uint64(nv,
|
||||
ZPOOL_CONFIG_DRAID_NSPARES);
|
||||
|
||||
path = zpool_draid_name(buf, sizeof (buf), ndata,
|
||||
nparity, nspares, children);
|
||||
@ -4285,9 +4256,8 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv,
|
||||
* naming convention.
|
||||
*/
|
||||
if (name_flags & VDEV_NAME_TYPE_ID) {
|
||||
uint64_t id;
|
||||
verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_ID,
|
||||
&id) == 0);
|
||||
uint64_t id = fnvlist_lookup_uint64(nv,
|
||||
ZPOOL_CONFIG_ID);
|
||||
(void) snprintf(tmpbuf, sizeof (tmpbuf), "%s-%llu",
|
||||
path, (u_longlong_t)id);
|
||||
path = tmpbuf;
|
||||
@ -4321,8 +4291,7 @@ zpool_get_errlog(zpool_handle_t *zhp, nvlist_t **nverrlistp)
|
||||
* has increased, allocate more space and continue until we get the
|
||||
* entire list.
|
||||
*/
|
||||
verify(nvlist_lookup_uint64(zhp->zpool_config, ZPOOL_CONFIG_ERRCOUNT,
|
||||
&count) == 0);
|
||||
count = fnvlist_lookup_uint64(zhp->zpool_config, ZPOOL_CONFIG_ERRCOUNT);
|
||||
if (count == 0)
|
||||
return (0);
|
||||
zc.zc_nvlist_dst = (uintptr_t)zfs_alloc(zhp->zpool_hdl,
|
||||
@ -4551,9 +4520,9 @@ zpool_get_history(zpool_handle_t *zhp, nvlist_t **nvhisp, uint64_t *off,
|
||||
free(buf);
|
||||
|
||||
if (!err) {
|
||||
verify(nvlist_alloc(nvhisp, NV_UNIQUE_NAME, 0) == 0);
|
||||
verify(nvlist_add_nvlist_array(*nvhisp, ZPOOL_HIST_RECORD,
|
||||
(const nvlist_t **)records, numrecords) == 0);
|
||||
*nvhisp = fnvlist_alloc();
|
||||
fnvlist_add_nvlist_array(*nvhisp, ZPOOL_HIST_RECORD,
|
||||
(const nvlist_t **)records, numrecords);
|
||||
}
|
||||
for (i = 0; i < numrecords; i++)
|
||||
nvlist_free(records[i]);
|
||||
@ -5090,7 +5059,7 @@ zpool_vdev_guid(zpool_handle_t *zhp, const char *vdevname, uint64_t *vdev_guid)
|
||||
return (zfs_error(zhp->zpool_hdl, EZFS_NODEVICE, errbuf));
|
||||
}
|
||||
|
||||
verify(nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID, vdev_guid) == 0);
|
||||
*vdev_guid = fnvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -5103,19 +5072,16 @@ zpool_get_vdev_prop_value(nvlist_t *nvprop, vdev_prop_t prop, char *prop_name,
|
||||
char *buf, size_t len, zprop_source_t *srctype, boolean_t literal)
|
||||
{
|
||||
nvlist_t *nv;
|
||||
uint64_t intval;
|
||||
char *strval;
|
||||
uint64_t intval;
|
||||
zprop_source_t src = ZPROP_SRC_NONE;
|
||||
|
||||
if (prop == VDEV_PROP_USER) {
|
||||
/* user property, prop_name must contain the property name */
|
||||
assert(prop_name != NULL);
|
||||
if (nvlist_lookup_nvlist(nvprop, prop_name, &nv) == 0) {
|
||||
verify(nvlist_lookup_uint64(nv, ZPROP_SOURCE,
|
||||
&intval) == 0);
|
||||
src = intval;
|
||||
verify(nvlist_lookup_string(nv, ZPROP_VALUE,
|
||||
&strval) == 0);
|
||||
src = fnvlist_lookup_uint64(nv, ZPROP_SOURCE);
|
||||
strval = fnvlist_lookup_string(nv, ZPROP_VALUE);
|
||||
} else {
|
||||
/* user prop not found */
|
||||
return (-1);
|
||||
@ -5132,11 +5098,8 @@ zpool_get_vdev_prop_value(nvlist_t *nvprop, vdev_prop_t prop, char *prop_name,
|
||||
switch (vdev_prop_get_type(prop)) {
|
||||
case PROP_TYPE_STRING:
|
||||
if (nvlist_lookup_nvlist(nvprop, prop_name, &nv) == 0) {
|
||||
verify(nvlist_lookup_uint64(nv, ZPROP_SOURCE,
|
||||
&intval) == 0);
|
||||
src = intval;
|
||||
verify(nvlist_lookup_string(nv, ZPROP_VALUE,
|
||||
&strval) == 0);
|
||||
src = fnvlist_lookup_uint64(nv, ZPROP_SOURCE);
|
||||
strval = fnvlist_lookup_string(nv, ZPROP_VALUE);
|
||||
} else {
|
||||
src = ZPROP_SRC_DEFAULT;
|
||||
if ((strval = (char *)vdev_prop_default_string(prop))
|
||||
@ -5148,11 +5111,8 @@ zpool_get_vdev_prop_value(nvlist_t *nvprop, vdev_prop_t prop, char *prop_name,
|
||||
|
||||
case PROP_TYPE_NUMBER:
|
||||
if (nvlist_lookup_nvlist(nvprop, prop_name, &nv) == 0) {
|
||||
verify(nvlist_lookup_uint64(nv, ZPROP_SOURCE,
|
||||
&intval) == 0);
|
||||
src = intval;
|
||||
verify(nvlist_lookup_uint64(nv, ZPROP_VALUE,
|
||||
&intval) == 0);
|
||||
src = fnvlist_lookup_uint64(nv, ZPROP_SOURCE);
|
||||
intval = fnvlist_lookup_uint64(nv, ZPROP_VALUE);
|
||||
} else {
|
||||
src = ZPROP_SRC_DEFAULT;
|
||||
intval = vdev_prop_default_numeric(prop);
|
||||
@ -5232,11 +5192,8 @@ zpool_get_vdev_prop_value(nvlist_t *nvprop, vdev_prop_t prop, char *prop_name,
|
||||
|
||||
case PROP_TYPE_INDEX:
|
||||
if (nvlist_lookup_nvlist(nvprop, prop_name, &nv) == 0) {
|
||||
verify(nvlist_lookup_uint64(nv, ZPROP_SOURCE,
|
||||
&intval) == 0);
|
||||
src = intval;
|
||||
verify(nvlist_lookup_uint64(nv, ZPROP_VALUE,
|
||||
&intval) == 0);
|
||||
src = fnvlist_lookup_uint64(nv, ZPROP_SOURCE);
|
||||
intval = fnvlist_lookup_uint64(nv, ZPROP_VALUE);
|
||||
} else {
|
||||
src = ZPROP_SRC_DEFAULT;
|
||||
intval = vdev_prop_default_numeric(prop);
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include <libintl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stddef.h>
|
||||
#include <fcntl.h>
|
||||
@ -4285,9 +4285,9 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
|
||||
boolean_t recursive;
|
||||
char *snapname = NULL;
|
||||
char destsnap[MAXPATHLEN * 2];
|
||||
char origin[MAXNAMELEN];
|
||||
char origin[MAXNAMELEN] = {0};
|
||||
char name[MAXPATHLEN];
|
||||
char tmp_keylocation[MAXNAMELEN];
|
||||
char tmp_keylocation[MAXNAMELEN] = {0};
|
||||
nvlist_t *rcvprops = NULL; /* props received from the send stream */
|
||||
nvlist_t *oxprops = NULL; /* override (-o) and exclude (-x) props */
|
||||
nvlist_t *origprops = NULL; /* original props (if destination exists) */
|
||||
@ -4303,8 +4303,6 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
|
||||
#define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC
|
||||
#endif
|
||||
clock_gettime(CLOCK_MONOTONIC_RAW, &begin_time);
|
||||
bzero(origin, MAXNAMELEN);
|
||||
bzero(tmp_keylocation, MAXNAMELEN);
|
||||
|
||||
(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
|
||||
"cannot receive"));
|
||||
@ -5228,7 +5226,7 @@ zfs_receive_impl(libzfs_handle_t *hdl, const char *tosnap,
|
||||
* We computed the checksum in the wrong byteorder in
|
||||
* recv_read() above; do it again correctly.
|
||||
*/
|
||||
bzero(&zcksum, sizeof (zio_cksum_t));
|
||||
memset(&zcksum, 0, sizeof (zio_cksum_t));
|
||||
fletcher_4_incremental_byteswap(&drr, sizeof (drr), &zcksum);
|
||||
flags->byteswap = B_TRUE;
|
||||
|
||||
|
@ -159,8 +159,7 @@ find_vdev_problem(nvlist_t *vdev, int (*func)(vdev_stat_t *, uint_t),
|
||||
boolean_t ignore_replacing)
|
||||
{
|
||||
nvlist_t **child;
|
||||
vdev_stat_t *vs;
|
||||
uint_t c, vsc, children;
|
||||
uint_t c, children;
|
||||
|
||||
/*
|
||||
* Ignore problems within a 'replacing' vdev, since we're presumably in
|
||||
@ -169,10 +168,7 @@ find_vdev_problem(nvlist_t *vdev, int (*func)(vdev_stat_t *, uint_t),
|
||||
* later.
|
||||
*/
|
||||
if (ignore_replacing == B_TRUE) {
|
||||
char *type;
|
||||
|
||||
verify(nvlist_lookup_string(vdev, ZPOOL_CONFIG_TYPE,
|
||||
&type) == 0);
|
||||
char *type = fnvlist_lookup_string(vdev, ZPOOL_CONFIG_TYPE);
|
||||
if (strcmp(type, VDEV_TYPE_REPLACING) == 0)
|
||||
return (B_FALSE);
|
||||
}
|
||||
@ -183,9 +179,9 @@ find_vdev_problem(nvlist_t *vdev, int (*func)(vdev_stat_t *, uint_t),
|
||||
if (find_vdev_problem(child[c], func, ignore_replacing))
|
||||
return (B_TRUE);
|
||||
} else {
|
||||
verify(nvlist_lookup_uint64_array(vdev, ZPOOL_CONFIG_VDEV_STATS,
|
||||
(uint64_t **)&vs, &vsc) == 0);
|
||||
|
||||
uint_t vsc;
|
||||
vdev_stat_t *vs = (vdev_stat_t *)fnvlist_lookup_uint64_array(
|
||||
vdev, ZPOOL_CONFIG_VDEV_STATS, &vsc);
|
||||
if (func(vs, vsc) != 0)
|
||||
return (B_TRUE);
|
||||
}
|
||||
@ -224,26 +220,21 @@ static zpool_status_t
|
||||
check_status(nvlist_t *config, boolean_t isimport,
|
||||
zpool_errata_t *erratap, const char *compat)
|
||||
{
|
||||
nvlist_t *nvroot;
|
||||
vdev_stat_t *vs;
|
||||
pool_scan_stat_t *ps = NULL;
|
||||
uint_t vsc, psc;
|
||||
uint64_t nerr;
|
||||
uint64_t version;
|
||||
uint64_t stateval;
|
||||
uint64_t suspended;
|
||||
uint64_t hostid = 0;
|
||||
uint64_t errata = 0;
|
||||
unsigned long system_hostid = get_system_hostid();
|
||||
|
||||
verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION,
|
||||
&version) == 0);
|
||||
verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE,
|
||||
&nvroot) == 0);
|
||||
verify(nvlist_lookup_uint64_array(nvroot, ZPOOL_CONFIG_VDEV_STATS,
|
||||
(uint64_t **)&vs, &vsc) == 0);
|
||||
verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE,
|
||||
&stateval) == 0);
|
||||
uint64_t version = fnvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION);
|
||||
nvlist_t *nvroot = fnvlist_lookup_nvlist(config,
|
||||
ZPOOL_CONFIG_VDEV_TREE);
|
||||
vdev_stat_t *vs = (vdev_stat_t *)fnvlist_lookup_uint64_array(nvroot,
|
||||
ZPOOL_CONFIG_VDEV_STATS, &vsc);
|
||||
uint64_t stateval = fnvlist_lookup_uint64(config,
|
||||
ZPOOL_CONFIG_POOL_STATE);
|
||||
|
||||
/*
|
||||
* Currently resilvering a vdev
|
||||
@ -337,10 +328,8 @@ check_status(nvlist_t *config, boolean_t isimport,
|
||||
*/
|
||||
if (vs->vs_state == VDEV_STATE_CANT_OPEN &&
|
||||
vs->vs_aux == VDEV_AUX_UNSUP_FEAT) {
|
||||
nvlist_t *nvinfo;
|
||||
|
||||
verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_LOAD_INFO,
|
||||
&nvinfo) == 0);
|
||||
nvlist_t *nvinfo = fnvlist_lookup_nvlist(config,
|
||||
ZPOOL_CONFIG_LOAD_INFO);
|
||||
if (nvlist_exists(nvinfo, ZPOOL_CONFIG_CAN_RDONLY))
|
||||
return (ZPOOL_STATUS_UNSUP_FEAT_WRITE);
|
||||
return (ZPOOL_STATUS_UNSUP_FEAT_READ);
|
||||
|
@ -807,7 +807,7 @@ zfs_realloc(libzfs_handle_t *hdl, void *ptr, size_t oldsize, size_t newsize)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
bzero((char *)ret + oldsize, (newsize - oldsize));
|
||||
memset((char *)ret + oldsize, 0, newsize - oldsize);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@ -1199,10 +1199,8 @@ zcmd_write_nvlist_com(libzfs_handle_t *hdl, uint64_t *outnv, uint64_t *outlen,
|
||||
nvlist_t *nvl)
|
||||
{
|
||||
char *packed;
|
||||
size_t len;
|
||||
|
||||
verify(nvlist_size(nvl, &len, NV_ENCODE_NATIVE) == 0);
|
||||
|
||||
size_t len = fnvlist_size(nvl);
|
||||
if ((packed = zfs_alloc(hdl, len)) == NULL)
|
||||
return (-1);
|
||||
|
||||
@ -1751,14 +1749,10 @@ zprop_parse_value(libzfs_handle_t *hdl, nvpair_t *elem, int prop,
|
||||
}
|
||||
|
||||
static int
|
||||
addlist(libzfs_handle_t *hdl, char *propname, zprop_list_t **listp,
|
||||
addlist(libzfs_handle_t *hdl, const char *propname, zprop_list_t **listp,
|
||||
zfs_type_t type)
|
||||
{
|
||||
int prop;
|
||||
zprop_list_t *entry;
|
||||
|
||||
prop = zprop_name_to_prop(propname, type);
|
||||
|
||||
int prop = zprop_name_to_prop(propname, type);
|
||||
if (prop != ZPROP_INVAL && !zprop_valid_for_type(prop, type, B_FALSE))
|
||||
prop = ZPROP_INVAL;
|
||||
|
||||
@ -1778,7 +1772,8 @@ addlist(libzfs_handle_t *hdl, char *propname, zprop_list_t **listp,
|
||||
dgettext(TEXT_DOMAIN, "bad property list")));
|
||||
}
|
||||
|
||||
entry = zfs_alloc(hdl, sizeof (zprop_list_t));
|
||||
zprop_list_t *entry = zfs_alloc(hdl, sizeof (*entry));
|
||||
|
||||
entry->pl_prop = prop;
|
||||
if (prop == ZPROP_INVAL) {
|
||||
entry->pl_user_prop = zfs_strdup(hdl, propname);
|
||||
@ -1821,62 +1816,25 @@ zprop_get_list(libzfs_handle_t *hdl, char *props, zprop_list_t **listp,
|
||||
"bad property list")));
|
||||
}
|
||||
|
||||
/*
|
||||
* It would be nice to use getsubopt() here, but the inclusion of column
|
||||
* aliases makes this more effort than it's worth.
|
||||
*/
|
||||
while (*props != '\0') {
|
||||
size_t len;
|
||||
char *p;
|
||||
char c;
|
||||
|
||||
if ((p = strchr(props, ',')) == NULL) {
|
||||
len = strlen(props);
|
||||
p = props + len;
|
||||
} else {
|
||||
len = p - props;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for empty options.
|
||||
*/
|
||||
if (len == 0) {
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"empty property name"));
|
||||
return (zfs_error(hdl, EZFS_BADPROP,
|
||||
dgettext(TEXT_DOMAIN, "bad property list")));
|
||||
}
|
||||
|
||||
/*
|
||||
* Check all regular property names.
|
||||
*/
|
||||
c = props[len];
|
||||
props[len] = '\0';
|
||||
|
||||
if (strcmp(props, "space") == 0) {
|
||||
static char *spaceprops[] = {
|
||||
for (char *p; (p = strsep(&props, ",")); )
|
||||
if (strcmp(p, "space") == 0) {
|
||||
static const char *const spaceprops[] = {
|
||||
"name", "avail", "used", "usedbysnapshots",
|
||||
"usedbydataset", "usedbyrefreservation",
|
||||
"usedbychildren", NULL
|
||||
"usedbychildren"
|
||||
};
|
||||
int i;
|
||||
|
||||
for (i = 0; spaceprops[i]; i++) {
|
||||
for (int i = 0; i < ARRAY_SIZE(spaceprops); i++) {
|
||||
if (addlist(hdl, spaceprops[i], listp, type))
|
||||
return (-1);
|
||||
listp = &(*listp)->pl_next;
|
||||
}
|
||||
} else {
|
||||
if (addlist(hdl, props, listp, type))
|
||||
if (addlist(hdl, p, listp, type))
|
||||
return (-1);
|
||||
listp = &(*listp)->pl_next;
|
||||
}
|
||||
|
||||
props = p;
|
||||
if (c == ',')
|
||||
props++;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -103,9 +103,9 @@ execvPe(const char *name, const char *path, char * const *argv,
|
||||
16);
|
||||
continue;
|
||||
}
|
||||
bcopy(p, buf, lp);
|
||||
memcpy(buf, p, lp);
|
||||
buf[lp] = '/';
|
||||
bcopy(name, buf + lp + 1, ln);
|
||||
memcpy(buf + lp + 1, name, ln);
|
||||
buf[lp + ln + 1] = '\0';
|
||||
|
||||
retry: (void) execve(bp, argv, envp);
|
||||
@ -135,7 +135,7 @@ retry: (void) execve(bp, argv, envp);
|
||||
if (cnt > 0) {
|
||||
memp[0] = argv[0];
|
||||
memp[1] = bp;
|
||||
bcopy(argv + 1, memp + 2,
|
||||
memcpy(memp + 2, argv + 1,
|
||||
cnt * sizeof (char *));
|
||||
} else {
|
||||
memp[0] = "sh";
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include <libintl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <zone.h>
|
||||
#include <sys/mntent.h>
|
||||
|
@ -34,14 +34,13 @@
|
||||
#include <libintl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <libgen.h>
|
||||
#include <zone.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/efi_partition.h>
|
||||
#include <sys/systeminfo.h>
|
||||
#include <sys/vtoc.h>
|
||||
#include <sys/zfs_ioctl.h>
|
||||
#include <sys/vdev_disk.h>
|
||||
#include <dlfcn.h>
|
||||
@ -224,10 +223,8 @@ zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, const char *name)
|
||||
dgettext(TEXT_DOMAIN, "cannot label '%s'"), name);
|
||||
|
||||
if (zhp) {
|
||||
nvlist_t *nvroot;
|
||||
|
||||
verify(nvlist_lookup_nvlist(zhp->zpool_config,
|
||||
ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0);
|
||||
nvlist_t *nvroot = fnvlist_lookup_nvlist(zhp->zpool_config,
|
||||
ZPOOL_CONFIG_VDEV_TREE);
|
||||
|
||||
if (zhp->zpool_start_block == 0)
|
||||
start_block = find_start_block(nvroot);
|
||||
@ -280,8 +277,9 @@ zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, const char *name)
|
||||
* Why we use V_USR: V_BACKUP confuses users, and is considered
|
||||
* disposable by some EFI utilities (since EFI doesn't have a backup
|
||||
* slice). V_UNASSIGNED is supposed to be used only for zero size
|
||||
* partitions, and efi_write() will fail if we use it. V_ROOT, V_BOOT,
|
||||
* etc. were all pretty specific. V_USR is as close to reality as we
|
||||
* partitions, and efi_write() will fail if we use it.
|
||||
* Other available types were all pretty specific.
|
||||
* V_USR is as close to reality as we
|
||||
* can get, in the absence of V_OTHER.
|
||||
*/
|
||||
vtoc->efi_parts[0].p_tag = V_USR;
|
||||
|
@ -633,7 +633,7 @@ __dprintf(boolean_t dprint, const char *file, const char *func,
|
||||
static char ce_prefix[CE_IGNORE][10] = { "", "NOTICE: ", "WARNING: ", "" };
|
||||
static char ce_suffix[CE_IGNORE][2] = { "", "\n", "\n", "" };
|
||||
|
||||
void
|
||||
__attribute__((noreturn)) void
|
||||
vpanic(const char *fmt, va_list adx)
|
||||
{
|
||||
(void) fprintf(stderr, "error: ");
|
||||
@ -643,7 +643,7 @@ vpanic(const char *fmt, va_list adx)
|
||||
abort(); /* think of it as a "user-level crash dump" */
|
||||
}
|
||||
|
||||
void
|
||||
__attribute__((noreturn)) void
|
||||
panic(const char *fmt, ...)
|
||||
{
|
||||
va_list adx;
|
||||
|
@ -211,7 +211,7 @@ taskq_wait_outstanding(taskq_t *tq, taskqid_t id)
|
||||
taskq_wait(tq);
|
||||
}
|
||||
|
||||
static _Noreturn void
|
||||
static __attribute__((noreturn)) void
|
||||
taskq_thread(void *arg)
|
||||
{
|
||||
taskq_t *tq = arg;
|
||||
|
@ -613,27 +613,24 @@ zfs_get_underlying_path(const char *dev_name)
|
||||
/*
|
||||
* A disk is considered a multipath whole disk when:
|
||||
* DEVNAME key value has "dm-"
|
||||
* MPATH_DEVICE_READY is present
|
||||
* DM_UUID key exists
|
||||
* DM_UUID key exists and starts with 'mpath-'
|
||||
* ID_PART_TABLE_TYPE key does not exist or is not gpt
|
||||
* ID_FS_LABEL key does not exist (disk isn't labeled)
|
||||
*/
|
||||
static boolean_t
|
||||
is_mpath_udev_sane(struct udev_device *dev)
|
||||
{
|
||||
const char *devname, *type, *uuid, *label, *mpath_ready;
|
||||
const char *devname, *type, *uuid, *label;
|
||||
|
||||
devname = udev_device_get_property_value(dev, "DEVNAME");
|
||||
type = udev_device_get_property_value(dev, "ID_PART_TABLE_TYPE");
|
||||
uuid = udev_device_get_property_value(dev, "DM_UUID");
|
||||
label = udev_device_get_property_value(dev, "ID_FS_LABEL");
|
||||
mpath_ready = udev_device_get_property_value(dev, "MPATH_DEVICE_READY");
|
||||
|
||||
if ((devname != NULL && strncmp(devname, "/dev/dm-", 8) == 0) &&
|
||||
((type == NULL) || (strcmp(type, "gpt") != 0)) &&
|
||||
(uuid != NULL) &&
|
||||
(label == NULL) &&
|
||||
(mpath_ready != NULL && strncmp(mpath_ready, "1", 1) == 0)) {
|
||||
((uuid != NULL) && (strncmp(uuid, "mpath-", 6) == 0)) &&
|
||||
(label == NULL)) {
|
||||
return (B_TRUE);
|
||||
}
|
||||
|
||||
|
@ -264,36 +264,36 @@ zpool_default_search_paths(size_t *count)
|
||||
* index in the passed 'order' variable, otherwise return an error.
|
||||
*/
|
||||
static int
|
||||
zfs_path_order(char *name, int *order)
|
||||
zfs_path_order(const char *name, int *order)
|
||||
{
|
||||
int i, error = ENOENT;
|
||||
char *dir, *env, *envdup, *tmp = NULL;
|
||||
const char *env = getenv("ZPOOL_IMPORT_PATH");
|
||||
|
||||
env = getenv("ZPOOL_IMPORT_PATH");
|
||||
if (env) {
|
||||
envdup = strdup(env);
|
||||
for (dir = strtok_r(envdup, ":", &tmp), i = 0;
|
||||
dir != NULL;
|
||||
dir = strtok_r(NULL, ":", &tmp), i++) {
|
||||
if (strncmp(name, dir, strlen(dir)) == 0) {
|
||||
*order = i;
|
||||
error = 0;
|
||||
for (int i = 0; ; ++i) {
|
||||
env += strspn(env, ":");
|
||||
size_t dirlen = strcspn(env, ":");
|
||||
if (dirlen) {
|
||||
if (strncmp(name, env, dirlen) == 0) {
|
||||
*order = i;
|
||||
return (0);
|
||||
}
|
||||
|
||||
env += dirlen;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
}
|
||||
free(envdup);
|
||||
} else {
|
||||
for (i = 0; i < ARRAY_SIZE(zpool_default_import_path); i++) {
|
||||
for (int i = 0; i < ARRAY_SIZE(zpool_default_import_path);
|
||||
++i) {
|
||||
if (strncmp(name, zpool_default_import_path[i],
|
||||
strlen(zpool_default_import_path[i])) == 0) {
|
||||
*order = i;
|
||||
error = 0;
|
||||
break;
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (error);
|
||||
return (ENOENT);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -56,35 +56,36 @@ zfs_dirnamelen(const char *path)
|
||||
int
|
||||
zfs_resolve_shortname(const char *name, char *path, size_t len)
|
||||
{
|
||||
int i, error = -1;
|
||||
char *dir, *env, *envdup, *tmp = NULL;
|
||||
|
||||
env = getenv("ZPOOL_IMPORT_PATH");
|
||||
errno = ENOENT;
|
||||
const char *env = getenv("ZPOOL_IMPORT_PATH");
|
||||
|
||||
if (env) {
|
||||
envdup = strdup(env);
|
||||
for (dir = strtok_r(envdup, ":", &tmp);
|
||||
dir != NULL && error != 0;
|
||||
dir = strtok_r(NULL, ":", &tmp)) {
|
||||
(void) snprintf(path, len, "%s/%s", dir, name);
|
||||
error = access(path, F_OK);
|
||||
for (;;) {
|
||||
env += strspn(env, ":");
|
||||
size_t dirlen = strcspn(env, ":");
|
||||
if (dirlen) {
|
||||
(void) snprintf(path, len, "%.*s/%s",
|
||||
(int)dirlen, env, name);
|
||||
if (access(path, F_OK) == 0)
|
||||
return (0);
|
||||
|
||||
env += dirlen;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
free(envdup);
|
||||
} else {
|
||||
const char * const *zpool_default_import_path;
|
||||
size_t count;
|
||||
const char *const *zpool_default_import_path =
|
||||
zpool_default_search_paths(&count);
|
||||
|
||||
zpool_default_import_path = zpool_default_search_paths(&count);
|
||||
|
||||
for (i = 0; i < count && error < 0; i++) {
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
(void) snprintf(path, len, "%s/%s",
|
||||
zpool_default_import_path[i], name);
|
||||
error = access(path, F_OK);
|
||||
if (access(path, F_OK) == 0)
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
return (error ? ENOENT : 0);
|
||||
return (errno = ENOENT);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -100,7 +101,7 @@ zfs_strcmp_shortname(const char *name, const char *cmp_name, int wholedisk)
|
||||
int path_len, cmp_len, i = 0, error = ENOENT;
|
||||
char *dir, *env, *envdup = NULL, *tmp = NULL;
|
||||
char path_name[MAXPATHLEN];
|
||||
const char * const *zpool_default_import_path = NULL;
|
||||
const char *const *zpool_default_import_path = NULL;
|
||||
size_t count;
|
||||
|
||||
cmp_len = strlen(cmp_name);
|
||||
|
@ -47,7 +47,9 @@
|
||||
* using our derived config, and record the results.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_AIO_H
|
||||
#include <aio.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
@ -982,6 +984,9 @@ zpool_read_label_slow(int fd, nvlist_t **config, int *num_labels)
|
||||
int
|
||||
zpool_read_label(int fd, nvlist_t **config, int *num_labels)
|
||||
{
|
||||
#ifndef HAVE_AIO_H
|
||||
return (zpool_read_label_slow(fd, config, num_labels));
|
||||
#else
|
||||
struct stat64 statbuf;
|
||||
struct aiocb aiocbs[VDEV_LABELS];
|
||||
struct aiocb *aiocbps[VDEV_LABELS];
|
||||
@ -1104,6 +1109,7 @@ zpool_read_label(int fd, nvlist_t **config, int *num_labels)
|
||||
*config = expected_config;
|
||||
|
||||
return (0);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -123,7 +123,7 @@ In regards to I/O, performance is similar to raidz since for any read all
|
||||
Delivered random IOPS can be reasonably approximated as
|
||||
.Sy floor((N-S)/(D+P))*single_drive_IOPS .
|
||||
.Pp
|
||||
Like raidzm a dRAID can have single-, double-, or triple-parity.
|
||||
Like raidz, a dRAID can have single-, double-, or triple-parity.
|
||||
The
|
||||
.Sy draid1 ,
|
||||
.Sy draid2 ,
|
||||
|
@ -464,12 +464,7 @@ If no options are specified, all information about the named pool will be
|
||||
displayed at default verbosity.
|
||||
.
|
||||
.Sh EXAMPLES
|
||||
.Bl -tag -width Ds
|
||||
.It Xo
|
||||
.Sy Example 1 :
|
||||
Display the configuration of imported pool
|
||||
.Ar rpool
|
||||
.Xc
|
||||
.Ss Example 1 : No Display the configuration of imported pool Ar rpool
|
||||
.Bd -literal
|
||||
.No # Nm zdb Fl C Ar rpool
|
||||
MOS Configuration:
|
||||
@ -477,22 +472,16 @@ MOS Configuration:
|
||||
name: 'rpool'
|
||||
…
|
||||
.Ed
|
||||
.It Xo
|
||||
.Sy Example 2 :
|
||||
Display basic dataset information about
|
||||
.Ar rpool
|
||||
.Xc
|
||||
.
|
||||
.Ss Example 2 : No Display basic dataset information about Ar rpool
|
||||
.Bd -literal
|
||||
.No # Nm zdb Fl d Ar rpool
|
||||
Dataset mos [META], ID 0, cr_txg 4, 26.9M, 1051 objects
|
||||
Dataset rpool/swap [ZVOL], ID 59, cr_txg 356, 486M, 2 objects
|
||||
…
|
||||
.Ed
|
||||
.It Xo
|
||||
.Sy Example 3 :
|
||||
Display basic information about object 0 in
|
||||
.Ar rpool/export/home
|
||||
.Xc
|
||||
.
|
||||
.Ss Example 3 : No Display basic information about object 0 in Ar rpool/export/home
|
||||
.Bd -literal
|
||||
.No # Nm zdb Fl d Ar rpool/export/home 0
|
||||
Dataset rpool/export/home [ZPL], ID 137, cr_txg 1546, 32K, 8 objects
|
||||
@ -500,11 +489,8 @@ Dataset rpool/export/home [ZPL], ID 137, cr_txg 1546, 32K, 8 objects
|
||||
Object lvl iblk dblk dsize lsize %full type
|
||||
0 7 16K 16K 15.0K 16K 25.00 DMU dnode
|
||||
.Ed
|
||||
.It Xo
|
||||
.Sy Example 4 :
|
||||
Display the predicted effect of enabling deduplication on
|
||||
.Ar rpool
|
||||
.Xc
|
||||
.
|
||||
.Ss Example 4 : No Display the predicted effect of enabling deduplication on Ar rpool
|
||||
.Bd -literal
|
||||
.No # Nm zdb Fl S Ar rpool
|
||||
Simulated DDT histogram:
|
||||
@ -518,7 +504,6 @@ refcnt blocks LSIZE PSIZE DSIZE blocks LSIZE PSIZE DSIZE
|
||||
…
|
||||
dedup = 1.11, compress = 1.80, copies = 1.00, dedup * compress / copies = 2.00
|
||||
.Ed
|
||||
.El
|
||||
.
|
||||
.Sh SEE ALSO
|
||||
.Xr zfs 8 ,
|
||||
|
@ -29,7 +29,7 @@
|
||||
.\" Copyright 2018 Nexenta Systems, Inc.
|
||||
.\" Copyright 2019 Joyent, Inc.
|
||||
.\"
|
||||
.Dd May 27, 2021
|
||||
.Dd March 16, 2022
|
||||
.Dt ZFS-ALLOW 8
|
||||
.Os
|
||||
.
|
||||
@ -384,3 +384,109 @@ Removes permissions from a permission set.
|
||||
If no permissions are specified, then all permissions are removed, thus removing
|
||||
the set entirely.
|
||||
.El
|
||||
.
|
||||
.Sh EXAMPLES
|
||||
.\" These are, respectively, examples 17, 18, 19, 20 from zfs.8
|
||||
.\" Make sure to update them bidirectionally
|
||||
.Ss Example 1 : No Delegating ZFS Administration Permissions on a ZFS Dataset
|
||||
The following example shows how to set permissions so that user
|
||||
.Ar cindys
|
||||
can create, destroy, mount, and take snapshots on
|
||||
.Ar tank/cindys .
|
||||
The permissions on
|
||||
.Ar tank/cindys
|
||||
are also displayed.
|
||||
.Bd -literal -compact -offset Ds
|
||||
.No # Nm zfs Cm allow Sy cindys create , Ns Sy destroy , Ns Sy mount , Ns Sy snapshot Ar tank/cindys
|
||||
.No # Nm zfs Cm allow Ar tank/cindys
|
||||
---- Permissions on tank/cindys --------------------------------------
|
||||
Local+Descendent permissions:
|
||||
user cindys create,destroy,mount,snapshot
|
||||
.Ed
|
||||
.Pp
|
||||
Because the
|
||||
.Ar tank/cindys
|
||||
mount point permission is set to 755 by default, user
|
||||
.Ar cindys
|
||||
will be unable to mount file systems under
|
||||
.Ar tank/cindys .
|
||||
Add an ACE similar to the following syntax to provide mount point access:
|
||||
.Dl # Cm chmod No A+user: Ns Ar cindys Ns :add_subdirectory:allow Ar /tank/cindys
|
||||
.
|
||||
.Ss Example 2 : No Delegating Create Time Permissions on a ZFS Dataset
|
||||
The following example shows how to grant anyone in the group
|
||||
.Ar staff
|
||||
to create file systems in
|
||||
.Ar tank/users .
|
||||
This syntax also allows staff members to destroy their own file systems, but not
|
||||
destroy anyone else's file system.
|
||||
The permissions on
|
||||
.Ar tank/users
|
||||
are also displayed.
|
||||
.Bd -literal -compact -offset Ds
|
||||
.No # Nm zfs Cm allow Ar staff Sy create , Ns Sy mount Ar tank/users
|
||||
.No # Nm zfs Cm allow Fl c Sy destroy Ar tank/users
|
||||
.No # Nm zfs Cm allow Ar tank/users
|
||||
---- Permissions on tank/users ---------------------------------------
|
||||
Permission sets:
|
||||
destroy
|
||||
Local+Descendent permissions:
|
||||
group staff create,mount
|
||||
.Ed
|
||||
.
|
||||
.Ss Example 3 : No Defining and Granting a Permission Set on a ZFS Dataset
|
||||
The following example shows how to define and grant a permission set on the
|
||||
.Ar tank/users
|
||||
file system.
|
||||
The permissions on
|
||||
.Ar tank/users
|
||||
are also displayed.
|
||||
.Bd -literal -compact -offset Ds
|
||||
.No # Nm zfs Cm allow Fl s No @ Ns Ar pset Sy create , Ns Sy destroy , Ns Sy snapshot , Ns Sy mount Ar tank/users
|
||||
.No # Nm zfs Cm allow staff No @ Ns Ar pset tank/users
|
||||
.No # Nm zfs Cm allow Ar tank/users
|
||||
---- Permissions on tank/users ---------------------------------------
|
||||
Permission sets:
|
||||
@pset create,destroy,mount,snapshot
|
||||
Local+Descendent permissions:
|
||||
group staff @pset
|
||||
.Ed
|
||||
.
|
||||
.Ss Example 4 : No Delegating Property Permissions on a ZFS Dataset
|
||||
The following example shows to grant the ability to set quotas and reservations
|
||||
on the
|
||||
.Ar users/home
|
||||
file system.
|
||||
The permissions on
|
||||
.Ar users/home
|
||||
are also displayed.
|
||||
.Bd -literal -compact -offset Ds
|
||||
.No # Nm zfs Cm allow Ar cindys Sy quota , Ns Sy reservation Ar users/home
|
||||
.No # Nm zfs Cm allow Ar users/home
|
||||
---- Permissions on users/home ---------------------------------------
|
||||
Local+Descendent permissions:
|
||||
user cindys quota,reservation
|
||||
cindys% zfs set quota=10G users/home/marks
|
||||
cindys% zfs get quota users/home/marks
|
||||
NAME PROPERTY VALUE SOURCE
|
||||
users/home/marks quota 10G local
|
||||
.Ed
|
||||
.
|
||||
.Ss Example 5 : No Removing ZFS Delegated Permissions on a ZFS Dataset
|
||||
The following example shows how to remove the snapshot permission from the
|
||||
.Ar staff
|
||||
group on the
|
||||
.Sy tank/users
|
||||
file system.
|
||||
The permissions on
|
||||
.Sy tank/users
|
||||
are also displayed.
|
||||
.Bd -literal -compact -offset Ds
|
||||
.No # Nm zfs Cm unallow Ar staff Sy snapshot Ar tank/users
|
||||
.No # Nm zfs Cm allow Ar tank/users
|
||||
---- Permissions on tank/users ---------------------------------------
|
||||
Permission sets:
|
||||
@pset create,destroy,mount,snapshot
|
||||
Local+Descendent permissions:
|
||||
group staff @pset
|
||||
.Ed
|
||||
|
@ -30,7 +30,7 @@
|
||||
.\" Copyright 2019 Joyent, Inc.
|
||||
.\" Copyright (c) 2019, 2020 by Christian Schwarz. All Rights Reserved.
|
||||
.\"
|
||||
.Dd May 27, 2021
|
||||
.Dd March 16, 2022
|
||||
.Dt ZFS-BOOKMARK 8
|
||||
.Os
|
||||
.
|
||||
@ -61,6 +61,14 @@ for details on ZFS feature flags and the
|
||||
.Sy bookmarks
|
||||
feature.
|
||||
.
|
||||
.Sh EXAMPLES
|
||||
.\" These are, respectively, examples 23 from zfs.8
|
||||
.\" Make sure to update them bidirectionally
|
||||
.Ss Example 1 : No Creating a bookmark
|
||||
The following example create a bookmark to a snapshot.
|
||||
This bookmark can then be used instead of snapshot in send streams.
|
||||
.Dl # Nm zfs Cm bookmark Ar rpool Ns @ Ns Ar snapshot rpool Ns # Ns Ar bookmark
|
||||
.
|
||||
.Sh SEE ALSO
|
||||
.Xr zfs-destroy 8 ,
|
||||
.Xr zfs-send 8 ,
|
||||
|
@ -29,7 +29,7 @@
|
||||
.\" Copyright 2018 Nexenta Systems, Inc.
|
||||
.\" Copyright 2019 Joyent, Inc.
|
||||
.\"
|
||||
.Dd May 27, 2021
|
||||
.Dd March 16, 2022
|
||||
.Dt ZFS-CLONE 8
|
||||
.Os
|
||||
.
|
||||
@ -65,6 +65,32 @@ If the target filesystem or volume already exists, the operation completes
|
||||
successfully.
|
||||
.El
|
||||
.
|
||||
.Sh EXAMPLES
|
||||
.\" These are, respectively, examples 9, 10 from zfs.8
|
||||
.\" Make sure to update them bidirectionally
|
||||
.Ss Example 1 : No Creating a ZFS Clone
|
||||
The following command creates a writable file system whose initial contents are
|
||||
the same as
|
||||
.Ar pool/home/bob@yesterday .
|
||||
.Dl # Nm zfs Cm clone Ar pool/home/bob@yesterday pool/clone
|
||||
.
|
||||
.Ss Example 2 : No Promoting a ZFS Clone
|
||||
The following commands illustrate how to test out changes to a file system, and
|
||||
then replace the original file system with the changed one, using clones, clone
|
||||
promotion, and renaming:
|
||||
.Bd -literal -compact -offset Ds
|
||||
.No # Nm zfs Cm create Ar pool/project/production
|
||||
populate /pool/project/production with data
|
||||
.No # Nm zfs Cm snapshot Ar pool/project/production Ns @ Ns Ar today
|
||||
.No # Nm zfs Cm clone Ar pool/project/production@today pool/project/beta
|
||||
make changes to /pool/project/beta and test them
|
||||
.No # Nm zfs Cm promote Ar pool/project/beta
|
||||
.No # Nm zfs Cm rename Ar pool/project/production pool/project/legacy
|
||||
.No # Nm zfs Cm rename Ar pool/project/beta pool/project/production
|
||||
once the legacy version is no longer needed, it can be destroyed
|
||||
.No # Nm zfs Cm destroy Ar pool/project/legacy
|
||||
.Ed
|
||||
.
|
||||
.Sh SEE ALSO
|
||||
.Xr zfs-promote 8 ,
|
||||
.Xr zfs-snapshot 8
|
||||
|
@ -29,7 +29,7 @@
|
||||
.\" Copyright 2018 Nexenta Systems, Inc.
|
||||
.\" Copyright 2019 Joyent, Inc.
|
||||
.\"
|
||||
.Dd December 1, 2020
|
||||
.Dd March 16, 2022
|
||||
.Dt ZFS-CREATE 8
|
||||
.Os
|
||||
.
|
||||
@ -243,6 +243,39 @@ enable the swap area using the
|
||||
command.
|
||||
Swapping to files on ZFS filesystems is not supported.
|
||||
.
|
||||
.Sh EXAMPLES
|
||||
.\" These are, respectively, examples 1, 10 from zfs.8
|
||||
.\" Make sure to update them bidirectionally
|
||||
.Ss Example 1 : No Creating a ZFS File System Hierarchy
|
||||
The following commands create a file system named
|
||||
.Ar pool/home
|
||||
and a file system named
|
||||
.Ar pool/home/bob .
|
||||
The mount point
|
||||
.Pa /export/home
|
||||
is set for the parent file system, and is automatically inherited by the child
|
||||
file system.
|
||||
.Dl # Nm zfs Cm create Ar pool/home
|
||||
.Dl # Nm zfs Cm set Sy mountpoint Ns = Ns Ar /export/home pool/home
|
||||
.Dl # Nm zfs Cm create Ar pool/home/bob
|
||||
.
|
||||
.Ss Example 2 : No Promoting a ZFS Clone
|
||||
The following commands illustrate how to test out changes to a file system, and
|
||||
then replace the original file system with the changed one, using clones, clone
|
||||
promotion, and renaming:
|
||||
.Bd -literal -compact -offset Ds
|
||||
.No # Nm zfs Cm create Ar pool/project/production
|
||||
populate /pool/project/production with data
|
||||
.No # Nm zfs Cm snapshot Ar pool/project/production Ns @ Ns Ar today
|
||||
.No # Nm zfs Cm clone Ar pool/project/production@today pool/project/beta
|
||||
make changes to /pool/project/beta and test them
|
||||
.No # Nm zfs Cm promote Ar pool/project/beta
|
||||
.No # Nm zfs Cm rename Ar pool/project/production pool/project/legacy
|
||||
.No # Nm zfs Cm rename Ar pool/project/beta pool/project/production
|
||||
once the legacy version is no longer needed, it can be destroyed
|
||||
.No # Nm zfs Cm destroy Ar pool/project/legacy
|
||||
.Ed
|
||||
.
|
||||
.Sh SEE ALSO
|
||||
.Xr zfs-destroy 8 ,
|
||||
.Xr zfs-list 8 ,
|
||||
|
@ -29,7 +29,7 @@
|
||||
.\" Copyright 2018 Nexenta Systems, Inc.
|
||||
.\" Copyright 2019 Joyent, Inc.
|
||||
.\"
|
||||
.Dd June 30, 2019
|
||||
.Dd March 16, 2022
|
||||
.Dt ZFS-DESTROY 8
|
||||
.Os
|
||||
.
|
||||
@ -173,6 +173,54 @@ behavior for mounted file systems in use.
|
||||
The given bookmark is destroyed.
|
||||
.El
|
||||
.
|
||||
.Sh EXAMPLES
|
||||
.\" These are, respectively, examples 3, 10, 15 from zfs.8
|
||||
.\" Make sure to update them bidirectionally
|
||||
.Ss Example 1 : No Creating and Destroying Multiple Snapshots
|
||||
The following command creates snapshots named
|
||||
.Ar yesterday No of Ar pool/home
|
||||
and all of its descendent file systems.
|
||||
Each snapshot is mounted on demand in the
|
||||
.Pa .zfs/snapshot
|
||||
directory at the root of its file system.
|
||||
The second command destroys the newly created snapshots.
|
||||
.Dl # Nm zfs Cm snapshot Fl r Ar pool/home Ns @ Ns Ar yesterday
|
||||
.Dl # Nm zfs Cm destroy Fl r Ar pool/home Ns @ Ns Ar yesterday
|
||||
.
|
||||
.Ss Example 2 : No Promoting a ZFS Clone
|
||||
The following commands illustrate how to test out changes to a file system, and
|
||||
then replace the original file system with the changed one, using clones, clone
|
||||
promotion, and renaming:
|
||||
.Bd -literal -compact -offset Ds
|
||||
.No # Nm zfs Cm create Ar pool/project/production
|
||||
populate /pool/project/production with data
|
||||
.No # Nm zfs Cm snapshot Ar pool/project/production Ns @ Ns Ar today
|
||||
.No # Nm zfs Cm clone Ar pool/project/production@today pool/project/beta
|
||||
make changes to /pool/project/beta and test them
|
||||
.No # Nm zfs Cm promote Ar pool/project/beta
|
||||
.No # Nm zfs Cm rename Ar pool/project/production pool/project/legacy
|
||||
.No # Nm zfs Cm rename Ar pool/project/beta pool/project/production
|
||||
once the legacy version is no longer needed, it can be destroyed
|
||||
.No # Nm zfs Cm destroy Ar pool/project/legacy
|
||||
.Ed
|
||||
.
|
||||
.Ss Example 3 : No Performing a Rolling Snapshot
|
||||
The following example shows how to maintain a history of snapshots with a
|
||||
consistent naming scheme.
|
||||
To keep a week's worth of snapshots, the user destroys the oldest snapshot,
|
||||
renames the remaining snapshots, and then creates a new snapshot, as follows:
|
||||
.Bd -literal -compact -offset Ds
|
||||
.No # Nm zfs Cm destroy Fl r Ar pool/users@7daysago
|
||||
.No # Nm zfs Cm rename Fl r Ar pool/users@6daysago No @ Ns Ar 7daysago
|
||||
.No # Nm zfs Cm rename Fl r Ar pool/users@5daysago No @ Ns Ar 6daysago
|
||||
.No # Nm zfs Cm rename Fl r Ar pool/users@4daysago No @ Ns Ar 5daysago
|
||||
.No # Nm zfs Cm rename Fl r Ar pool/users@3daysago No @ Ns Ar 4daysago
|
||||
.No # Nm zfs Cm rename Fl r Ar pool/users@2daysago No @ Ns Ar 3daysago
|
||||
.No # Nm zfs Cm rename Fl r Ar pool/users@yesterday No @ Ns Ar 2daysago
|
||||
.No # Nm zfs Cm rename Fl r Ar pool/users@today No @ Ns Ar yesterday
|
||||
.No # Nm zfs Cm snapshot Fl r Ar pool/users Ns @ Ns Ar today
|
||||
.Ed
|
||||
.
|
||||
.Sh SEE ALSO
|
||||
.Xr zfs-create 8 ,
|
||||
.Xr zfs-hold 8
|
||||
|
@ -29,7 +29,7 @@
|
||||
.\" Copyright 2018 Nexenta Systems, Inc.
|
||||
.\" Copyright 2019 Joyent, Inc.
|
||||
.\"
|
||||
.Dd May 29, 2021
|
||||
.Dd March 16, 2022
|
||||
.Dt ZFS-DIFF 8
|
||||
.Os
|
||||
.
|
||||
@ -98,5 +98,24 @@ Do not
|
||||
non-ASCII paths.
|
||||
.El
|
||||
.
|
||||
.Sh EXAMPLES
|
||||
.\" These are, respectively, examples 22 from zfs.8
|
||||
.\" Make sure to update them bidirectionally
|
||||
.Ss Example 1 : No Showing the differences between a snapshot and a ZFS Dataset
|
||||
The following example shows how to see what has changed between a prior
|
||||
snapshot of a ZFS dataset and its current state.
|
||||
The
|
||||
.Fl F
|
||||
option is used to indicate type information for the files affected.
|
||||
.Bd -literal -compact -offset Ds
|
||||
.No # Nm zfs Cm diff Fl F Ar tank/test@before tank/test
|
||||
M / /tank/test/
|
||||
M F /tank/test/linked (+1)
|
||||
R F /tank/test/oldname -> /tank/test/newname
|
||||
- F /tank/test/deleted
|
||||
+ F /tank/test/created
|
||||
M F /tank/test/modified
|
||||
.Ed
|
||||
.
|
||||
.Sh SEE ALSO
|
||||
.Xr zfs-snapshot 8
|
||||
|
@ -29,7 +29,7 @@
|
||||
.\" Copyright 2018 Nexenta Systems, Inc.
|
||||
.\" Copyright 2019 Joyent, Inc.
|
||||
.\"
|
||||
.Dd May 27, 2021
|
||||
.Dd March 16, 2022
|
||||
.Dt ZFS-LIST 8
|
||||
.Os
|
||||
.
|
||||
@ -70,10 +70,6 @@ The following fields are displayed:
|
||||
Used for scripting mode.
|
||||
Do not print headers and separate fields by a single tab instead of arbitrary
|
||||
white space.
|
||||
.It Fl S Ar property
|
||||
Same as the
|
||||
.Fl s
|
||||
option, but sorts by property in descending order.
|
||||
.It Fl d Ar depth
|
||||
Recursively display any children of the dataset, limiting the recursion to
|
||||
.Ar depth .
|
||||
@ -142,6 +138,10 @@ the specified ordering.
|
||||
If no sorting options are specified the existing behavior of
|
||||
.Nm zfs Cm list
|
||||
is preserved.
|
||||
.It Fl S Ar property
|
||||
Same as
|
||||
.Fl s ,
|
||||
but sorts by property in descending order.
|
||||
.It Fl t Ar type
|
||||
A comma-separated list of types to display, where
|
||||
.Ar type
|
||||
@ -157,6 +157,27 @@ For example, specifying
|
||||
displays only snapshots.
|
||||
.El
|
||||
.
|
||||
.Sh EXAMPLES
|
||||
.\" These are, respectively, examples 5 from zfs.8
|
||||
.\" Make sure to update them bidirectionally
|
||||
.Ss Example 1 : No Listing ZFS Datasets
|
||||
The following command lists all active file systems and volumes in the system.
|
||||
Snapshots are displayed if
|
||||
.Sy listsnaps Ns = Ns Sy on .
|
||||
The default is
|
||||
.Sy off .
|
||||
See
|
||||
.Xr zpoolprops 7
|
||||
for more information on pool properties.
|
||||
.Bd -literal -compact -offset Ds
|
||||
.No # Nm zfs Cm list
|
||||
NAME USED AVAIL REFER MOUNTPOINT
|
||||
pool 450K 457G 18K /pool
|
||||
pool/home 315K 457G 21K /export/home
|
||||
pool/home/anne 18K 457G 18K /export/home/anne
|
||||
pool/home/bob 276K 457G 276K /export/home/bob
|
||||
.Ed
|
||||
.
|
||||
.Sh SEE ALSO
|
||||
.Xr zfsprops 7 ,
|
||||
.Xr zfs-get 8
|
||||
|
@ -29,7 +29,7 @@
|
||||
.\" Copyright 2018 Nexenta Systems, Inc.
|
||||
.\" Copyright 2019 Joyent, Inc.
|
||||
.\"
|
||||
.Dd June 30, 2019
|
||||
.Dd March 16, 2022
|
||||
.Dt ZFS-PROMOTE 8
|
||||
.Os
|
||||
.
|
||||
@ -59,6 +59,26 @@ The
|
||||
.Nm zfs Cm rename
|
||||
subcommand can be used to rename any conflicting snapshots.
|
||||
.
|
||||
.Sh EXAMPLES
|
||||
.\" These are, respectively, examples 10 from zfs.8
|
||||
.\" Make sure to update them bidirectionally
|
||||
.Ss Example 1 : No Promoting a ZFS Clone
|
||||
The following commands illustrate how to test out changes to a file system, and
|
||||
then replace the original file system with the changed one, using clones, clone
|
||||
promotion, and renaming:
|
||||
.Bd -literal -compact -offset Ds
|
||||
.No # Nm zfs Cm create Ar pool/project/production
|
||||
populate /pool/project/production with data
|
||||
.No # Nm zfs Cm snapshot Ar pool/project/production Ns @ Ns Ar today
|
||||
.No # Nm zfs Cm clone Ar pool/project/production@today pool/project/beta
|
||||
make changes to /pool/project/beta and test them
|
||||
.No # Nm zfs Cm promote Ar pool/project/beta
|
||||
.No # Nm zfs Cm rename Ar pool/project/production pool/project/legacy
|
||||
.No # Nm zfs Cm rename Ar pool/project/beta pool/project/production
|
||||
once the legacy version is no longer needed, it can be destroyed
|
||||
.No # Nm zfs Cm destroy Ar pool/project/legacy
|
||||
.Ed
|
||||
.
|
||||
.Sh SEE ALSO
|
||||
.Xr zfs-clone 8 ,
|
||||
.Xr zfs-rename 8
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user