mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Rebase master to b108
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
@@ -264,9 +264,15 @@ typedef enum {
|
||||
ZPOOL_STATUS_HOSTID_MISMATCH, /* last accessed by another system */
|
||||
ZPOOL_STATUS_IO_FAILURE_WAIT, /* failed I/O, failmode 'wait' */
|
||||
ZPOOL_STATUS_IO_FAILURE_CONTINUE, /* failed I/O, failmode 'continue' */
|
||||
ZPOOL_STATUS_BAD_LOG, /* cannot read log chain(s) */
|
||||
|
||||
/*
|
||||
* These faults have no corresponding message ID. At the time we are
|
||||
* checking the status, the original reason for the FMA fault (I/O or
|
||||
* checksum errors) has been lost.
|
||||
*/
|
||||
ZPOOL_STATUS_FAULTED_DEV_R, /* faulted device with replicas */
|
||||
ZPOOL_STATUS_FAULTED_DEV_NR, /* faulted device with no replicas */
|
||||
ZPOOL_STATUS_BAD_LOG, /* cannot read log chain(s) */
|
||||
|
||||
/*
|
||||
* The following are not faults per se, but still an error possibly
|
||||
@@ -466,6 +472,9 @@ typedef struct recvflags {
|
||||
|
||||
/* byteswap flag is used internally; callers need not specify */
|
||||
int byteswap : 1;
|
||||
|
||||
/* do not mount file systems as they are extracted (private) */
|
||||
int nomount : 1;
|
||||
} recvflags_t;
|
||||
|
||||
extern int zfs_receive(libzfs_handle_t *, const char *, recvflags_t,
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
@@ -1180,10 +1180,12 @@ zpool_enable_datasets(zpool_handle_t *zhp, const char *mntopts, int flags)
|
||||
|
||||
/*
|
||||
* And mount all the datasets, keeping track of which ones
|
||||
* succeeded or failed. By using zfs_alloc(), the good pointer
|
||||
* will always be non-NULL.
|
||||
* succeeded or failed.
|
||||
*/
|
||||
good = zfs_alloc(zhp->zpool_hdl, cb.cb_used * sizeof (int));
|
||||
if ((good = zfs_alloc(zhp->zpool_hdl,
|
||||
cb.cb_used * sizeof (int))) == NULL)
|
||||
goto out;
|
||||
|
||||
ret = 0;
|
||||
for (i = 0; i < cb.cb_used; i++) {
|
||||
if (zfs_mount(cb.cb_datasets[i], mntopts, flags) != 0)
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
@@ -217,12 +217,39 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf, size_t len,
|
||||
uint_t vsc;
|
||||
|
||||
if (zpool_get_state(zhp) == POOL_STATE_UNAVAIL) {
|
||||
if (prop == ZPOOL_PROP_NAME)
|
||||
switch (prop) {
|
||||
case ZPOOL_PROP_NAME:
|
||||
(void) strlcpy(buf, zpool_get_name(zhp), len);
|
||||
else if (prop == ZPOOL_PROP_HEALTH)
|
||||
break;
|
||||
|
||||
case ZPOOL_PROP_HEALTH:
|
||||
(void) strlcpy(buf, "FAULTED", len);
|
||||
else
|
||||
break;
|
||||
|
||||
case ZPOOL_PROP_GUID:
|
||||
intval = zpool_get_prop_int(zhp, prop, &src);
|
||||
(void) snprintf(buf, len, "%llu", intval);
|
||||
break;
|
||||
|
||||
case ZPOOL_PROP_ALTROOT:
|
||||
case ZPOOL_PROP_CACHEFILE:
|
||||
if (zhp->zpool_props != NULL ||
|
||||
zpool_get_all_props(zhp) == 0) {
|
||||
(void) strlcpy(buf,
|
||||
zpool_get_prop_string(zhp, prop, &src),
|
||||
len);
|
||||
if (srctype != NULL)
|
||||
*srctype = src;
|
||||
return (0);
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
(void) strlcpy(buf, "-", len);
|
||||
break;
|
||||
}
|
||||
|
||||
if (srctype != NULL)
|
||||
*srctype = src;
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -532,9 +559,6 @@ zpool_set_prop(zpool_handle_t *zhp, const char *propname, const char *propval)
|
||||
dgettext(TEXT_DOMAIN, "cannot set property for '%s'"),
|
||||
zhp->zpool_name);
|
||||
|
||||
if (zhp->zpool_props == NULL && zpool_get_all_props(zhp))
|
||||
return (zfs_error(zhp->zpool_hdl, EZFS_POOLPROPS, errbuf));
|
||||
|
||||
if (nvlist_alloc(&nvl, NV_UNIQUE_NAME, 0) != 0)
|
||||
return (no_memory(zhp->zpool_hdl));
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
@@ -2077,7 +2077,7 @@ zfs_receive(libzfs_handle_t *hdl, const char *tosnap, recvflags_t flags,
|
||||
|
||||
err = zfs_receive_impl(hdl, tosnap, flags, infd, stream_avl, &top_zfs);
|
||||
|
||||
if (err == 0 && top_zfs) {
|
||||
if (err == 0 && !flags.nomount && top_zfs) {
|
||||
zfs_handle_t *zhp;
|
||||
prop_changelist_t *clp;
|
||||
|
||||
|
||||
@@ -480,7 +480,6 @@ zfs_realloc(libzfs_handle_t *hdl, void *ptr, size_t oldsize, size_t newsize)
|
||||
|
||||
if ((ret = realloc(ptr, newsize)) == NULL) {
|
||||
(void) no_memory(hdl);
|
||||
free(ptr);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -1018,9 +1017,9 @@ zfs_nicestrtonum(libzfs_handle_t *hdl, const char *value, uint64_t *num)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* Rely on stroll() to process the numeric portion. */
|
||||
/* Rely on stroull() to process the numeric portion. */
|
||||
errno = 0;
|
||||
*num = strtoll(value, &end, 10);
|
||||
*num = strtoull(value, &end, 10);
|
||||
|
||||
/*
|
||||
* Check for ERANGE, which indicates that the value is too large to fit
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
@@ -490,7 +490,7 @@ typedef struct callb_cpr {
|
||||
/*
|
||||
* Hostname information
|
||||
*/
|
||||
extern char hw_serial[];
|
||||
extern char hw_serial[]; /* for userland-emulated hostid access */
|
||||
extern int ddi_strtoul(const char *str, char **nptr, int base,
|
||||
unsigned long *result);
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <sys/zfs_context.h>
|
||||
#include <sys/zmod.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/systeminfo.h>
|
||||
|
||||
/*
|
||||
* Emulation of kernel services in userland.
|
||||
@@ -43,7 +44,7 @@
|
||||
|
||||
uint64_t physmem;
|
||||
vnode_t *rootdir = (vnode_t *)0xabcd1234;
|
||||
char hw_serial[11];
|
||||
char hw_serial[HW_HOSTID_LEN];
|
||||
|
||||
struct utsname utsname = {
|
||||
"userland", "libzpool", "1", "1", "na"
|
||||
@@ -778,7 +779,7 @@ kernel_init(int mode)
|
||||
dprintf("physmem = %llu pages (%.2f GB)\n", physmem,
|
||||
(double)physmem * sysconf(_SC_PAGE_SIZE) / (1ULL << 30));
|
||||
|
||||
snprintf(hw_serial, sizeof (hw_serial), "%ld", gethostid());
|
||||
(void) snprintf(hw_serial, sizeof (hw_serial), "%ld", gethostid());
|
||||
|
||||
VERIFY((random_fd = open("/dev/random", O_RDONLY)) != -1);
|
||||
VERIFY((urandom_fd = open("/dev/urandom", O_RDONLY)) != -1);
|
||||
|
||||
Reference in New Issue
Block a user