mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
Add zpool_nextboot, move zfs_jail to libzfs.h
FreeBSD has a zfsbootcfg command that wants zpool_nextboot in libzfs. Add the function to FreeBSD's libzfs_compat.c, and while here move the prototype for zfs_jail out of param.h in FreeBSD's SPL and into libzfs.h under an ifdef for FreeBSD, where the prototype for zpool_nextboot joins it. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #10524
This commit is contained in:
parent
cd32b4f5b7
commit
fb91f0367e
@ -893,6 +893,20 @@ int zfs_smb_acl_rename(libzfs_handle_t *, char *, char *, char *, char *);
|
||||
extern int zpool_enable_datasets(zpool_handle_t *, const char *, int);
|
||||
extern int zpool_disable_datasets(zpool_handle_t *, boolean_t);
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
|
||||
/*
|
||||
* Attach/detach the given filesystem to/from the given jail.
|
||||
*/
|
||||
extern int zfs_jail(zfs_handle_t *zhp, int jailid, int attach);
|
||||
|
||||
/*
|
||||
* Set loader options for next boot.
|
||||
*/
|
||||
extern int zpool_nextboot(libzfs_handle_t *, uint64_t, uint64_t, const char *);
|
||||
|
||||
#endif /* __FreeBSD__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -61,10 +61,4 @@ extern size_t spl_pagesize(void);
|
||||
|
||||
extern int execvpe(const char *name, char * const argv[], char * const envp[]);
|
||||
|
||||
struct zfs_handle;
|
||||
/*
|
||||
* Attach/detach the given filesystem to/from the given jail.
|
||||
*/
|
||||
extern int zfs_jail(struct zfs_handle *zhp, int jailid, int attach);
|
||||
|
||||
#endif
|
||||
|
@ -274,6 +274,29 @@ zfs_jail(zfs_handle_t *zhp, int jailid, int attach)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set loader options for next boot.
|
||||
*/
|
||||
int
|
||||
zpool_nextboot(libzfs_handle_t *hdl, uint64_t pool_guid, uint64_t dev_guid,
|
||||
const char *command)
|
||||
{
|
||||
zfs_cmd_t zc = { 0 };
|
||||
nvlist_t *args;
|
||||
int error;
|
||||
|
||||
args = fnvlist_alloc();
|
||||
fnvlist_add_uint64(args, ZPOOL_CONFIG_POOL_GUID, pool_guid);
|
||||
fnvlist_add_uint64(args, ZPOOL_CONFIG_GUID, dev_guid);
|
||||
fnvlist_add_string(args, "command", command);
|
||||
error = zcmd_write_src_nvlist(hdl, &zc, args);
|
||||
if (error == 0)
|
||||
error = ioctl(hdl->libzfs_fd, ZFS_IOC_NEXTBOOT, &zc);
|
||||
zcmd_free_nvlists(&zc);
|
||||
nvlist_free(args);
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Fill given version buffer with zfs kernel version.
|
||||
* Returns 0 on success, and -1 on error (with errno set)
|
||||
|
Loading…
Reference in New Issue
Block a user