Changeset View
Changeset View
Standalone View
Standalone View
cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
Show All 15 Lines | |||||
* fields enclosed by brackets "[]" replaced with your own identifying | * fields enclosed by brackets "[]" replaced with your own identifying | ||||
* information: Portions Copyright [yyyy] [name of copyright owner] | * information: Portions Copyright [yyyy] [name of copyright owner] | ||||
* | * | ||||
* CDDL HEADER END | * CDDL HEADER END | ||||
*/ | */ | ||||
/* | /* | ||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. | * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. | ||||
* Copyright (c) 2011, 2017 by Delphix. All rights reserved. | * Copyright (c) 2011, 2020 by Delphix. All rights reserved. | ||||
* Copyright (c) 2013, Joyent, Inc. All rights reserved. | * Copyright (c) 2013, Joyent, Inc. All rights reserved. | ||||
* Copyright 2016 Nexenta Systems, Inc. | * Copyright 2016 Nexenta Systems, Inc. | ||||
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com> | * Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com> | ||||
* Copyright (c) 2017 Datto Inc. | * Copyright (c) 2017 Datto Inc. | ||||
* Copyright (c) 2017, Intel Corporation. | * Copyright (c) 2017, Intel Corporation. | ||||
*/ | */ | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
▲ Show 20 Lines • Show All 357 Lines • ▼ Show 20 Lines | zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf, size_t len, | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* Check if the bootfs name has the same pool name as it is set to. | * Check if the bootfs name has the same pool name as it is set to. | ||||
* Assuming bootfs is a valid dataset name. | * Assuming bootfs is a valid dataset name. | ||||
*/ | */ | ||||
static boolean_t | static boolean_t | ||||
bootfs_name_valid(const char *pool, char *bootfs) | bootfs_name_valid(const char *pool, const char *bootfs) | ||||
imp: This change could be peeled off, as it's 100% independent of the rest. | |||||
{ | { | ||||
int len = strlen(pool); | int len = strlen(pool); | ||||
if (!zfs_name_valid(bootfs, ZFS_TYPE_FILESYSTEM|ZFS_TYPE_SNAPSHOT)) | if (!zfs_name_valid(bootfs, ZFS_TYPE_FILESYSTEM|ZFS_TYPE_SNAPSHOT)) | ||||
return (B_FALSE); | return (B_FALSE); | ||||
if (strncmp(pool, bootfs, len) == 0 && | if (strncmp(pool, bootfs, len) == 0 && | ||||
(bootfs[len] == '/' || bootfs[len] == '\0')) | (bootfs[len] == '/' || bootfs[len] == '\0')) | ||||
▲ Show 20 Lines • Show All 3,817 Lines • ▼ Show 20 Lines | if (ioctl(zhp->zpool_hdl->libzfs_fd, ZFS_IOC_OBJ_TO_PATH, | ||||
} else { | } else { | ||||
(void) snprintf(pathname, len, "%s:%s", | (void) snprintf(pathname, len, "%s:%s", | ||||
dsname, zc.zc_value); | dsname, zc.zc_value); | ||||
} | } | ||||
} else { | } else { | ||||
(void) snprintf(pathname, len, "%s:<0x%llx>", dsname, obj); | (void) snprintf(pathname, len, "%s:<0x%llx>", dsname, obj); | ||||
} | } | ||||
free(mntpnt); | free(mntpnt); | ||||
} | |||||
int | |||||
zpool_set_bootenv(zpool_handle_t *zhp, const nvlist_t *envmap) | |||||
{ | |||||
int error = lzc_set_bootenv(zhp->zpool_name, envmap); | |||||
if (error != 0) { | |||||
(void) zpool_standard_error_fmt(zhp->zpool_hdl, error, | |||||
dgettext(TEXT_DOMAIN, | |||||
"error setting bootenv in pool '%s'"), zhp->zpool_name); | |||||
} | |||||
return (error); | |||||
} | |||||
int | |||||
zpool_get_bootenv(zpool_handle_t *zhp, nvlist_t **nvlp) | |||||
{ | |||||
nvlist_t *nvl; | |||||
int error; | |||||
nvl = NULL; | |||||
error = lzc_get_bootenv(zhp->zpool_name, &nvl); | |||||
if (error != 0) { | |||||
(void) zpool_standard_error_fmt(zhp->zpool_hdl, error, | |||||
dgettext(TEXT_DOMAIN, | |||||
"error getting bootenv in pool '%s'"), zhp->zpool_name); | |||||
} else { | |||||
*nvlp = nvl; | |||||
} | |||||
return (error); | |||||
} | } | ||||
#ifdef illumos | #ifdef illumos | ||||
/* | /* | ||||
* Read the EFI label from the config, if a label does not exist then | * Read the EFI label from the config, if a label does not exist then | ||||
* pass back the error to the caller. If the caller has passed a non-NULL | * pass back the error to the caller. If the caller has passed a non-NULL | ||||
* diskaddr argument then we set it to the starting address of the EFI | * diskaddr argument then we set it to the starting address of the EFI | ||||
* partition. If the caller has passed a non-NULL boolean argument, then | * partition. If the caller has passed a non-NULL boolean argument, then | ||||
▲ Show 20 Lines • Show All 392 Lines • Show Last 20 Lines |
This change could be peeled off, as it's 100% independent of the rest.