mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 19:28:53 +03:00
OpenZFS 9630 - add lzc_rename and lzc_destroy to libzfs_core
Porting Notes: * Additional changes to recv_rename_impl() were required due to encryption code not being merged in OpenZFS yet. * libzfs_core python bindings (pyzfs) were updated to fully support both lzc_rename() and lzc_destroy() Authored by: Andriy Gapon <avg@FreeBSD.org> Reviewed by: Andy Stormont <astormont@racktopsystems.com> Reviewed by: Matt Ahrens <matt@delphix.com> Reviewed by: Serapheim Dimitropoulos <serapheim.dimitro@delphix.com> Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov> Approved by: Dan McDonald <danmcd@joyent.com> Ported-by: loli10K <ezomori.nozomu@gmail.com> OpenZFS-issue: https://www.illumos.org/issues/9630 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/049ba63 Closes #8207
This commit is contained in:
committed by
Brian Behlendorf
parent
eff7d78f8a
commit
dc1c630b8a
@@ -316,6 +316,30 @@ lzc_remap(const char *fsname)
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
lzc_rename(const char *source, const char *target)
|
||||
{
|
||||
zfs_cmd_t zc = { "\0" };
|
||||
int error;
|
||||
ASSERT3S(g_refcount, >, 0);
|
||||
VERIFY3S(g_fd, !=, -1);
|
||||
(void) strlcpy(zc.zc_name, source, sizeof (zc.zc_name));
|
||||
(void) strlcpy(zc.zc_value, target, sizeof (zc.zc_value));
|
||||
error = ioctl(g_fd, ZFS_IOC_RENAME, &zc);
|
||||
if (error != 0)
|
||||
error = errno;
|
||||
return (error);
|
||||
}
|
||||
int
|
||||
lzc_destroy(const char *fsname)
|
||||
{
|
||||
int error;
|
||||
nvlist_t *args = fnvlist_alloc();
|
||||
error = lzc_ioctl(ZFS_IOC_DESTROY, fsname, args, NULL);
|
||||
nvlist_free(args);
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Creates snapshots.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user