mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
Illumos #278: get rid zfs of python and pyzfs dependencies
Remove all python and pyzfs dependencies for consistency and to ensure full functionality even in a mimimalist environment. Reviewed by: gordon.w.ross@gmail.com Reviewed by: trisk@opensolaris.org Reviewed by: alexander.r.eremin@gmail.com Reviewed by: jerry.jelinek@joyent.com Approved by: garrett@nexenta.com References to Illumos issue and patch: - https://www.illumos.org/issues/278 - https://github.com/illumos/illumos-gate/commit/1af68beac3 Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue #340 Issue #160 Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
parent
ca5252204a
commit
0b7936d5c2
2273
cmd/zfs/zfs_main.c
2273
cmd/zfs/zfs_main.c
File diff suppressed because it is too large
Load Diff
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _LIBZFS_H
|
#ifndef _LIBZFS_H
|
||||||
@ -572,13 +573,17 @@ extern int zfs_promote(zfs_handle_t *);
|
|||||||
extern int zfs_hold(zfs_handle_t *, const char *, const char *, boolean_t,
|
extern int zfs_hold(zfs_handle_t *, const char *, const char *, boolean_t,
|
||||||
boolean_t, boolean_t, int, uint64_t, uint64_t);
|
boolean_t, boolean_t, int, uint64_t, uint64_t);
|
||||||
extern int zfs_release(zfs_handle_t *, const char *, const char *, boolean_t);
|
extern int zfs_release(zfs_handle_t *, const char *, const char *, boolean_t);
|
||||||
|
extern int zfs_get_holds(zfs_handle_t *, nvlist_t **);
|
||||||
extern uint64_t zvol_volsize_to_reservation(uint64_t, nvlist_t *);
|
extern uint64_t zvol_volsize_to_reservation(uint64_t, nvlist_t *);
|
||||||
|
|
||||||
typedef int (*zfs_userspace_cb_t)(void *arg, const char *domain,
|
typedef int (*zfs_userspace_cb_t)(void *arg, const char *domain,
|
||||||
uid_t rid, uint64_t space);
|
uid_t rid, uint64_t space);
|
||||||
|
|
||||||
extern int zfs_userspace(zfs_handle_t *zhp, zfs_userquota_prop_t type,
|
extern int zfs_userspace(zfs_handle_t *, zfs_userquota_prop_t,
|
||||||
zfs_userspace_cb_t func, void *arg);
|
zfs_userspace_cb_t, void *);
|
||||||
|
|
||||||
|
extern int zfs_get_fsacl(zfs_handle_t *, nvlist_t **);
|
||||||
|
extern int zfs_set_fsacl(zfs_handle_t *, boolean_t, nvlist_t *);
|
||||||
|
|
||||||
typedef struct recvflags {
|
typedef struct recvflags {
|
||||||
/* print informational messages (ie, -v was specified) */
|
/* print informational messages (ie, -v was specified) */
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _ZFS_DELEG_H
|
#ifndef _ZFS_DELEG_H
|
||||||
@ -51,6 +52,7 @@ typedef enum {
|
|||||||
ZFS_DELEG_NOTE_CLONE,
|
ZFS_DELEG_NOTE_CLONE,
|
||||||
ZFS_DELEG_NOTE_PROMOTE,
|
ZFS_DELEG_NOTE_PROMOTE,
|
||||||
ZFS_DELEG_NOTE_RENAME,
|
ZFS_DELEG_NOTE_RENAME,
|
||||||
|
ZFS_DELEG_NOTE_SEND,
|
||||||
ZFS_DELEG_NOTE_RECEIVE,
|
ZFS_DELEG_NOTE_RECEIVE,
|
||||||
ZFS_DELEG_NOTE_ALLOW,
|
ZFS_DELEG_NOTE_ALLOW,
|
||||||
ZFS_DELEG_NOTE_USERPROP,
|
ZFS_DELEG_NOTE_USERPROP,
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* Copyright (c) 2010 Nexenta Systems, Inc. All rights reserved.
|
||||||
* Copyright (c) 2011 by Delphix. All rights reserved.
|
* Copyright (c) 2011 by Delphix. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -95,6 +96,7 @@ zfs_validate_name(libzfs_handle_t *hdl, const char *path, int type,
|
|||||||
namecheck_err_t why;
|
namecheck_err_t why;
|
||||||
char what;
|
char what;
|
||||||
|
|
||||||
|
(void) zfs_prop_get_table();
|
||||||
if (dataset_namecheck(path, &why, &what) != 0) {
|
if (dataset_namecheck(path, &why, &what) != 0) {
|
||||||
if (hdl != NULL) {
|
if (hdl != NULL) {
|
||||||
switch (why) {
|
switch (why) {
|
||||||
@ -4313,6 +4315,193 @@ zfs_release(zfs_handle_t *zhp, const char *snapname, const char *tag,
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
zfs_get_fsacl(zfs_handle_t *zhp, nvlist_t **nvl)
|
||||||
|
{
|
||||||
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
|
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
||||||
|
int nvsz = 2048;
|
||||||
|
void *nvbuf;
|
||||||
|
int err = 0;
|
||||||
|
char errbuf[ZFS_MAXNAMELEN+32];
|
||||||
|
|
||||||
|
assert(zhp->zfs_type == ZFS_TYPE_VOLUME ||
|
||||||
|
zhp->zfs_type == ZFS_TYPE_FILESYSTEM);
|
||||||
|
|
||||||
|
tryagain:
|
||||||
|
|
||||||
|
nvbuf = malloc(nvsz);
|
||||||
|
if (nvbuf == NULL) {
|
||||||
|
err = (zfs_error(hdl, EZFS_NOMEM, strerror(errno)));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
zc.zc_nvlist_dst_size = nvsz;
|
||||||
|
zc.zc_nvlist_dst = (uintptr_t)nvbuf;
|
||||||
|
|
||||||
|
(void) strlcpy(zc.zc_name, zhp->zfs_name, ZFS_MAXNAMELEN);
|
||||||
|
|
||||||
|
if (zfs_ioctl(hdl, ZFS_IOC_GET_FSACL, &zc) != 0) {
|
||||||
|
(void) snprintf(errbuf, sizeof (errbuf),
|
||||||
|
dgettext(TEXT_DOMAIN, "cannot get permissions on '%s'"),
|
||||||
|
zc.zc_name);
|
||||||
|
switch (errno) {
|
||||||
|
case ENOMEM:
|
||||||
|
free(nvbuf);
|
||||||
|
nvsz = zc.zc_nvlist_dst_size;
|
||||||
|
goto tryagain;
|
||||||
|
|
||||||
|
case ENOTSUP:
|
||||||
|
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||||
|
"pool must be upgraded"));
|
||||||
|
err = zfs_error(hdl, EZFS_BADVERSION, errbuf);
|
||||||
|
break;
|
||||||
|
case EINVAL:
|
||||||
|
err = zfs_error(hdl, EZFS_BADTYPE, errbuf);
|
||||||
|
break;
|
||||||
|
case ENOENT:
|
||||||
|
err = zfs_error(hdl, EZFS_NOENT, errbuf);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
err = zfs_standard_error_fmt(hdl, errno, errbuf);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* success */
|
||||||
|
int rc = nvlist_unpack(nvbuf, zc.zc_nvlist_dst_size, nvl, 0);
|
||||||
|
if (rc) {
|
||||||
|
(void) snprintf(errbuf, sizeof (errbuf), dgettext(
|
||||||
|
TEXT_DOMAIN, "cannot get permissions on '%s'"),
|
||||||
|
zc.zc_name);
|
||||||
|
err = zfs_standard_error_fmt(hdl, rc, errbuf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(nvbuf);
|
||||||
|
out:
|
||||||
|
return (err);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
zfs_set_fsacl(zfs_handle_t *zhp, boolean_t un, nvlist_t *nvl)
|
||||||
|
{
|
||||||
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
|
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
||||||
|
char *nvbuf;
|
||||||
|
char errbuf[ZFS_MAXNAMELEN+32];
|
||||||
|
size_t nvsz;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
assert(zhp->zfs_type == ZFS_TYPE_VOLUME ||
|
||||||
|
zhp->zfs_type == ZFS_TYPE_FILESYSTEM);
|
||||||
|
|
||||||
|
err = nvlist_size(nvl, &nvsz, NV_ENCODE_NATIVE);
|
||||||
|
assert(err == 0);
|
||||||
|
|
||||||
|
nvbuf = malloc(nvsz);
|
||||||
|
|
||||||
|
err = nvlist_pack(nvl, &nvbuf, &nvsz, NV_ENCODE_NATIVE, 0);
|
||||||
|
assert(err == 0);
|
||||||
|
|
||||||
|
zc.zc_nvlist_src_size = nvsz;
|
||||||
|
zc.zc_nvlist_src = (uintptr_t)nvbuf;
|
||||||
|
zc.zc_perm_action = un;
|
||||||
|
|
||||||
|
(void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
|
||||||
|
|
||||||
|
if (zfs_ioctl(hdl, ZFS_IOC_SET_FSACL, &zc) != 0) {
|
||||||
|
(void) snprintf(errbuf, sizeof (errbuf),
|
||||||
|
dgettext(TEXT_DOMAIN, "cannot set permissions on '%s'"),
|
||||||
|
zc.zc_name);
|
||||||
|
switch (errno) {
|
||||||
|
case ENOTSUP:
|
||||||
|
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||||
|
"pool must be upgraded"));
|
||||||
|
err = zfs_error(hdl, EZFS_BADVERSION, errbuf);
|
||||||
|
break;
|
||||||
|
case EINVAL:
|
||||||
|
err = zfs_error(hdl, EZFS_BADTYPE, errbuf);
|
||||||
|
break;
|
||||||
|
case ENOENT:
|
||||||
|
err = zfs_error(hdl, EZFS_NOENT, errbuf);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
err = zfs_standard_error_fmt(hdl, errno, errbuf);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(nvbuf);
|
||||||
|
|
||||||
|
return (err);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
zfs_get_holds(zfs_handle_t *zhp, nvlist_t **nvl)
|
||||||
|
{
|
||||||
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
|
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
||||||
|
int nvsz = 2048;
|
||||||
|
void *nvbuf;
|
||||||
|
int err = 0;
|
||||||
|
char errbuf[ZFS_MAXNAMELEN+32];
|
||||||
|
|
||||||
|
assert(zhp->zfs_type == ZFS_TYPE_SNAPSHOT);
|
||||||
|
|
||||||
|
tryagain:
|
||||||
|
|
||||||
|
nvbuf = malloc(nvsz);
|
||||||
|
if (nvbuf == NULL) {
|
||||||
|
err = (zfs_error(hdl, EZFS_NOMEM, strerror(errno)));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
zc.zc_nvlist_dst_size = nvsz;
|
||||||
|
zc.zc_nvlist_dst = (uintptr_t)nvbuf;
|
||||||
|
|
||||||
|
(void) strlcpy(zc.zc_name, zhp->zfs_name, ZFS_MAXNAMELEN);
|
||||||
|
|
||||||
|
if (zfs_ioctl(hdl, ZFS_IOC_GET_HOLDS, &zc) != 0) {
|
||||||
|
(void) snprintf(errbuf, sizeof (errbuf),
|
||||||
|
dgettext(TEXT_DOMAIN, "cannot get holds for '%s'"),
|
||||||
|
zc.zc_name);
|
||||||
|
switch (errno) {
|
||||||
|
case ENOMEM:
|
||||||
|
free(nvbuf);
|
||||||
|
nvsz = zc.zc_nvlist_dst_size;
|
||||||
|
goto tryagain;
|
||||||
|
|
||||||
|
case ENOTSUP:
|
||||||
|
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||||
|
"pool must be upgraded"));
|
||||||
|
err = zfs_error(hdl, EZFS_BADVERSION, errbuf);
|
||||||
|
break;
|
||||||
|
case EINVAL:
|
||||||
|
err = zfs_error(hdl, EZFS_BADTYPE, errbuf);
|
||||||
|
break;
|
||||||
|
case ENOENT:
|
||||||
|
err = zfs_error(hdl, EZFS_NOENT, errbuf);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
err = zfs_standard_error_fmt(hdl, errno, errbuf);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* success */
|
||||||
|
int rc = nvlist_unpack(nvbuf, zc.zc_nvlist_dst_size, nvl, 0);
|
||||||
|
if (rc) {
|
||||||
|
(void) snprintf(errbuf, sizeof (errbuf),
|
||||||
|
dgettext(TEXT_DOMAIN, "cannot get holds for '%s'"),
|
||||||
|
zc.zc_name);
|
||||||
|
err = zfs_standard_error_fmt(hdl, rc, errbuf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(nvbuf);
|
||||||
|
out:
|
||||||
|
return (err);
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
zvol_volsize_to_reservation(uint64_t volsize, nvlist_t *props)
|
zvol_volsize_to_reservation(uint64_t volsize, nvlist_t *props)
|
||||||
{
|
{
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(_KERNEL)
|
#if defined(_KERNEL)
|
||||||
@ -60,7 +61,7 @@ zfs_deleg_perm_tab_t zfs_deleg_perm_tab[] = {
|
|||||||
{ZFS_DELEG_PERM_ROLLBACK, ZFS_DELEG_NOTE_ROLLBACK },
|
{ZFS_DELEG_PERM_ROLLBACK, ZFS_DELEG_NOTE_ROLLBACK },
|
||||||
{ZFS_DELEG_PERM_SNAPSHOT, ZFS_DELEG_NOTE_SNAPSHOT },
|
{ZFS_DELEG_PERM_SNAPSHOT, ZFS_DELEG_NOTE_SNAPSHOT },
|
||||||
{ZFS_DELEG_PERM_SHARE, ZFS_DELEG_NOTE_SHARE },
|
{ZFS_DELEG_PERM_SHARE, ZFS_DELEG_NOTE_SHARE },
|
||||||
{ZFS_DELEG_PERM_SEND, ZFS_DELEG_NOTE_NONE },
|
{ZFS_DELEG_PERM_SEND, ZFS_DELEG_NOTE_SEND },
|
||||||
{ZFS_DELEG_PERM_USERPROP, ZFS_DELEG_NOTE_USERPROP },
|
{ZFS_DELEG_PERM_USERPROP, ZFS_DELEG_NOTE_USERPROP },
|
||||||
{ZFS_DELEG_PERM_USERQUOTA, ZFS_DELEG_NOTE_USERQUOTA },
|
{ZFS_DELEG_PERM_USERQUOTA, ZFS_DELEG_NOTE_USERQUOTA },
|
||||||
{ZFS_DELEG_PERM_GROUPQUOTA, ZFS_DELEG_NOTE_GROUPQUOTA },
|
{ZFS_DELEG_PERM_GROUPQUOTA, ZFS_DELEG_NOTE_GROUPQUOTA },
|
||||||
|
Loading…
Reference in New Issue
Block a user