mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
Add prototypes
Add prototypes/move prototypes to header files. Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu> Closes #10470
This commit is contained in:
committed by
Brian Behlendorf
parent
60356b1a21
commit
0ce2de637b
@@ -80,6 +80,11 @@ typedef struct umem_cache {
|
||||
int cache_cflags;
|
||||
} umem_cache_t;
|
||||
|
||||
/* Prototypes for functions to provide defaults for umem envvars */
|
||||
const char *_umem_debug_init(void);
|
||||
const char *_umem_options_init(void);
|
||||
const char *_umem_logging_init(void);
|
||||
|
||||
static inline void *
|
||||
umem_alloc(size_t size, int flags)
|
||||
{
|
||||
|
||||
@@ -1722,114 +1722,6 @@ zfs_fix_auto_resv(zfs_handle_t *zhp, nvlist_t *nvl)
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
zfs_setprop_error(libzfs_handle_t *hdl, zfs_prop_t prop, int err,
|
||||
char *errbuf)
|
||||
{
|
||||
switch (err) {
|
||||
|
||||
case ENOSPC:
|
||||
/*
|
||||
* For quotas and reservations, ENOSPC indicates
|
||||
* something different; setting a quota or reservation
|
||||
* doesn't use any disk space.
|
||||
*/
|
||||
switch (prop) {
|
||||
case ZFS_PROP_QUOTA:
|
||||
case ZFS_PROP_REFQUOTA:
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"size is less than current used or "
|
||||
"reserved space"));
|
||||
(void) zfs_error(hdl, EZFS_PROPSPACE, errbuf);
|
||||
break;
|
||||
|
||||
case ZFS_PROP_RESERVATION:
|
||||
case ZFS_PROP_REFRESERVATION:
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"size is greater than available space"));
|
||||
(void) zfs_error(hdl, EZFS_PROPSPACE, errbuf);
|
||||
break;
|
||||
|
||||
default:
|
||||
(void) zfs_standard_error(hdl, err, errbuf);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case EBUSY:
|
||||
(void) zfs_standard_error(hdl, EBUSY, errbuf);
|
||||
break;
|
||||
|
||||
case EROFS:
|
||||
(void) zfs_error(hdl, EZFS_DSREADONLY, errbuf);
|
||||
break;
|
||||
|
||||
case E2BIG:
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"property value too long"));
|
||||
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
|
||||
break;
|
||||
|
||||
case ENOTSUP:
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"pool and or dataset must be upgraded to set this "
|
||||
"property or value"));
|
||||
(void) zfs_error(hdl, EZFS_BADVERSION, errbuf);
|
||||
break;
|
||||
|
||||
case ERANGE:
|
||||
if (prop == ZFS_PROP_COMPRESSION ||
|
||||
prop == ZFS_PROP_DNODESIZE ||
|
||||
prop == ZFS_PROP_RECORDSIZE) {
|
||||
(void) zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"property setting is not allowed on "
|
||||
"bootable datasets"));
|
||||
(void) zfs_error(hdl, EZFS_NOTSUP, errbuf);
|
||||
} else if (prop == ZFS_PROP_CHECKSUM ||
|
||||
prop == ZFS_PROP_DEDUP) {
|
||||
(void) zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"property setting is not allowed on "
|
||||
"root pools"));
|
||||
(void) zfs_error(hdl, EZFS_NOTSUP, errbuf);
|
||||
} else {
|
||||
(void) zfs_standard_error(hdl, err, errbuf);
|
||||
}
|
||||
break;
|
||||
|
||||
case EINVAL:
|
||||
if (prop == ZPROP_INVAL) {
|
||||
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
|
||||
} else {
|
||||
(void) zfs_standard_error(hdl, err, errbuf);
|
||||
}
|
||||
break;
|
||||
|
||||
case EACCES:
|
||||
if (prop == ZFS_PROP_KEYLOCATION) {
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"keylocation may only be set on encryption roots"));
|
||||
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
|
||||
} else {
|
||||
(void) zfs_standard_error(hdl, err, errbuf);
|
||||
}
|
||||
break;
|
||||
|
||||
case EOVERFLOW:
|
||||
/*
|
||||
* This platform can't address a volume this big.
|
||||
*/
|
||||
#ifdef _ILP32
|
||||
if (prop == ZFS_PROP_VOLSIZE) {
|
||||
(void) zfs_error(hdl, EZFS_VOLTOOBIG, errbuf);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
(void) zfs_standard_error(hdl, err, errbuf);
|
||||
}
|
||||
}
|
||||
|
||||
static boolean_t
|
||||
zfs_is_namespace_prop(zfs_prop_t prop)
|
||||
{
|
||||
|
||||
@@ -69,9 +69,6 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sha2.h>
|
||||
|
||||
/* in libzfs_dataset.c */
|
||||
extern void zfs_setprop_error(libzfs_handle_t *, zfs_prop_t, int, char *);
|
||||
|
||||
static int zfs_receive_impl(libzfs_handle_t *, const char *, const char *,
|
||||
recvflags_t *, int, const char *, nvlist_t *, avl_tree_t *, char **,
|
||||
const char *, nvlist_t *);
|
||||
|
||||
@@ -481,6 +481,114 @@ zfs_standard_error_fmt(libzfs_handle_t *hdl, int error, const char *fmt, ...)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
void
|
||||
zfs_setprop_error(libzfs_handle_t *hdl, zfs_prop_t prop, int err,
|
||||
char *errbuf)
|
||||
{
|
||||
switch (err) {
|
||||
|
||||
case ENOSPC:
|
||||
/*
|
||||
* For quotas and reservations, ENOSPC indicates
|
||||
* something different; setting a quota or reservation
|
||||
* doesn't use any disk space.
|
||||
*/
|
||||
switch (prop) {
|
||||
case ZFS_PROP_QUOTA:
|
||||
case ZFS_PROP_REFQUOTA:
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"size is less than current used or "
|
||||
"reserved space"));
|
||||
(void) zfs_error(hdl, EZFS_PROPSPACE, errbuf);
|
||||
break;
|
||||
|
||||
case ZFS_PROP_RESERVATION:
|
||||
case ZFS_PROP_REFRESERVATION:
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"size is greater than available space"));
|
||||
(void) zfs_error(hdl, EZFS_PROPSPACE, errbuf);
|
||||
break;
|
||||
|
||||
default:
|
||||
(void) zfs_standard_error(hdl, err, errbuf);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case EBUSY:
|
||||
(void) zfs_standard_error(hdl, EBUSY, errbuf);
|
||||
break;
|
||||
|
||||
case EROFS:
|
||||
(void) zfs_error(hdl, EZFS_DSREADONLY, errbuf);
|
||||
break;
|
||||
|
||||
case E2BIG:
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"property value too long"));
|
||||
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
|
||||
break;
|
||||
|
||||
case ENOTSUP:
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"pool and or dataset must be upgraded to set this "
|
||||
"property or value"));
|
||||
(void) zfs_error(hdl, EZFS_BADVERSION, errbuf);
|
||||
break;
|
||||
|
||||
case ERANGE:
|
||||
if (prop == ZFS_PROP_COMPRESSION ||
|
||||
prop == ZFS_PROP_DNODESIZE ||
|
||||
prop == ZFS_PROP_RECORDSIZE) {
|
||||
(void) zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"property setting is not allowed on "
|
||||
"bootable datasets"));
|
||||
(void) zfs_error(hdl, EZFS_NOTSUP, errbuf);
|
||||
} else if (prop == ZFS_PROP_CHECKSUM ||
|
||||
prop == ZFS_PROP_DEDUP) {
|
||||
(void) zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"property setting is not allowed on "
|
||||
"root pools"));
|
||||
(void) zfs_error(hdl, EZFS_NOTSUP, errbuf);
|
||||
} else {
|
||||
(void) zfs_standard_error(hdl, err, errbuf);
|
||||
}
|
||||
break;
|
||||
|
||||
case EINVAL:
|
||||
if (prop == ZPROP_INVAL) {
|
||||
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
|
||||
} else {
|
||||
(void) zfs_standard_error(hdl, err, errbuf);
|
||||
}
|
||||
break;
|
||||
|
||||
case EACCES:
|
||||
if (prop == ZFS_PROP_KEYLOCATION) {
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"keylocation may only be set on encryption roots"));
|
||||
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
|
||||
} else {
|
||||
(void) zfs_standard_error(hdl, err, errbuf);
|
||||
}
|
||||
break;
|
||||
|
||||
case EOVERFLOW:
|
||||
/*
|
||||
* This platform can't address a volume this big.
|
||||
*/
|
||||
#ifdef _ILP32
|
||||
if (prop == ZFS_PROP_VOLSIZE) {
|
||||
(void) zfs_error(hdl, EZFS_VOLTOOBIG, errbuf);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
(void) zfs_standard_error(hdl, err, errbuf);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
zpool_standard_error(libzfs_handle_t *hdl, int error, const char *msg)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user