Changeset View
Changeset View
Standalone View
Standalone View
sys/contrib/openzfs/module/zfs/zfs_ioctl.c
Show First 20 Lines • Show All 3,505 Lines • ▼ Show 20 Lines | zfs_ioc_log_history(const char *unused, nvlist_t *innvl, nvlist_t *outnvl) | ||||
error = spa_history_log(spa, message); | error = spa_history_log(spa, message); | ||||
spa_close(spa, FTAG); | spa_close(spa, FTAG); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* This ioctl is used to set the bootenv configuration on the current | * This ioctl is used to set the bootenv configuration on the current | ||||
* pool. This configuration is stored in the second padding area of the label, | * pool. This configuration is stored in the second padding area of the label, | ||||
* and it is used by the GRUB bootloader used on Linux to store the contents | * and it is used by the bootloader(s) to store the bootloader and/or system | ||||
* of the grubenv file. The file is stored as raw ASCII, and is protected by | * specific data. | ||||
* an embedded checksum. By default, GRUB will check if the boot filesystem | * The data is stored as nvlist data stream, and is protected by | ||||
* supports storing the environment data in a special location, and if so, | * an embedded checksum. | ||||
* will invoke filesystem specific logic to retrieve it. This can be overridden | |||||
* by a variable, should the user so desire. | |||||
*/ | */ | ||||
/* ARGSUSED */ | |||||
static const zfs_ioc_key_t zfs_keys_set_bootenv[] = { | static const zfs_ioc_key_t zfs_keys_set_bootenv[] = { | ||||
{"envmap", DATA_TYPE_STRING, 0}, | {"version", DATA_TYPE_UINT64, 0}, | ||||
{"<keys>", DATA_TYPE_ANY, ZK_OPTIONAL | ZK_WILDCARDLIST}, | |||||
}; | }; | ||||
static int | static int | ||||
zfs_ioc_set_bootenv(const char *name, nvlist_t *innvl, nvlist_t *outnvl) | zfs_ioc_set_bootenv(const char *name, nvlist_t *innvl, nvlist_t *outnvl) | ||||
{ | { | ||||
char *envmap; | |||||
int error; | int error; | ||||
spa_t *spa; | spa_t *spa; | ||||
envmap = fnvlist_lookup_string(innvl, "envmap"); | |||||
if ((error = spa_open(name, &spa, FTAG)) != 0) | if ((error = spa_open(name, &spa, FTAG)) != 0) | ||||
return (error); | return (error); | ||||
spa_vdev_state_enter(spa, SCL_ALL); | spa_vdev_state_enter(spa, SCL_ALL); | ||||
error = vdev_label_write_bootenv(spa->spa_root_vdev, envmap); | error = vdev_label_write_bootenv(spa->spa_root_vdev, innvl); | ||||
(void) spa_vdev_state_exit(spa, NULL, 0); | (void) spa_vdev_state_exit(spa, NULL, 0); | ||||
spa_close(spa, FTAG); | spa_close(spa, FTAG); | ||||
return (error); | return (error); | ||||
} | } | ||||
static const zfs_ioc_key_t zfs_keys_get_bootenv[] = { | static const zfs_ioc_key_t zfs_keys_get_bootenv[] = { | ||||
/* no nvl keys */ | /* no nvl keys */ | ||||
}; | }; | ||||
/* ARGSUSED */ | |||||
static int | static int | ||||
zfs_ioc_get_bootenv(const char *name, nvlist_t *innvl, nvlist_t *outnvl) | zfs_ioc_get_bootenv(const char *name, nvlist_t *innvl, nvlist_t *outnvl) | ||||
{ | { | ||||
spa_t *spa; | spa_t *spa; | ||||
int error; | int error; | ||||
if ((error = spa_open(name, &spa, FTAG)) != 0) | if ((error = spa_open(name, &spa, FTAG)) != 0) | ||||
return (error); | return (error); | ||||
▲ Show 20 Lines • Show All 4,074 Lines • Show Last 20 Lines |