Changeset View
Changeset View
Standalone View
Standalone View
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Show First 20 Lines • Show All 3,465 Lines • ▼ Show 20 Lines | if (spa_version(spa) < SPA_VERSION_ZPOOL_HISTORY) { | ||||
return (SET_ERROR(ENOTSUP)); | return (SET_ERROR(ENOTSUP)); | ||||
} | } | ||||
error = spa_history_log(spa, message); | error = spa_history_log(spa, message); | ||||
spa_close(spa, FTAG); | spa_close(spa, FTAG); | ||||
return (error); | return (error); | ||||
} | } | ||||
#ifdef __FreeBSD__ | |||||
static int | |||||
zfs_ioc_nextboot(const char *unused, nvlist_t *innvl, nvlist_t *outnvl) | |||||
{ | |||||
char name[MAXNAMELEN]; | |||||
spa_t *spa; | |||||
vdev_t *vd; | |||||
char *command; | |||||
uint64_t pool_guid; | |||||
uint64_t vdev_guid; | |||||
int error; | |||||
if (nvlist_lookup_uint64(innvl, | |||||
ZPOOL_CONFIG_POOL_GUID, &pool_guid) != 0) | |||||
return (EINVAL); | |||||
if (nvlist_lookup_uint64(innvl, | |||||
ZPOOL_CONFIG_GUID, &vdev_guid) != 0) | |||||
return (EINVAL); | |||||
if (nvlist_lookup_string(innvl, | |||||
"command", &command) != 0) | |||||
return (EINVAL); | |||||
mutex_enter(&spa_namespace_lock); | |||||
spa = spa_by_guid(pool_guid, vdev_guid); | |||||
if (spa != NULL) | |||||
strcpy(name, spa_name(spa)); | |||||
mutex_exit(&spa_namespace_lock); | |||||
if (spa == NULL) | |||||
return (ENOENT); | |||||
if ((error = spa_open(name, &spa, FTAG)) != 0) | |||||
return (error); | |||||
spa_vdev_state_enter(spa, SCL_ALL); | |||||
vd = spa_lookup_by_guid(spa, vdev_guid, B_TRUE); | |||||
if (vd == NULL) { | |||||
(void) spa_vdev_state_exit(spa, NULL, ENXIO); | |||||
spa_close(spa, FTAG); | |||||
return (ENODEV); | |||||
} | |||||
error = vdev_label_write_pad2(vd, command, strlen(command)); | |||||
(void) spa_vdev_state_exit(spa, NULL, 0); | |||||
txg_wait_synced(spa->spa_dsl_pool, 0); | |||||
spa_close(spa, FTAG); | |||||
return (error); | |||||
} | |||||
#endif | |||||
/* | /* | ||||
* The dp_config_rwlock must not be held when calling this, because the | * The dp_config_rwlock must not be held when calling this, because the | ||||
* unmount may need to write out data. | * unmount may need to write out data. | ||||
* | * | ||||
* This function is best-effort. Callers must deal gracefully if it | * This function is best-effort. Callers must deal gracefully if it | ||||
* remains mounted (or is remounted after this call). | * remains mounted (or is remounted after this call). | ||||
* | * | ||||
* Returns 0 if the argument is not a snapshot, or it is not currently a | * Returns 0 if the argument is not a snapshot, or it is not currently a | ||||
▲ Show 20 Lines • Show All 2,546 Lines • ▼ Show 20 Lines | zfs_ioctl_register_dataset_nolog(ZFS_IOC_TMP_SNAPSHOT, | ||||
zfs_ioc_tmp_snapshot, zfs_secpolicy_tmp_snapshot, | zfs_ioc_tmp_snapshot, zfs_secpolicy_tmp_snapshot, | ||||
POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY); | POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY); | ||||
#ifdef __FreeBSD__ | #ifdef __FreeBSD__ | ||||
zfs_ioctl_register_dataset_nolog(ZFS_IOC_JAIL, zfs_ioc_jail, | zfs_ioctl_register_dataset_nolog(ZFS_IOC_JAIL, zfs_ioc_jail, | ||||
zfs_secpolicy_config, POOL_CHECK_NONE); | zfs_secpolicy_config, POOL_CHECK_NONE); | ||||
zfs_ioctl_register_dataset_nolog(ZFS_IOC_UNJAIL, zfs_ioc_unjail, | zfs_ioctl_register_dataset_nolog(ZFS_IOC_UNJAIL, zfs_ioc_unjail, | ||||
zfs_secpolicy_config, POOL_CHECK_NONE); | zfs_secpolicy_config, POOL_CHECK_NONE); | ||||
zfs_ioctl_register("fbsd_nextboot", ZFS_IOC_NEXTBOOT, | |||||
zfs_ioc_nextboot, zfs_secpolicy_config, NO_NAME, | |||||
POOL_CHECK_NONE, B_FALSE, B_FALSE); | |||||
#endif | #endif | ||||
} | } | ||||
int | int | ||||
pool_status_check(const char *name, zfs_ioc_namecheck_t type, | pool_status_check(const char *name, zfs_ioc_namecheck_t type, | ||||
zfs_ioc_poolcheck_t check) | zfs_ioc_poolcheck_t check) | ||||
{ | { | ||||
spa_t *spa; | spa_t *spa; | ||||
▲ Show 20 Lines • Show All 776 Lines • Show Last 20 Lines |