mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-27 11:29:36 +03:00
libzfs: Make zfs_cmd_t initialization consistent, use zfs_ioctl
The clang version 8.0.1 shipped in FreeBSD 12.1-RELEASE also oddly throws a warning that is treated as an error on the initialization of the zc struct in zpool_nextboot. The zpool_nextboot code from FreeBSD was not updated to use zfs_ioctl. Switch ioctl to zfs_ioctl in and use {"\0"} to initialize the struct. Do a consistency pass for zfs_cmd_t initialization. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: George Wilson <gwilson@delphix.com> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #10539
This commit is contained in:
parent
fb91f0367e
commit
659f4008be
@ -860,7 +860,8 @@ int
|
|||||||
zfs_send_progress(zfs_handle_t *zhp, int fd, uint64_t *bytes_written,
|
zfs_send_progress(zfs_handle_t *zhp, int fd, uint64_t *bytes_written,
|
||||||
uint64_t *blocks_visited)
|
uint64_t *blocks_visited)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { {0} };
|
zfs_cmd_t zc = {"\0"};
|
||||||
|
|
||||||
(void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
|
(void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
|
||||||
zc.zc_cookie = fd;
|
zc.zc_cookie = fd;
|
||||||
if (zfs_ioctl(zhp->zfs_hdl, ZFS_IOC_SEND_PROGRESS, &zc) != 0)
|
if (zfs_ioctl(zhp->zfs_hdl, ZFS_IOC_SEND_PROGRESS, &zc) != 0)
|
||||||
|
@ -230,7 +230,7 @@ int
|
|||||||
zfs_jail(zfs_handle_t *zhp, int jailid, int attach)
|
zfs_jail(zfs_handle_t *zhp, int jailid, int attach)
|
||||||
{
|
{
|
||||||
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
||||||
zfs_cmd_t zc = { { 0 } };
|
zfs_cmd_t zc = {"\0"};
|
||||||
char errbuf[1024];
|
char errbuf[1024];
|
||||||
unsigned long cmd;
|
unsigned long cmd;
|
||||||
int ret;
|
int ret;
|
||||||
@ -281,7 +281,7 @@ int
|
|||||||
zpool_nextboot(libzfs_handle_t *hdl, uint64_t pool_guid, uint64_t dev_guid,
|
zpool_nextboot(libzfs_handle_t *hdl, uint64_t pool_guid, uint64_t dev_guid,
|
||||||
const char *command)
|
const char *command)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { 0 };
|
zfs_cmd_t zc = {"\0"};
|
||||||
nvlist_t *args;
|
nvlist_t *args;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ zpool_nextboot(libzfs_handle_t *hdl, uint64_t pool_guid, uint64_t dev_guid,
|
|||||||
fnvlist_add_string(args, "command", command);
|
fnvlist_add_string(args, "command", command);
|
||||||
error = zcmd_write_src_nvlist(hdl, &zc, args);
|
error = zcmd_write_src_nvlist(hdl, &zc, args);
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
error = ioctl(hdl->libzfs_fd, ZFS_IOC_NEXTBOOT, &zc);
|
error = zfs_ioctl(hdl, ZFS_IOC_NEXTBOOT, &zc);
|
||||||
zcmd_free_nvlists(&zc);
|
zcmd_free_nvlists(&zc);
|
||||||
nvlist_free(args);
|
nvlist_free(args);
|
||||||
return (error);
|
return (error);
|
||||||
|
@ -293,7 +293,7 @@ lzc_promote(const char *fsname, char *snapnamebuf, int snapnamelen)
|
|||||||
* The promote ioctl is still legacy, so we need to construct our
|
* The promote ioctl is still legacy, so we need to construct our
|
||||||
* own zfs_cmd_t rather than using lzc_ioctl().
|
* own zfs_cmd_t rather than using lzc_ioctl().
|
||||||
*/
|
*/
|
||||||
zfs_cmd_t zc = { "\0" };
|
zfs_cmd_t zc = {"\0"};
|
||||||
|
|
||||||
ASSERT3S(g_refcount, >, 0);
|
ASSERT3S(g_refcount, >, 0);
|
||||||
VERIFY3S(g_fd, !=, -1);
|
VERIFY3S(g_fd, !=, -1);
|
||||||
@ -311,8 +311,9 @@ lzc_promote(const char *fsname, char *snapnamebuf, int snapnamelen)
|
|||||||
int
|
int
|
||||||
lzc_rename(const char *source, const char *target)
|
lzc_rename(const char *source, const char *target)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0" };
|
zfs_cmd_t zc = {"\0"};
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
ASSERT3S(g_refcount, >, 0);
|
ASSERT3S(g_refcount, >, 0);
|
||||||
VERIFY3S(g_fd, !=, -1);
|
VERIFY3S(g_fd, !=, -1);
|
||||||
(void) strlcpy(zc.zc_name, source, sizeof (zc.zc_name));
|
(void) strlcpy(zc.zc_name, source, sizeof (zc.zc_name));
|
||||||
|
Loading…
Reference in New Issue
Block a user