6314 buffer overflow in dsl_dataset_name
illumos/illumos-gate@9adfa60d48
9adfa60d48
https://www.illumos.org/issues/6314
Callers of dsl_dataset_name pass a buffer of size ZFS_MAXNAMELEN, but
dsl_dataset_name copies the datasets' name PLUS the snapshot name to it,
resulting in a max of 2 * ZFS_MAXNAMELEN + '@'.
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Matthew Ahrens <mahrens@delphix.com>
This commit is contained in:
parent
dc71048043
commit
f728d00c4d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor-sys/illumos/dist/; revision=302660
@ -60,7 +60,6 @@
|
|||||||
#include <sys/ddt.h>
|
#include <sys/ddt.h>
|
||||||
#include <sys/zfeature.h>
|
#include <sys/zfeature.h>
|
||||||
#include <zfs_comutil.h>
|
#include <zfs_comutil.h>
|
||||||
#undef ZFS_MAXNAMELEN
|
|
||||||
#undef verify
|
#undef verify
|
||||||
#include <libzfs.h>
|
#include <libzfs.h>
|
||||||
|
|
||||||
@ -1920,7 +1919,7 @@ dump_dir(objset_t *os)
|
|||||||
uint64_t refdbytes, usedobjs, scratch;
|
uint64_t refdbytes, usedobjs, scratch;
|
||||||
char numbuf[32];
|
char numbuf[32];
|
||||||
char blkbuf[BP_SPRINTF_LEN + 20];
|
char blkbuf[BP_SPRINTF_LEN + 20];
|
||||||
char osname[MAXNAMELEN];
|
char osname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char *type = "UNKNOWN";
|
char *type = "UNKNOWN";
|
||||||
int verbosity = dump_opt['d'];
|
int verbosity = dump_opt['d'];
|
||||||
int print_header = 1;
|
int print_header = 1;
|
||||||
@ -3454,7 +3453,7 @@ find_zpool(char **target, nvlist_t **configp, int dirc, char **dirv)
|
|||||||
nvlist_t *match = NULL;
|
nvlist_t *match = NULL;
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
char *sepp = NULL;
|
char *sepp = NULL;
|
||||||
char sep;
|
char sep = '\0';
|
||||||
int count = 0;
|
int count = 0;
|
||||||
importargs_t args = { 0 };
|
importargs_t args = { 0 };
|
||||||
|
|
||||||
|
@ -1482,7 +1482,7 @@ get_callback(zfs_handle_t *zhp, void *data)
|
|||||||
char buf[ZFS_MAXPROPLEN];
|
char buf[ZFS_MAXPROPLEN];
|
||||||
char rbuf[ZFS_MAXPROPLEN];
|
char rbuf[ZFS_MAXPROPLEN];
|
||||||
zprop_source_t sourcetype;
|
zprop_source_t sourcetype;
|
||||||
char source[ZFS_MAXNAMELEN];
|
char source[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
zprop_get_cbdata_t *cbp = data;
|
zprop_get_cbdata_t *cbp = data;
|
||||||
nvlist_t *user_props = zfs_get_user_props(zhp);
|
nvlist_t *user_props = zfs_get_user_props(zhp);
|
||||||
zprop_list_t *pl = cbp->cb_proplist;
|
zprop_list_t *pl = cbp->cb_proplist;
|
||||||
@ -1962,7 +1962,7 @@ typedef struct upgrade_cbdata {
|
|||||||
uint64_t cb_version;
|
uint64_t cb_version;
|
||||||
boolean_t cb_newer;
|
boolean_t cb_newer;
|
||||||
boolean_t cb_foundone;
|
boolean_t cb_foundone;
|
||||||
char cb_lastfs[ZFS_MAXNAMELEN];
|
char cb_lastfs[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
} upgrade_cbdata_t;
|
} upgrade_cbdata_t;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -2408,7 +2408,7 @@ userspace_cb(void *arg, const char *domain, uid_t rid, uint64_t space)
|
|||||||
|
|
||||||
if (domain != NULL && domain[0] != '\0') {
|
if (domain != NULL && domain[0] != '\0') {
|
||||||
/* SMB */
|
/* SMB */
|
||||||
char sid[ZFS_MAXNAMELEN + 32];
|
char sid[MAXNAMELEN + 32];
|
||||||
uid_t id;
|
uid_t id;
|
||||||
int err;
|
int err;
|
||||||
int flag = IDMAP_REQ_FLG_USE_CACHE;
|
int flag = IDMAP_REQ_FLG_USE_CACHE;
|
||||||
@ -2537,7 +2537,7 @@ print_us_node(boolean_t scripted, boolean_t parsable, int *fields, int types,
|
|||||||
size_t *width, us_node_t *node)
|
size_t *width, us_node_t *node)
|
||||||
{
|
{
|
||||||
nvlist_t *nvl = node->usn_nvl;
|
nvlist_t *nvl = node->usn_nvl;
|
||||||
char valstr[ZFS_MAXNAMELEN];
|
char valstr[MAXNAMELEN];
|
||||||
boolean_t first = B_TRUE;
|
boolean_t first = B_TRUE;
|
||||||
int cfield = 0;
|
int cfield = 0;
|
||||||
int field;
|
int field;
|
||||||
@ -3405,7 +3405,7 @@ zfs_do_rollback(int argc, char **argv)
|
|||||||
boolean_t force = B_FALSE;
|
boolean_t force = B_FALSE;
|
||||||
rollback_cbdata_t cb = { 0 };
|
rollback_cbdata_t cb = { 0 };
|
||||||
zfs_handle_t *zhp, *snap;
|
zfs_handle_t *zhp, *snap;
|
||||||
char parentname[ZFS_MAXNAMELEN];
|
char parentname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char *delim;
|
char *delim;
|
||||||
|
|
||||||
/* check options */
|
/* check options */
|
||||||
@ -3805,7 +3805,7 @@ zfs_do_send(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
if (strchr(argv[0], '@') == NULL ||
|
if (strchr(argv[0], '@') == NULL ||
|
||||||
(fromname && strchr(fromname, '#') != NULL)) {
|
(fromname && strchr(fromname, '#') != NULL)) {
|
||||||
char frombuf[ZFS_MAXNAMELEN];
|
char frombuf[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
enum lzc_send_flags lzc_flags = 0;
|
enum lzc_send_flags lzc_flags = 0;
|
||||||
|
|
||||||
if (flags.replicate || flags.doall || flags.props ||
|
if (flags.replicate || flags.doall || flags.props ||
|
||||||
@ -3857,7 +3857,7 @@ zfs_do_send(int argc, char **argv)
|
|||||||
* case if they specify the origin.
|
* case if they specify the origin.
|
||||||
*/
|
*/
|
||||||
if (fromname && (cp = strchr(fromname, '@')) != NULL) {
|
if (fromname && (cp = strchr(fromname, '@')) != NULL) {
|
||||||
char origin[ZFS_MAXNAMELEN];
|
char origin[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
zprop_source_t src;
|
zprop_source_t src;
|
||||||
|
|
||||||
(void) zfs_prop_get(zhp, ZFS_PROP_ORIGIN,
|
(void) zfs_prop_get(zhp, ZFS_PROP_ORIGIN,
|
||||||
@ -3991,7 +3991,7 @@ zfs_do_receive(int argc, char **argv)
|
|||||||
usage(B_FALSE);
|
usage(B_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
char namebuf[ZFS_MAXNAMELEN];
|
char namebuf[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
(void) snprintf(namebuf, sizeof (namebuf),
|
(void) snprintf(namebuf, sizeof (namebuf),
|
||||||
"%s/%%recv", argv[0]);
|
"%s/%%recv", argv[0]);
|
||||||
|
|
||||||
@ -4849,7 +4849,7 @@ store_allow_perm(zfs_deleg_who_type_t type, boolean_t local, boolean_t descend,
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char ld[2] = { '\0', '\0' };
|
char ld[2] = { '\0', '\0' };
|
||||||
char who_buf[ZFS_MAXNAMELEN+32];
|
char who_buf[MAXNAMELEN + 32];
|
||||||
char base_type = '\0';
|
char base_type = '\0';
|
||||||
char set_type = '\0';
|
char set_type = '\0';
|
||||||
nvlist_t *base_nvl = NULL;
|
nvlist_t *base_nvl = NULL;
|
||||||
@ -5217,7 +5217,7 @@ static void
|
|||||||
print_fs_perms(fs_perm_set_t *fspset)
|
print_fs_perms(fs_perm_set_t *fspset)
|
||||||
{
|
{
|
||||||
fs_perm_node_t *node = NULL;
|
fs_perm_node_t *node = NULL;
|
||||||
char buf[ZFS_MAXNAMELEN+32];
|
char buf[MAXNAMELEN + 32];
|
||||||
const char *dsname = buf;
|
const char *dsname = buf;
|
||||||
|
|
||||||
for (node = uu_list_first(fspset->fsps_list); node != NULL;
|
for (node = uu_list_first(fspset->fsps_list); node != NULL;
|
||||||
@ -5226,7 +5226,7 @@ print_fs_perms(fs_perm_set_t *fspset)
|
|||||||
uu_avl_t *uge_avl = node->fspn_fsperm.fsp_uge_avl;
|
uu_avl_t *uge_avl = node->fspn_fsperm.fsp_uge_avl;
|
||||||
int left = 0;
|
int left = 0;
|
||||||
|
|
||||||
(void) snprintf(buf, ZFS_MAXNAMELEN+32,
|
(void) snprintf(buf, sizeof (buf),
|
||||||
gettext("---- Permissions on %s "),
|
gettext("---- Permissions on %s "),
|
||||||
node->fspn_fsperm.fsp_name);
|
node->fspn_fsperm.fsp_name);
|
||||||
(void) printf(dsname);
|
(void) printf(dsname);
|
||||||
@ -5423,7 +5423,7 @@ zfs_do_hold_rele_impl(int argc, char **argv, boolean_t holding)
|
|||||||
|
|
||||||
for (i = 0; i < argc; ++i) {
|
for (i = 0; i < argc; ++i) {
|
||||||
zfs_handle_t *zhp;
|
zfs_handle_t *zhp;
|
||||||
char parent[ZFS_MAXNAMELEN];
|
char parent[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
const char *delim;
|
const char *delim;
|
||||||
char *path = argv[i];
|
char *path = argv[i];
|
||||||
|
|
||||||
@ -5551,7 +5551,7 @@ holds_callback(zfs_handle_t *zhp, void *data)
|
|||||||
nvlist_t *nvl = NULL;
|
nvlist_t *nvl = NULL;
|
||||||
nvpair_t *nvp = NULL;
|
nvpair_t *nvp = NULL;
|
||||||
const char *zname = zfs_get_name(zhp);
|
const char *zname = zfs_get_name(zhp);
|
||||||
size_t znamelen = strnlen(zname, ZFS_MAXNAMELEN);
|
size_t znamelen = strlen(zname);
|
||||||
|
|
||||||
if (cbp->cb_recursive) {
|
if (cbp->cb_recursive) {
|
||||||
const char *snapname;
|
const char *snapname;
|
||||||
@ -5572,7 +5572,7 @@ holds_callback(zfs_handle_t *zhp, void *data)
|
|||||||
|
|
||||||
while ((nvp = nvlist_next_nvpair(nvl, nvp)) != NULL) {
|
while ((nvp = nvlist_next_nvpair(nvl, nvp)) != NULL) {
|
||||||
const char *tag = nvpair_name(nvp);
|
const char *tag = nvpair_name(nvp);
|
||||||
size_t taglen = strnlen(tag, MAXNAMELEN);
|
size_t taglen = strlen(tag);
|
||||||
if (taglen > cbp->cb_max_taglen)
|
if (taglen > cbp->cb_max_taglen)
|
||||||
cbp->cb_max_taglen = taglen;
|
cbp->cb_max_taglen = taglen;
|
||||||
}
|
}
|
||||||
@ -6822,7 +6822,7 @@ zfs_do_diff(int argc, char **argv)
|
|||||||
static int
|
static int
|
||||||
zfs_do_bookmark(int argc, char **argv)
|
zfs_do_bookmark(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char snapname[ZFS_MAXNAMELEN];
|
char snapname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
zfs_handle_t *zhp;
|
zfs_handle_t *zhp;
|
||||||
nvlist_t *nvl;
|
nvlist_t *nvl;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -48,7 +48,6 @@
|
|||||||
#include <sys/zio_compress.h>
|
#include <sys/zio_compress.h>
|
||||||
#include <sys/zfeature.h>
|
#include <sys/zfeature.h>
|
||||||
#include <sys/dmu_tx.h>
|
#include <sys/dmu_tx.h>
|
||||||
#undef ZFS_MAXNAMELEN
|
|
||||||
#undef verify
|
#undef verify
|
||||||
#include <libzfs.h>
|
#include <libzfs.h>
|
||||||
|
|
||||||
|
@ -139,8 +139,8 @@ typedef struct ztest_shared_hdr {
|
|||||||
static ztest_shared_hdr_t *ztest_shared_hdr;
|
static ztest_shared_hdr_t *ztest_shared_hdr;
|
||||||
|
|
||||||
typedef struct ztest_shared_opts {
|
typedef struct ztest_shared_opts {
|
||||||
char zo_pool[MAXNAMELEN];
|
char zo_pool[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char zo_dir[MAXNAMELEN];
|
char zo_dir[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char zo_alt_ztest[MAXNAMELEN];
|
char zo_alt_ztest[MAXNAMELEN];
|
||||||
char zo_alt_libpath[MAXNAMELEN];
|
char zo_alt_libpath[MAXNAMELEN];
|
||||||
uint64_t zo_vdevs;
|
uint64_t zo_vdevs;
|
||||||
@ -266,7 +266,7 @@ typedef struct ztest_od {
|
|||||||
uint64_t od_crblocksize;
|
uint64_t od_crblocksize;
|
||||||
uint64_t od_gen;
|
uint64_t od_gen;
|
||||||
uint64_t od_crgen;
|
uint64_t od_crgen;
|
||||||
char od_name[MAXNAMELEN];
|
char od_name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
} ztest_od_t;
|
} ztest_od_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -278,7 +278,7 @@ typedef struct ztest_ds {
|
|||||||
rwlock_t zd_zilog_lock;
|
rwlock_t zd_zilog_lock;
|
||||||
zilog_t *zd_zilog;
|
zilog_t *zd_zilog;
|
||||||
ztest_od_t *zd_od; /* debugging aid */
|
ztest_od_t *zd_od; /* debugging aid */
|
||||||
char zd_name[MAXNAMELEN];
|
char zd_name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
mutex_t zd_dirobj_lock;
|
mutex_t zd_dirobj_lock;
|
||||||
rll_t zd_object_lock[ZTEST_OBJECT_LOCKS];
|
rll_t zd_object_lock[ZTEST_OBJECT_LOCKS];
|
||||||
rll_t zd_range_lock[ZTEST_RANGE_LOCKS];
|
rll_t zd_range_lock[ZTEST_RANGE_LOCKS];
|
||||||
@ -3225,7 +3225,7 @@ ztest_objset_destroy_cb(const char *name, void *arg)
|
|||||||
static boolean_t
|
static boolean_t
|
||||||
ztest_snapshot_create(char *osname, uint64_t id)
|
ztest_snapshot_create(char *osname, uint64_t id)
|
||||||
{
|
{
|
||||||
char snapname[MAXNAMELEN];
|
char snapname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
(void) snprintf(snapname, sizeof (snapname), "%llu", (u_longlong_t)id);
|
(void) snprintf(snapname, sizeof (snapname), "%llu", (u_longlong_t)id);
|
||||||
@ -3245,10 +3245,10 @@ ztest_snapshot_create(char *osname, uint64_t id)
|
|||||||
static boolean_t
|
static boolean_t
|
||||||
ztest_snapshot_destroy(char *osname, uint64_t id)
|
ztest_snapshot_destroy(char *osname, uint64_t id)
|
||||||
{
|
{
|
||||||
char snapname[MAXNAMELEN];
|
char snapname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
(void) snprintf(snapname, MAXNAMELEN, "%s@%llu", osname,
|
(void) snprintf(snapname, sizeof (snapname), "%s@%llu", osname,
|
||||||
(u_longlong_t)id);
|
(u_longlong_t)id);
|
||||||
|
|
||||||
error = dsl_destroy_snapshot(snapname, B_FALSE);
|
error = dsl_destroy_snapshot(snapname, B_FALSE);
|
||||||
@ -3265,12 +3265,12 @@ ztest_dmu_objset_create_destroy(ztest_ds_t *zd, uint64_t id)
|
|||||||
int iters;
|
int iters;
|
||||||
int error;
|
int error;
|
||||||
objset_t *os, *os2;
|
objset_t *os, *os2;
|
||||||
char name[MAXNAMELEN];
|
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
zilog_t *zilog;
|
zilog_t *zilog;
|
||||||
|
|
||||||
(void) rw_rdlock(&ztest_name_lock);
|
(void) rw_rdlock(&ztest_name_lock);
|
||||||
|
|
||||||
(void) snprintf(name, MAXNAMELEN, "%s/temp_%llu",
|
(void) snprintf(name, sizeof (name), "%s/temp_%llu",
|
||||||
ztest_opts.zo_pool, (u_longlong_t)id);
|
ztest_opts.zo_pool, (u_longlong_t)id);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3376,18 +3376,23 @@ ztest_dmu_snapshot_create_destroy(ztest_ds_t *zd, uint64_t id)
|
|||||||
void
|
void
|
||||||
ztest_dsl_dataset_cleanup(char *osname, uint64_t id)
|
ztest_dsl_dataset_cleanup(char *osname, uint64_t id)
|
||||||
{
|
{
|
||||||
char snap1name[MAXNAMELEN];
|
char snap1name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char clone1name[MAXNAMELEN];
|
char clone1name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char snap2name[MAXNAMELEN];
|
char snap2name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char clone2name[MAXNAMELEN];
|
char clone2name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char snap3name[MAXNAMELEN];
|
char snap3name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
(void) snprintf(snap1name, MAXNAMELEN, "%s@s1_%llu", osname, id);
|
(void) snprintf(snap1name, sizeof (snap1name),
|
||||||
(void) snprintf(clone1name, MAXNAMELEN, "%s/c1_%llu", osname, id);
|
"%s@s1_%llu", osname, id);
|
||||||
(void) snprintf(snap2name, MAXNAMELEN, "%s@s2_%llu", clone1name, id);
|
(void) snprintf(clone1name, sizeof (clone1name),
|
||||||
(void) snprintf(clone2name, MAXNAMELEN, "%s/c2_%llu", osname, id);
|
"%s/c1_%llu", osname, id);
|
||||||
(void) snprintf(snap3name, MAXNAMELEN, "%s@s3_%llu", clone1name, id);
|
(void) snprintf(snap2name, sizeof (snap2name),
|
||||||
|
"%s@s2_%llu", clone1name, id);
|
||||||
|
(void) snprintf(clone2name, sizeof (clone2name),
|
||||||
|
"%s/c2_%llu", osname, id);
|
||||||
|
(void) snprintf(snap3name, sizeof (snap3name),
|
||||||
|
"%s@s3_%llu", clone1name, id);
|
||||||
|
|
||||||
error = dsl_destroy_head(clone2name);
|
error = dsl_destroy_head(clone2name);
|
||||||
if (error && error != ENOENT)
|
if (error && error != ENOENT)
|
||||||
@ -3413,11 +3418,11 @@ void
|
|||||||
ztest_dsl_dataset_promote_busy(ztest_ds_t *zd, uint64_t id)
|
ztest_dsl_dataset_promote_busy(ztest_ds_t *zd, uint64_t id)
|
||||||
{
|
{
|
||||||
objset_t *os;
|
objset_t *os;
|
||||||
char snap1name[MAXNAMELEN];
|
char snap1name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char clone1name[MAXNAMELEN];
|
char clone1name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char snap2name[MAXNAMELEN];
|
char snap2name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char clone2name[MAXNAMELEN];
|
char clone2name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char snap3name[MAXNAMELEN];
|
char snap3name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char *osname = zd->zd_name;
|
char *osname = zd->zd_name;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
@ -3425,11 +3430,16 @@ ztest_dsl_dataset_promote_busy(ztest_ds_t *zd, uint64_t id)
|
|||||||
|
|
||||||
ztest_dsl_dataset_cleanup(osname, id);
|
ztest_dsl_dataset_cleanup(osname, id);
|
||||||
|
|
||||||
(void) snprintf(snap1name, MAXNAMELEN, "%s@s1_%llu", osname, id);
|
(void) snprintf(snap1name, sizeof (snap1name),
|
||||||
(void) snprintf(clone1name, MAXNAMELEN, "%s/c1_%llu", osname, id);
|
"%s@s1_%llu", osname, id);
|
||||||
(void) snprintf(snap2name, MAXNAMELEN, "%s@s2_%llu", clone1name, id);
|
(void) snprintf(clone1name, sizeof (clone1name),
|
||||||
(void) snprintf(clone2name, MAXNAMELEN, "%s/c2_%llu", osname, id);
|
"%s/c1_%llu", osname, id);
|
||||||
(void) snprintf(snap3name, MAXNAMELEN, "%s@s3_%llu", clone1name, id);
|
(void) snprintf(snap2name, sizeof (snap2name),
|
||||||
|
"%s@s2_%llu", clone1name, id);
|
||||||
|
(void) snprintf(clone2name, sizeof (clone2name),
|
||||||
|
"%s/c2_%llu", osname, id);
|
||||||
|
(void) snprintf(snap3name, sizeof (snap3name),
|
||||||
|
"%s@s3_%llu", clone1name, id);
|
||||||
|
|
||||||
error = dmu_objset_snapshot_one(osname, strchr(snap1name, '@') + 1);
|
error = dmu_objset_snapshot_one(osname, strchr(snap1name, '@') + 1);
|
||||||
if (error && error != EEXIST) {
|
if (error && error != EEXIST) {
|
||||||
@ -4248,7 +4258,7 @@ ztest_fzap(ztest_ds_t *zd, uint64_t id)
|
|||||||
* 2050 entries we should see ptrtbl growth and leaf-block split.
|
* 2050 entries we should see ptrtbl growth and leaf-block split.
|
||||||
*/
|
*/
|
||||||
for (int i = 0; i < 2050; i++) {
|
for (int i = 0; i < 2050; i++) {
|
||||||
char name[MAXNAMELEN];
|
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
uint64_t value = i;
|
uint64_t value = i;
|
||||||
dmu_tx_t *tx;
|
dmu_tx_t *tx;
|
||||||
int error;
|
int error;
|
||||||
@ -4653,7 +4663,7 @@ ztest_dmu_snapshot_hold(ztest_ds_t *zd, uint64_t id)
|
|||||||
char fullname[100];
|
char fullname[100];
|
||||||
char clonename[100];
|
char clonename[100];
|
||||||
char tag[100];
|
char tag[100];
|
||||||
char osname[MAXNAMELEN];
|
char osname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
nvlist_t *holds;
|
nvlist_t *holds;
|
||||||
|
|
||||||
(void) rw_rdlock(&ztest_name_lock);
|
(void) rw_rdlock(&ztest_name_lock);
|
||||||
@ -5448,13 +5458,13 @@ ztest_thread(void *arg)
|
|||||||
static void
|
static void
|
||||||
ztest_dataset_name(char *dsname, char *pool, int d)
|
ztest_dataset_name(char *dsname, char *pool, int d)
|
||||||
{
|
{
|
||||||
(void) snprintf(dsname, MAXNAMELEN, "%s/ds_%d", pool, d);
|
(void) snprintf(dsname, ZFS_MAX_DATASET_NAME_LEN, "%s/ds_%d", pool, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ztest_dataset_destroy(int d)
|
ztest_dataset_destroy(int d)
|
||||||
{
|
{
|
||||||
char name[MAXNAMELEN];
|
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
ztest_dataset_name(name, ztest_opts.zo_pool, d);
|
ztest_dataset_name(name, ztest_opts.zo_pool, d);
|
||||||
|
|
||||||
@ -5503,7 +5513,7 @@ ztest_dataset_open(int d)
|
|||||||
uint64_t committed_seq = ZTEST_GET_SHARED_DS(d)->zd_seq;
|
uint64_t committed_seq = ZTEST_GET_SHARED_DS(d)->zd_seq;
|
||||||
objset_t *os;
|
objset_t *os;
|
||||||
zilog_t *zilog;
|
zilog_t *zilog;
|
||||||
char name[MAXNAMELEN];
|
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
ztest_dataset_name(name, ztest_opts.zo_pool, d);
|
ztest_dataset_name(name, ztest_opts.zo_pool, d);
|
||||||
@ -5726,8 +5736,8 @@ ztest_run(ztest_shared_t *zs)
|
|||||||
* different name.
|
* different name.
|
||||||
*/
|
*/
|
||||||
if (ztest_random(2) == 0) {
|
if (ztest_random(2) == 0) {
|
||||||
char name[MAXNAMELEN];
|
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
(void) snprintf(name, MAXNAMELEN, "%s_import",
|
(void) snprintf(name, sizeof (name), "%s_import",
|
||||||
ztest_opts.zo_pool);
|
ztest_opts.zo_pool);
|
||||||
ztest_spa_import_export(ztest_opts.zo_pool, name);
|
ztest_spa_import_export(ztest_opts.zo_pool, name);
|
||||||
ztest_spa_import_export(name, ztest_opts.zo_pool);
|
ztest_spa_import_export(name, ztest_opts.zo_pool);
|
||||||
@ -6290,7 +6300,7 @@ main(int argc, char **argv)
|
|||||||
if (spa_open(ztest_opts.zo_pool, &spa, FTAG) == 0) {
|
if (spa_open(ztest_opts.zo_pool, &spa, FTAG) == 0) {
|
||||||
spa_close(spa, FTAG);
|
spa_close(spa, FTAG);
|
||||||
} else {
|
} else {
|
||||||
char tmpname[MAXNAMELEN];
|
char tmpname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
kernel_fini();
|
kernel_fini();
|
||||||
kernel_init(FREAD | FWRITE);
|
kernel_init(FREAD | FWRITE);
|
||||||
(void) snprintf(tmpname, sizeof (tmpname), "%s_tmp",
|
(void) snprintf(tmpname, sizeof (tmpname), "%s_tmp",
|
||||||
|
@ -69,7 +69,7 @@ zfs_component_namecheck(const char *path, namecheck_err_t *why, char *what)
|
|||||||
{
|
{
|
||||||
const char *loc;
|
const char *loc;
|
||||||
|
|
||||||
if (strlen(path) >= MAXNAMELEN) {
|
if (strlen(path) >= ZFS_MAX_DATASET_NAME_LEN) {
|
||||||
if (why)
|
if (why)
|
||||||
*why = NAME_ERR_TOOLONG;
|
*why = NAME_ERR_TOOLONG;
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -140,14 +140,9 @@ dataset_namecheck(const char *path, namecheck_err_t *why, char *what)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure the name is not too long.
|
* Make sure the name is not too long.
|
||||||
*
|
|
||||||
* ZFS_MAXNAMELEN is the maximum dataset length used in the userland
|
|
||||||
* which is the same as MAXNAMELEN used in the kernel.
|
|
||||||
* If ZFS_MAXNAMELEN value is changed, make sure to cleanup all
|
|
||||||
* places using MAXNAMELEN.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (strlen(path) >= MAXNAMELEN) {
|
if (strlen(path) >= ZFS_MAX_DATASET_NAME_LEN) {
|
||||||
if (why)
|
if (why)
|
||||||
*why = NAME_ERR_TOOLONG;
|
*why = NAME_ERR_TOOLONG;
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -276,7 +271,7 @@ mountpoint_namecheck(const char *path, namecheck_err_t *why)
|
|||||||
while (*end != '/' && *end != '\0')
|
while (*end != '/' && *end != '\0')
|
||||||
end++;
|
end++;
|
||||||
|
|
||||||
if (end - start >= MAXNAMELEN) {
|
if (end - start >= ZFS_MAX_DATASET_NAME_LEN) {
|
||||||
if (why)
|
if (why)
|
||||||
*why = NAME_ERR_TOOLONG;
|
*why = NAME_ERR_TOOLONG;
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -301,13 +296,8 @@ pool_namecheck(const char *pool, namecheck_err_t *why, char *what)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure the name is not too long.
|
* Make sure the name is not too long.
|
||||||
*
|
|
||||||
* ZPOOL_MAXNAMELEN is the maximum pool length used in the userland
|
|
||||||
* which is the same as MAXNAMELEN used in the kernel.
|
|
||||||
* If ZPOOL_MAXNAMELEN value is changed, make sure to cleanup all
|
|
||||||
* places using MAXNAMELEN.
|
|
||||||
*/
|
*/
|
||||||
if (strlen(pool) >= MAXNAMELEN) {
|
if (strlen(pool) >= ZFS_MAX_DATASET_NAME_LEN) {
|
||||||
if (why)
|
if (why)
|
||||||
*why = NAME_ERR_TOOLONG;
|
*why = NAME_ERR_TOOLONG;
|
||||||
return (-1);
|
return (-1);
|
||||||
|
@ -50,8 +50,6 @@ extern "C" {
|
|||||||
/*
|
/*
|
||||||
* Miscellaneous ZFS constants
|
* Miscellaneous ZFS constants
|
||||||
*/
|
*/
|
||||||
#define ZFS_MAXNAMELEN MAXNAMELEN
|
|
||||||
#define ZPOOL_MAXNAMELEN MAXNAMELEN
|
|
||||||
#define ZFS_MAXPROPLEN MAXPATHLEN
|
#define ZFS_MAXPROPLEN MAXPATHLEN
|
||||||
#define ZPOOL_MAXPROPLEN MAXPATHLEN
|
#define ZPOOL_MAXPROPLEN MAXPATHLEN
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
* Use is subject to license terms.
|
* Use is subject to license terms.
|
||||||
*
|
*
|
||||||
* Portions Copyright 2007 Ramprakash Jelari
|
* Portions Copyright 2007 Ramprakash Jelari
|
||||||
|
* Copyright (c) 2014, 2015 by Delphix. All rights reserved.
|
||||||
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>
|
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -289,7 +290,7 @@ void
|
|||||||
changelist_rename(prop_changelist_t *clp, const char *src, const char *dst)
|
changelist_rename(prop_changelist_t *clp, const char *src, const char *dst)
|
||||||
{
|
{
|
||||||
prop_changenode_t *cn;
|
prop_changenode_t *cn;
|
||||||
char newname[ZFS_MAXNAMELEN];
|
char newname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
for (cn = uu_list_first(clp->cl_list); cn != NULL;
|
for (cn = uu_list_first(clp->cl_list); cn != NULL;
|
||||||
cn = uu_list_next(clp->cl_list, cn)) {
|
cn = uu_list_next(clp->cl_list, cn)) {
|
||||||
|
@ -556,7 +556,7 @@ zfs_bookmark_exists(const char *path)
|
|||||||
{
|
{
|
||||||
nvlist_t *bmarks;
|
nvlist_t *bmarks;
|
||||||
nvlist_t *props;
|
nvlist_t *props;
|
||||||
char fsname[ZFS_MAXNAMELEN];
|
char fsname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char *bmark_name;
|
char *bmark_name;
|
||||||
char *pound;
|
char *pound;
|
||||||
int err;
|
int err;
|
||||||
@ -2139,7 +2139,7 @@ struct get_clones_arg {
|
|||||||
uint64_t numclones;
|
uint64_t numclones;
|
||||||
nvlist_t *value;
|
nvlist_t *value;
|
||||||
const char *origin;
|
const char *origin;
|
||||||
char buf[ZFS_MAXNAMELEN];
|
char buf[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -2194,7 +2194,7 @@ zfs_get_clones_nvl(zfs_handle_t *zhp)
|
|||||||
|
|
||||||
if (gca.numclones != 0) {
|
if (gca.numclones != 0) {
|
||||||
zfs_handle_t *root;
|
zfs_handle_t *root;
|
||||||
char pool[ZFS_MAXNAMELEN];
|
char pool[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char *cp = pool;
|
char *cp = pool;
|
||||||
|
|
||||||
/* get the pool name */
|
/* get the pool name */
|
||||||
@ -2966,7 +2966,7 @@ check_parents(libzfs_handle_t *hdl, const char *path, uint64_t *zoned,
|
|||||||
boolean_t accept_ancestor, int *prefixlen)
|
boolean_t accept_ancestor, int *prefixlen)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { 0 };
|
zfs_cmd_t zc = { 0 };
|
||||||
char parent[ZFS_MAXNAMELEN];
|
char parent[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char *slash;
|
char *slash;
|
||||||
zfs_handle_t *zhp;
|
zfs_handle_t *zhp;
|
||||||
char errbuf[1024];
|
char errbuf[1024];
|
||||||
@ -3205,7 +3205,7 @@ zfs_create(libzfs_handle_t *hdl, const char *path, zfs_type_t type,
|
|||||||
ost = LZC_DATSET_TYPE_ZFS;
|
ost = LZC_DATSET_TYPE_ZFS;
|
||||||
|
|
||||||
/* open zpool handle for prop validation */
|
/* open zpool handle for prop validation */
|
||||||
char pool_path[MAXNAMELEN];
|
char pool_path[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
(void) strlcpy(pool_path, path, sizeof (pool_path));
|
(void) strlcpy(pool_path, path, sizeof (pool_path));
|
||||||
|
|
||||||
/* truncate pool_path at first slash */
|
/* truncate pool_path at first slash */
|
||||||
@ -3274,7 +3274,7 @@ zfs_create(libzfs_handle_t *hdl, const char *path, zfs_type_t type,
|
|||||||
|
|
||||||
/* check for failure */
|
/* check for failure */
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
char parent[ZFS_MAXNAMELEN];
|
char parent[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
(void) parent_name(path, parent, sizeof (parent));
|
(void) parent_name(path, parent, sizeof (parent));
|
||||||
|
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
@ -3364,7 +3364,7 @@ static int
|
|||||||
zfs_check_snap_cb(zfs_handle_t *zhp, void *arg)
|
zfs_check_snap_cb(zfs_handle_t *zhp, void *arg)
|
||||||
{
|
{
|
||||||
struct destroydata *dd = arg;
|
struct destroydata *dd = arg;
|
||||||
char name[ZFS_MAXNAMELEN];
|
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
|
||||||
(void) snprintf(name, sizeof (name),
|
(void) snprintf(name, sizeof (name),
|
||||||
@ -3454,7 +3454,7 @@ zfs_destroy_snaps_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, boolean_t defer)
|
|||||||
int
|
int
|
||||||
zfs_clone(zfs_handle_t *zhp, const char *target, nvlist_t *props)
|
zfs_clone(zfs_handle_t *zhp, const char *target, nvlist_t *props)
|
||||||
{
|
{
|
||||||
char parent[ZFS_MAXNAMELEN];
|
char parent[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
int ret;
|
int ret;
|
||||||
char errbuf[1024];
|
char errbuf[1024];
|
||||||
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
||||||
@ -3584,7 +3584,7 @@ static int
|
|||||||
zfs_snapshot_cb(zfs_handle_t *zhp, void *arg)
|
zfs_snapshot_cb(zfs_handle_t *zhp, void *arg)
|
||||||
{
|
{
|
||||||
snapdata_t *sd = arg;
|
snapdata_t *sd = arg;
|
||||||
char name[ZFS_MAXNAMELEN];
|
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
|
||||||
if (zfs_prop_get_int(zhp, ZFS_PROP_INCONSISTENT) == 0) {
|
if (zfs_prop_get_int(zhp, ZFS_PROP_INCONSISTENT) == 0) {
|
||||||
@ -3633,7 +3633,7 @@ zfs_snapshot_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, nvlist_t *props)
|
|||||||
* get pool handle for prop validation. assumes all snaps are in the
|
* get pool handle for prop validation. assumes all snaps are in the
|
||||||
* same pool, as does lzc_snapshot (below).
|
* same pool, as does lzc_snapshot (below).
|
||||||
*/
|
*/
|
||||||
char pool[MAXNAMELEN];
|
char pool[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
elem = nvlist_next_nvpair(snaps, NULL);
|
elem = nvlist_next_nvpair(snaps, NULL);
|
||||||
(void) strlcpy(pool, nvpair_name(elem), sizeof (pool));
|
(void) strlcpy(pool, nvpair_name(elem), sizeof (pool));
|
||||||
pool[strcspn(pool, "/@")] = '\0';
|
pool[strcspn(pool, "/@")] = '\0';
|
||||||
@ -3687,7 +3687,7 @@ zfs_snapshot(libzfs_handle_t *hdl, const char *path, boolean_t recursive,
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
snapdata_t sd = { 0 };
|
snapdata_t sd = { 0 };
|
||||||
char fsname[ZFS_MAXNAMELEN];
|
char fsname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char *cp;
|
char *cp;
|
||||||
zfs_handle_t *zhp;
|
zfs_handle_t *zhp;
|
||||||
char errbuf[1024];
|
char errbuf[1024];
|
||||||
@ -3866,7 +3866,7 @@ zfs_rename(zfs_handle_t *zhp, const char *target, boolean_t recursive,
|
|||||||
prop_changelist_t *cl = NULL;
|
prop_changelist_t *cl = NULL;
|
||||||
zfs_handle_t *zhrp = NULL;
|
zfs_handle_t *zhrp = NULL;
|
||||||
char *parentname = NULL;
|
char *parentname = NULL;
|
||||||
char parent[ZFS_MAXNAMELEN];
|
char parent[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
||||||
char errbuf[1024];
|
char errbuf[1024];
|
||||||
|
|
||||||
@ -4348,7 +4348,7 @@ static int
|
|||||||
zfs_hold_one(zfs_handle_t *zhp, void *arg)
|
zfs_hold_one(zfs_handle_t *zhp, void *arg)
|
||||||
{
|
{
|
||||||
struct holdarg *ha = arg;
|
struct holdarg *ha = arg;
|
||||||
char name[ZFS_MAXNAMELEN];
|
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
|
||||||
(void) snprintf(name, sizeof (name),
|
(void) snprintf(name, sizeof (name),
|
||||||
@ -4467,7 +4467,7 @@ static int
|
|||||||
zfs_release_one(zfs_handle_t *zhp, void *arg)
|
zfs_release_one(zfs_handle_t *zhp, void *arg)
|
||||||
{
|
{
|
||||||
struct holdarg *ha = arg;
|
struct holdarg *ha = arg;
|
||||||
char name[ZFS_MAXNAMELEN];
|
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
nvlist_t *existing_holds;
|
nvlist_t *existing_holds;
|
||||||
|
|
||||||
@ -4596,7 +4596,7 @@ zfs_get_fsacl(zfs_handle_t *zhp, nvlist_t **nvl)
|
|||||||
zc.zc_nvlist_dst_size = nvsz;
|
zc.zc_nvlist_dst_size = nvsz;
|
||||||
zc.zc_nvlist_dst = (uintptr_t)nvbuf;
|
zc.zc_nvlist_dst = (uintptr_t)nvbuf;
|
||||||
|
|
||||||
(void) strlcpy(zc.zc_name, zhp->zfs_name, ZFS_MAXNAMELEN);
|
(void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
|
||||||
|
|
||||||
if (ioctl(hdl->libzfs_fd, ZFS_IOC_GET_FSACL, &zc) != 0) {
|
if (ioctl(hdl->libzfs_fd, ZFS_IOC_GET_FSACL, &zc) != 0) {
|
||||||
(void) snprintf(errbuf, sizeof (errbuf),
|
(void) snprintf(errbuf, sizeof (errbuf),
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
|
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
|
||||||
|
* Copyright (c) 2015 by Delphix. All rights reserved.
|
||||||
* Copyright 2016 Joyent, Inc.
|
* Copyright 2016 Joyent, Inc.
|
||||||
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>
|
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>
|
||||||
*/
|
*/
|
||||||
@ -612,7 +613,7 @@ get_snapshot_names(differ_info_t *di, const char *fromsnap,
|
|||||||
* not the same dataset name, might be okay if
|
* not the same dataset name, might be okay if
|
||||||
* tosnap is a clone of a fromsnap descendant.
|
* tosnap is a clone of a fromsnap descendant.
|
||||||
*/
|
*/
|
||||||
char origin[ZFS_MAXNAMELEN];
|
char origin[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
zprop_source_t src;
|
zprop_source_t src;
|
||||||
zfs_handle_t *zhp;
|
zfs_handle_t *zhp;
|
||||||
|
|
||||||
|
@ -22,17 +22,17 @@
|
|||||||
/*
|
/*
|
||||||
* 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) 2011 Pawel Jakub Dawidek. All rights reserved.
|
* Copyright (c) 2011 Pawel Jakub Dawidek. All rights reserved.
|
||||||
* Copyright (c) 2013 by Delphix. All rights reserved.
|
* Copyright (c) 2011, 2015 by Delphix. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _LIBZFS_IMPL_H
|
#ifndef _LIBZFS_IMPL_H
|
||||||
#define _LIBZFS_IMPL_H
|
#define _LIBZFS_IMPL_H
|
||||||
|
|
||||||
#include <sys/dmu.h>
|
|
||||||
#include <sys/fs/zfs.h>
|
#include <sys/fs/zfs.h>
|
||||||
#include <sys/zfs_ioctl.h>
|
|
||||||
#include <sys/spa.h>
|
#include <sys/spa.h>
|
||||||
#include <sys/nvpair.h>
|
#include <sys/nvpair.h>
|
||||||
|
#include <sys/dmu.h>
|
||||||
|
#include <sys/zfs_ioctl.h>
|
||||||
|
|
||||||
#include <libuutil.h>
|
#include <libuutil.h>
|
||||||
#include <libzfs.h>
|
#include <libzfs.h>
|
||||||
@ -87,7 +87,7 @@ struct libzfs_handle {
|
|||||||
struct zfs_handle {
|
struct zfs_handle {
|
||||||
libzfs_handle_t *zfs_hdl;
|
libzfs_handle_t *zfs_hdl;
|
||||||
zpool_handle_t *zpool_hdl;
|
zpool_handle_t *zpool_hdl;
|
||||||
char zfs_name[ZFS_MAXNAMELEN];
|
char zfs_name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
zfs_type_t zfs_type; /* type including snapshot */
|
zfs_type_t zfs_type; /* type including snapshot */
|
||||||
zfs_type_t zfs_head_type; /* type excluding snapshot */
|
zfs_type_t zfs_head_type; /* type excluding snapshot */
|
||||||
dmu_objset_stats_t zfs_dmustats;
|
dmu_objset_stats_t zfs_dmustats;
|
||||||
@ -108,7 +108,7 @@ struct zfs_handle {
|
|||||||
struct zpool_handle {
|
struct zpool_handle {
|
||||||
libzfs_handle_t *zpool_hdl;
|
libzfs_handle_t *zpool_hdl;
|
||||||
zpool_handle_t *zpool_next;
|
zpool_handle_t *zpool_next;
|
||||||
char zpool_name[ZPOOL_MAXNAMELEN];
|
char zpool_name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
int zpool_state;
|
int zpool_state;
|
||||||
size_t zpool_config_size;
|
size_t zpool_config_size;
|
||||||
nvlist_t *zpool_config;
|
nvlist_t *zpool_config;
|
||||||
|
@ -197,7 +197,7 @@ zfs_iter_bookmarks(zfs_handle_t *zhp, zfs_iter_f func, void *data)
|
|||||||
|
|
||||||
for (nvpair_t *pair = nvlist_next_nvpair(bmarks, NULL);
|
for (nvpair_t *pair = nvlist_next_nvpair(bmarks, NULL);
|
||||||
pair != NULL; pair = nvlist_next_nvpair(bmarks, pair)) {
|
pair != NULL; pair = nvlist_next_nvpair(bmarks, pair)) {
|
||||||
char name[ZFS_MAXNAMELEN];
|
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char *bmark_name;
|
char *bmark_name;
|
||||||
nvlist_t *bmark_props;
|
nvlist_t *bmark_props;
|
||||||
|
|
||||||
@ -385,7 +385,7 @@ zfs_iter_snapspec(zfs_handle_t *fs_zhp, const char *spec_orig,
|
|||||||
* exists.
|
* exists.
|
||||||
*/
|
*/
|
||||||
if (ssa.ssa_last[0] != '\0') {
|
if (ssa.ssa_last[0] != '\0') {
|
||||||
char snapname[ZFS_MAXNAMELEN];
|
char snapname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
(void) snprintf(snapname, sizeof (snapname),
|
(void) snprintf(snapname, sizeof (snapname),
|
||||||
"%s@%s", zfs_get_name(fs_zhp),
|
"%s@%s", zfs_get_name(fs_zhp),
|
||||||
ssa.ssa_last);
|
ssa.ssa_last);
|
||||||
@ -405,7 +405,7 @@ zfs_iter_snapspec(zfs_handle_t *fs_zhp, const char *spec_orig,
|
|||||||
ret = ENOENT;
|
ret = ENOENT;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
char snapname[ZFS_MAXNAMELEN];
|
char snapname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
zfs_handle_t *snap_zhp;
|
zfs_handle_t *snap_zhp;
|
||||||
(void) snprintf(snapname, sizeof (snapname), "%s@%s",
|
(void) snprintf(snapname, sizeof (snapname), "%s@%s",
|
||||||
zfs_get_name(fs_zhp), comma_separated);
|
zfs_get_name(fs_zhp), comma_separated);
|
||||||
|
@ -230,7 +230,7 @@ static boolean_t
|
|||||||
zfs_is_mountable(zfs_handle_t *zhp, char *buf, size_t buflen,
|
zfs_is_mountable(zfs_handle_t *zhp, char *buf, size_t buflen,
|
||||||
zprop_source_t *source)
|
zprop_source_t *source)
|
||||||
{
|
{
|
||||||
char sourceloc[ZFS_MAXNAMELEN];
|
char sourceloc[MAXNAMELEN];
|
||||||
zprop_source_t sourcetype;
|
zprop_source_t sourcetype;
|
||||||
|
|
||||||
if (!zfs_prop_valid_for_type(ZFS_PROP_MOUNTPOINT, zhp->zfs_type))
|
if (!zfs_prop_valid_for_type(ZFS_PROP_MOUNTPOINT, zhp->zfs_type))
|
||||||
|
@ -406,7 +406,7 @@ bootfs_name_valid(const char *pool, char *bootfs)
|
|||||||
boolean_t
|
boolean_t
|
||||||
zpool_is_bootable(zpool_handle_t *zhp)
|
zpool_is_bootable(zpool_handle_t *zhp)
|
||||||
{
|
{
|
||||||
char bootfs[ZPOOL_MAXNAMELEN];
|
char bootfs[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
return (zpool_get_prop(zhp, ZPOOL_PROP_BOOTFS, bootfs,
|
return (zpool_get_prop(zhp, ZPOOL_PROP_BOOTFS, bootfs,
|
||||||
sizeof (bootfs), NULL, B_FALSE) == 0 && strncmp(bootfs, "-",
|
sizeof (bootfs), NULL, B_FALSE) == 0 && strncmp(bootfs, "-",
|
||||||
@ -3760,7 +3760,7 @@ zpool_obj_to_path(zpool_handle_t *zhp, uint64_t dsobj, uint64_t obj,
|
|||||||
zfs_cmd_t zc = { 0 };
|
zfs_cmd_t zc = { 0 };
|
||||||
boolean_t mounted = B_FALSE;
|
boolean_t mounted = B_FALSE;
|
||||||
char *mntpnt = NULL;
|
char *mntpnt = NULL;
|
||||||
char dsname[MAXNAMELEN];
|
char dsname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
if (dsobj == 0) {
|
if (dsobj == 0) {
|
||||||
/* special case for the MOS */
|
/* special case for the MOS */
|
||||||
@ -4017,7 +4017,7 @@ zvol_check_dump_config(char *arg)
|
|||||||
uint_t toplevels;
|
uint_t toplevels;
|
||||||
libzfs_handle_t *hdl;
|
libzfs_handle_t *hdl;
|
||||||
char errbuf[1024];
|
char errbuf[1024];
|
||||||
char poolname[ZPOOL_MAXNAMELEN];
|
char poolname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
int pathlen = strlen(ZVOL_FULL_DEV_DIR);
|
int pathlen = strlen(ZVOL_FULL_DEV_DIR);
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
|
||||||
@ -4040,7 +4040,7 @@ zvol_check_dump_config(char *arg)
|
|||||||
"malformed dataset name"));
|
"malformed dataset name"));
|
||||||
(void) zfs_error(hdl, EZFS_INVALIDNAME, errbuf);
|
(void) zfs_error(hdl, EZFS_INVALIDNAME, errbuf);
|
||||||
return (1);
|
return (1);
|
||||||
} else if (p - volname >= ZFS_MAXNAMELEN) {
|
} else if (p - volname >= ZFS_MAX_DATASET_NAME_LEN) {
|
||||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||||
"dataset name is too long"));
|
"dataset name is too long"));
|
||||||
(void) zfs_error(hdl, EZFS_NAMETOOLONG, errbuf);
|
(void) zfs_error(hdl, EZFS_NAMETOOLONG, errbuf);
|
||||||
|
@ -745,7 +745,7 @@ send_iterate_prop(zfs_handle_t *zhp, nvlist_t *nv)
|
|||||||
static uint64_t
|
static uint64_t
|
||||||
get_snap_txg(libzfs_handle_t *hdl, const char *fs, const char *snap)
|
get_snap_txg(libzfs_handle_t *hdl, const char *fs, const char *snap)
|
||||||
{
|
{
|
||||||
char name[ZFS_MAXNAMELEN];
|
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
uint64_t txg = 0;
|
uint64_t txg = 0;
|
||||||
|
|
||||||
if (fs == NULL || fs[0] == '\0' || snap == NULL || snap[0] == '\0')
|
if (fs == NULL || fs[0] == '\0' || snap == NULL || snap[0] == '\0')
|
||||||
@ -913,7 +913,7 @@ typedef struct send_dump_data {
|
|||||||
/* these are all just the short snapname (the part after the @) */
|
/* these are all just the short snapname (the part after the @) */
|
||||||
const char *fromsnap;
|
const char *fromsnap;
|
||||||
const char *tosnap;
|
const char *tosnap;
|
||||||
char prevsnap[ZFS_MAXNAMELEN];
|
char prevsnap[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
uint64_t prevsnap_obj;
|
uint64_t prevsnap_obj;
|
||||||
boolean_t seenfrom, seento, replicate, doall, fromorigin;
|
boolean_t seenfrom, seento, replicate, doall, fromorigin;
|
||||||
boolean_t verbose, dryrun, parsable, progress, embed_data, std_out;
|
boolean_t verbose, dryrun, parsable, progress, embed_data, std_out;
|
||||||
@ -926,7 +926,7 @@ typedef struct send_dump_data {
|
|||||||
snapfilter_cb_t *filter_cb;
|
snapfilter_cb_t *filter_cb;
|
||||||
void *filter_cb_arg;
|
void *filter_cb_arg;
|
||||||
nvlist_t *debugnv;
|
nvlist_t *debugnv;
|
||||||
char holdtag[ZFS_MAXNAMELEN];
|
char holdtag[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
int cleanup_fd;
|
int cleanup_fd;
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
} send_dump_data_t;
|
} send_dump_data_t;
|
||||||
@ -1561,7 +1561,7 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *flags, int outfd,
|
|||||||
uint64_t resumeobj, resumeoff, toguid, fromguid, bytes;
|
uint64_t resumeobj, resumeoff, toguid, fromguid, bytes;
|
||||||
zfs_handle_t *zhp;
|
zfs_handle_t *zhp;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
char name[ZFS_MAXNAMELEN];
|
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
enum lzc_send_flags lzc_flags = 0;
|
enum lzc_send_flags lzc_flags = 0;
|
||||||
|
|
||||||
(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
|
(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
|
||||||
@ -2151,8 +2151,8 @@ recv_rename(libzfs_handle_t *hdl, const char *name, const char *tryname,
|
|||||||
if (err != 0 && strncmp(name + baselen, "recv-", 5) != 0) {
|
if (err != 0 && strncmp(name + baselen, "recv-", 5) != 0) {
|
||||||
seq++;
|
seq++;
|
||||||
|
|
||||||
(void) snprintf(newname, ZFS_MAXNAMELEN, "%.*srecv-%u-%u",
|
(void) snprintf(newname, ZFS_MAX_DATASET_NAME_LEN,
|
||||||
baselen, name, getpid(), seq);
|
"%.*srecv-%u-%u", baselen, name, getpid(), seq);
|
||||||
(void) strlcpy(zc.zc_value, newname, sizeof (zc.zc_value));
|
(void) strlcpy(zc.zc_value, newname, sizeof (zc.zc_value));
|
||||||
|
|
||||||
if (flags->verbose) {
|
if (flags->verbose) {
|
||||||
@ -2280,7 +2280,7 @@ static int
|
|||||||
guid_to_name(libzfs_handle_t *hdl, const char *parent, uint64_t guid,
|
guid_to_name(libzfs_handle_t *hdl, const char *parent, uint64_t guid,
|
||||||
boolean_t bookmark_ok, char *name)
|
boolean_t bookmark_ok, char *name)
|
||||||
{
|
{
|
||||||
char pname[ZFS_MAXNAMELEN];
|
char pname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
guid_to_name_data_t gtnd;
|
guid_to_name_data_t gtnd;
|
||||||
|
|
||||||
gtnd.guid = guid;
|
gtnd.guid = guid;
|
||||||
@ -2335,7 +2335,7 @@ created_before(libzfs_handle_t *hdl, avl_tree_t *avl,
|
|||||||
{
|
{
|
||||||
nvlist_t *nvfs;
|
nvlist_t *nvfs;
|
||||||
char *fsname, *snapname;
|
char *fsname, *snapname;
|
||||||
char buf[ZFS_MAXNAMELEN];
|
char buf[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
int rv;
|
int rv;
|
||||||
zfs_handle_t *guid1hdl, *guid2hdl;
|
zfs_handle_t *guid1hdl, *guid2hdl;
|
||||||
uint64_t create1, create2;
|
uint64_t create1, create2;
|
||||||
@ -2386,7 +2386,7 @@ recv_incremental_replication(libzfs_handle_t *hdl, const char *tofs,
|
|||||||
avl_tree_t *local_avl;
|
avl_tree_t *local_avl;
|
||||||
nvpair_t *fselem, *nextfselem;
|
nvpair_t *fselem, *nextfselem;
|
||||||
char *fromsnap;
|
char *fromsnap;
|
||||||
char newname[ZFS_MAXNAMELEN];
|
char newname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
int error;
|
int error;
|
||||||
boolean_t needagain, progress, recursive;
|
boolean_t needagain, progress, recursive;
|
||||||
char *s1, *s2;
|
char *s1, *s2;
|
||||||
@ -2502,7 +2502,7 @@ recv_incremental_replication(libzfs_handle_t *hdl, const char *tofs,
|
|||||||
|
|
||||||
/* check for delete */
|
/* check for delete */
|
||||||
if (found == NULL) {
|
if (found == NULL) {
|
||||||
char name[ZFS_MAXNAMELEN];
|
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
if (!flags->force)
|
if (!flags->force)
|
||||||
continue;
|
continue;
|
||||||
@ -2540,8 +2540,8 @@ recv_incremental_replication(libzfs_handle_t *hdl, const char *tofs,
|
|||||||
/* check for different snapname */
|
/* check for different snapname */
|
||||||
if (strcmp(nvpair_name(snapelem),
|
if (strcmp(nvpair_name(snapelem),
|
||||||
stream_snapname) != 0) {
|
stream_snapname) != 0) {
|
||||||
char name[ZFS_MAXNAMELEN];
|
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char tryname[ZFS_MAXNAMELEN];
|
char tryname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
(void) snprintf(name, sizeof (name), "%s@%s",
|
(void) snprintf(name, sizeof (name), "%s@%s",
|
||||||
fsname, nvpair_name(snapelem));
|
fsname, nvpair_name(snapelem));
|
||||||
@ -2603,7 +2603,7 @@ recv_incremental_replication(libzfs_handle_t *hdl, const char *tofs,
|
|||||||
((flags->isprefix || strcmp(tofs, fsname) != 0) &&
|
((flags->isprefix || strcmp(tofs, fsname) != 0) &&
|
||||||
(s1 != NULL) && (s2 != NULL) && strcmp(s1, s2) != 0)) {
|
(s1 != NULL) && (s2 != NULL) && strcmp(s1, s2) != 0)) {
|
||||||
nvlist_t *parent;
|
nvlist_t *parent;
|
||||||
char tryname[ZFS_MAXNAMELEN];
|
char tryname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
parent = fsavl_find(local_avl,
|
parent = fsavl_find(local_avl,
|
||||||
stream_parent_fromsnap_guid, NULL);
|
stream_parent_fromsnap_guid, NULL);
|
||||||
@ -2669,8 +2669,8 @@ zfs_receive_package(libzfs_handle_t *hdl, int fd, const char *destname,
|
|||||||
char *fromsnap = NULL;
|
char *fromsnap = NULL;
|
||||||
char *sendsnap = NULL;
|
char *sendsnap = NULL;
|
||||||
char *cp;
|
char *cp;
|
||||||
char tofs[ZFS_MAXNAMELEN];
|
char tofs[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char sendfs[ZFS_MAXNAMELEN];
|
char sendfs[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char errbuf[1024];
|
char errbuf[1024];
|
||||||
dmu_replay_record_t drre;
|
dmu_replay_record_t drre;
|
||||||
int error;
|
int error;
|
||||||
@ -2754,7 +2754,7 @@ zfs_receive_package(libzfs_handle_t *hdl, int fd, const char *destname,
|
|||||||
nvlist_t *renamed = NULL;
|
nvlist_t *renamed = NULL;
|
||||||
nvpair_t *pair = NULL;
|
nvpair_t *pair = NULL;
|
||||||
|
|
||||||
(void) strlcpy(tofs, destname, ZFS_MAXNAMELEN);
|
(void) strlcpy(tofs, destname, sizeof (tofs));
|
||||||
if (flags->isprefix) {
|
if (flags->isprefix) {
|
||||||
struct drr_begin *drrb = &drr->drr_u.drr_begin;
|
struct drr_begin *drrb = &drr->drr_u.drr_begin;
|
||||||
int i;
|
int i;
|
||||||
@ -2763,7 +2763,7 @@ zfs_receive_package(libzfs_handle_t *hdl, int fd, const char *destname,
|
|||||||
cp = strrchr(drrb->drr_toname, '/');
|
cp = strrchr(drrb->drr_toname, '/');
|
||||||
if (cp == NULL) {
|
if (cp == NULL) {
|
||||||
(void) strlcat(tofs, "/",
|
(void) strlcat(tofs, "/",
|
||||||
ZFS_MAXNAMELEN);
|
sizeof (tofs));
|
||||||
i = 0;
|
i = 0;
|
||||||
} else {
|
} else {
|
||||||
i = (cp - drrb->drr_toname);
|
i = (cp - drrb->drr_toname);
|
||||||
@ -2773,7 +2773,7 @@ zfs_receive_package(libzfs_handle_t *hdl, int fd, const char *destname,
|
|||||||
}
|
}
|
||||||
/* zfs_receive_one() will create_parents() */
|
/* zfs_receive_one() will create_parents() */
|
||||||
(void) strlcat(tofs, &drrb->drr_toname[i],
|
(void) strlcat(tofs, &drrb->drr_toname[i],
|
||||||
ZFS_MAXNAMELEN);
|
sizeof (tofs));
|
||||||
*strchr(tofs, '@') = '\0';
|
*strchr(tofs, '@') = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2815,7 +2815,7 @@ zfs_receive_package(libzfs_handle_t *hdl, int fd, const char *destname,
|
|||||||
* zfs_receive_one().
|
* zfs_receive_one().
|
||||||
*/
|
*/
|
||||||
(void) strlcpy(sendfs, drr->drr_u.drr_begin.drr_toname,
|
(void) strlcpy(sendfs, drr->drr_u.drr_begin.drr_toname,
|
||||||
ZFS_MAXNAMELEN);
|
sizeof (sendfs));
|
||||||
if ((cp = strchr(sendfs, '@')) != NULL) {
|
if ((cp = strchr(sendfs, '@')) != NULL) {
|
||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
/*
|
/*
|
||||||
@ -2965,7 +2965,7 @@ static void
|
|||||||
recv_ecksum_set_aux(libzfs_handle_t *hdl, const char *target_snap,
|
recv_ecksum_set_aux(libzfs_handle_t *hdl, const char *target_snap,
|
||||||
boolean_t resumable)
|
boolean_t resumable)
|
||||||
{
|
{
|
||||||
char target_fs[ZFS_MAXNAMELEN];
|
char target_fs[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||||
"checksum mismatch or incomplete stream"));
|
"checksum mismatch or incomplete stream"));
|
||||||
@ -3159,7 +3159,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
|
|||||||
if (flags->verbose)
|
if (flags->verbose)
|
||||||
(void) printf("found clone origin %s\n", zc.zc_string);
|
(void) printf("found clone origin %s\n", zc.zc_string);
|
||||||
} else if (originsnap) {
|
} else if (originsnap) {
|
||||||
(void) strncpy(zc.zc_string, originsnap, ZFS_MAXNAMELEN);
|
(void) strncpy(zc.zc_string, originsnap, sizeof (zc.zc_string));
|
||||||
if (flags->verbose)
|
if (flags->verbose)
|
||||||
(void) printf("using provided clone origin %s\n",
|
(void) printf("using provided clone origin %s\n",
|
||||||
zc.zc_string);
|
zc.zc_string);
|
||||||
@ -3184,7 +3184,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
|
|||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
if (cp &&
|
if (cp &&
|
||||||
!zfs_dataset_exists(hdl, zc.zc_name, ZFS_TYPE_DATASET)) {
|
!zfs_dataset_exists(hdl, zc.zc_name, ZFS_TYPE_DATASET)) {
|
||||||
char suffix[ZFS_MAXNAMELEN];
|
char suffix[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
(void) strcpy(suffix, strrchr(zc.zc_value, '/'));
|
(void) strcpy(suffix, strrchr(zc.zc_value, '/'));
|
||||||
if (guid_to_name(hdl, zc.zc_name, parent_snapguid,
|
if (guid_to_name(hdl, zc.zc_name, parent_snapguid,
|
||||||
B_FALSE, zc.zc_value) == 0) {
|
B_FALSE, zc.zc_value) == 0) {
|
||||||
@ -3211,7 +3211,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
|
|||||||
if ((flags->isprefix || (*(chopprefix = drrb->drr_toname +
|
if ((flags->isprefix || (*(chopprefix = drrb->drr_toname +
|
||||||
strlen(sendfs)) != '\0' && *chopprefix != '@')) &&
|
strlen(sendfs)) != '\0' && *chopprefix != '@')) &&
|
||||||
!zfs_dataset_exists(hdl, zc.zc_name, ZFS_TYPE_DATASET)) {
|
!zfs_dataset_exists(hdl, zc.zc_name, ZFS_TYPE_DATASET)) {
|
||||||
char snap[ZFS_MAXNAMELEN];
|
char snap[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
(void) strcpy(snap, strchr(zc.zc_value, '@'));
|
(void) strcpy(snap, strchr(zc.zc_value, '@'));
|
||||||
if (guid_to_name(hdl, zc.zc_name, drrb->drr_fromguid,
|
if (guid_to_name(hdl, zc.zc_name, drrb->drr_fromguid,
|
||||||
B_FALSE, zc.zc_value) == 0) {
|
B_FALSE, zc.zc_value) == 0) {
|
||||||
@ -3660,7 +3660,7 @@ zfs_receive_impl(libzfs_handle_t *hdl, const char *tosnap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (DMU_GET_STREAM_HDRTYPE(drrb->drr_versioninfo) == DMU_SUBSTREAM) {
|
if (DMU_GET_STREAM_HDRTYPE(drrb->drr_versioninfo) == DMU_SUBSTREAM) {
|
||||||
char nonpackage_sendfs[ZFS_MAXNAMELEN];
|
char nonpackage_sendfs[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
if (sendfs == NULL) {
|
if (sendfs == NULL) {
|
||||||
/*
|
/*
|
||||||
* We were not called from zfs_receive_package(). Get
|
* We were not called from zfs_receive_package(). Get
|
||||||
@ -3668,7 +3668,8 @@ zfs_receive_impl(libzfs_handle_t *hdl, const char *tosnap,
|
|||||||
*/
|
*/
|
||||||
char *cp;
|
char *cp;
|
||||||
(void) strlcpy(nonpackage_sendfs,
|
(void) strlcpy(nonpackage_sendfs,
|
||||||
drr.drr_u.drr_begin.drr_toname, ZFS_MAXNAMELEN);
|
drr.drr_u.drr_begin.drr_toname,
|
||||||
|
sizeof (nonpackage_sendfs));
|
||||||
if ((cp = strchr(nonpackage_sendfs, '@')) != NULL)
|
if ((cp = strchr(nonpackage_sendfs, '@')) != NULL)
|
||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
sendfs = nonpackage_sendfs;
|
sendfs = nonpackage_sendfs;
|
||||||
|
@ -218,7 +218,7 @@ lzc_snapshot(nvlist_t *snaps, nvlist_t *props, nvlist_t **errlist)
|
|||||||
nvpair_t *elem;
|
nvpair_t *elem;
|
||||||
nvlist_t *args;
|
nvlist_t *args;
|
||||||
int error;
|
int error;
|
||||||
char pool[MAXNAMELEN];
|
char pool[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
*errlist = NULL;
|
*errlist = NULL;
|
||||||
|
|
||||||
@ -270,7 +270,7 @@ lzc_destroy_snaps(nvlist_t *snaps, boolean_t defer, nvlist_t **errlist)
|
|||||||
nvpair_t *elem;
|
nvpair_t *elem;
|
||||||
nvlist_t *args;
|
nvlist_t *args;
|
||||||
int error;
|
int error;
|
||||||
char pool[MAXNAMELEN];
|
char pool[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
/* determine the pool name */
|
/* determine the pool name */
|
||||||
elem = nvlist_next_nvpair(snaps, NULL);
|
elem = nvlist_next_nvpair(snaps, NULL);
|
||||||
@ -297,7 +297,7 @@ lzc_snaprange_space(const char *firstsnap, const char *lastsnap,
|
|||||||
nvlist_t *args;
|
nvlist_t *args;
|
||||||
nvlist_t *result;
|
nvlist_t *result;
|
||||||
int err;
|
int err;
|
||||||
char fs[MAXNAMELEN];
|
char fs[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char *atp;
|
char *atp;
|
||||||
|
|
||||||
/* determine the fs name */
|
/* determine the fs name */
|
||||||
@ -362,7 +362,7 @@ lzc_exists(const char *dataset)
|
|||||||
int
|
int
|
||||||
lzc_hold(nvlist_t *holds, int cleanup_fd, nvlist_t **errlist)
|
lzc_hold(nvlist_t *holds, int cleanup_fd, nvlist_t **errlist)
|
||||||
{
|
{
|
||||||
char pool[MAXNAMELEN];
|
char pool[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
nvlist_t *args;
|
nvlist_t *args;
|
||||||
nvpair_t *elem;
|
nvpair_t *elem;
|
||||||
int error;
|
int error;
|
||||||
@ -409,7 +409,7 @@ lzc_hold(nvlist_t *holds, int cleanup_fd, nvlist_t **errlist)
|
|||||||
int
|
int
|
||||||
lzc_release(nvlist_t *holds, nvlist_t **errlist)
|
lzc_release(nvlist_t *holds, nvlist_t **errlist)
|
||||||
{
|
{
|
||||||
char pool[MAXNAMELEN];
|
char pool[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
nvpair_t *elem;
|
nvpair_t *elem;
|
||||||
|
|
||||||
/* determine the pool name */
|
/* determine the pool name */
|
||||||
@ -696,7 +696,7 @@ lzc_bookmark(nvlist_t *bookmarks, nvlist_t **errlist)
|
|||||||
{
|
{
|
||||||
nvpair_t *elem;
|
nvpair_t *elem;
|
||||||
int error;
|
int error;
|
||||||
char pool[MAXNAMELEN];
|
char pool[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
/* determine the pool name */
|
/* determine the pool name */
|
||||||
elem = nvlist_next_nvpair(bookmarks, NULL);
|
elem = nvlist_next_nvpair(bookmarks, NULL);
|
||||||
@ -758,7 +758,7 @@ lzc_destroy_bookmarks(nvlist_t *bmarks, nvlist_t **errlist)
|
|||||||
{
|
{
|
||||||
nvpair_t *elem;
|
nvpair_t *elem;
|
||||||
int error;
|
int error;
|
||||||
char pool[MAXNAMELEN];
|
char pool[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
/* determine the pool name */
|
/* determine the pool name */
|
||||||
elem = nvlist_next_nvpair(bmarks, NULL);
|
elem = nvlist_next_nvpair(bmarks, NULL);
|
||||||
|
@ -621,7 +621,7 @@ dmu_objset_refresh_ownership(objset_t *os, void *tag)
|
|||||||
{
|
{
|
||||||
dsl_pool_t *dp;
|
dsl_pool_t *dp;
|
||||||
dsl_dataset_t *ds, *newds;
|
dsl_dataset_t *ds, *newds;
|
||||||
char name[MAXNAMELEN];
|
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
ds = os->os_dsl_dataset;
|
ds = os->os_dsl_dataset;
|
||||||
VERIFY3P(ds, !=, NULL);
|
VERIFY3P(ds, !=, NULL);
|
||||||
@ -839,6 +839,9 @@ dmu_objset_create_check(void *arg, dmu_tx_t *tx)
|
|||||||
if (strchr(doca->doca_name, '@') != NULL)
|
if (strchr(doca->doca_name, '@') != NULL)
|
||||||
return (SET_ERROR(EINVAL));
|
return (SET_ERROR(EINVAL));
|
||||||
|
|
||||||
|
if (strlen(doca->doca_name) >= ZFS_MAX_DATASET_NAME_LEN)
|
||||||
|
return (SET_ERROR(ENAMETOOLONG));
|
||||||
|
|
||||||
error = dsl_dir_hold(dp, doca->doca_name, FTAG, &pdd, &tail);
|
error = dsl_dir_hold(dp, doca->doca_name, FTAG, &pdd, &tail);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
@ -923,6 +926,9 @@ dmu_objset_clone_check(void *arg, dmu_tx_t *tx)
|
|||||||
if (strchr(doca->doca_clone, '@') != NULL)
|
if (strchr(doca->doca_clone, '@') != NULL)
|
||||||
return (SET_ERROR(EINVAL));
|
return (SET_ERROR(EINVAL));
|
||||||
|
|
||||||
|
if (strlen(doca->doca_clone) >= ZFS_MAX_DATASET_NAME_LEN)
|
||||||
|
return (SET_ERROR(ENAMETOOLONG));
|
||||||
|
|
||||||
error = dsl_dir_hold(dp, doca->doca_clone, FTAG, &pdd, &tail);
|
error = dsl_dir_hold(dp, doca->doca_clone, FTAG, &pdd, &tail);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
@ -962,7 +968,7 @@ dmu_objset_clone_sync(void *arg, dmu_tx_t *tx)
|
|||||||
const char *tail;
|
const char *tail;
|
||||||
dsl_dataset_t *origin, *ds;
|
dsl_dataset_t *origin, *ds;
|
||||||
uint64_t obj;
|
uint64_t obj;
|
||||||
char namebuf[MAXNAMELEN];
|
char namebuf[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
VERIFY0(dsl_dir_hold(dp, doca->doca_clone, FTAG, &pdd, &tail));
|
VERIFY0(dsl_dir_hold(dp, doca->doca_clone, FTAG, &pdd, &tail));
|
||||||
VERIFY0(dsl_dataset_hold(dp, doca->doca_origin, FTAG, &origin));
|
VERIFY0(dsl_dataset_hold(dp, doca->doca_origin, FTAG, &origin));
|
||||||
@ -1973,7 +1979,7 @@ dmu_objset_get_user(objset_t *os)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine name of filesystem, given name of snapshot.
|
* Determine name of filesystem, given name of snapshot.
|
||||||
* buf must be at least MAXNAMELEN bytes
|
* buf must be at least ZFS_MAX_DATASET_NAME_LEN bytes
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
dmu_fsname(const char *snapname, char *buf)
|
dmu_fsname(const char *snapname, char *buf)
|
||||||
@ -1981,7 +1987,7 @@ dmu_fsname(const char *snapname, char *buf)
|
|||||||
char *atp = strchr(snapname, '@');
|
char *atp = strchr(snapname, '@');
|
||||||
if (atp == NULL)
|
if (atp == NULL)
|
||||||
return (SET_ERROR(EINVAL));
|
return (SET_ERROR(EINVAL));
|
||||||
if (atp - snapname >= MAXNAMELEN)
|
if (atp - snapname >= ZFS_MAX_DATASET_NAME_LEN)
|
||||||
return (SET_ERROR(ENAMETOOLONG));
|
return (SET_ERROR(ENAMETOOLONG));
|
||||||
(void) strlcpy(buf, snapname, atp - snapname + 1);
|
(void) strlcpy(buf, snapname, atp - snapname + 1);
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -1308,7 +1308,7 @@ dmu_recv_begin_check(void *arg, dmu_tx_t *tx)
|
|||||||
dsl_dataset_rele(ds, FTAG);
|
dsl_dataset_rele(ds, FTAG);
|
||||||
} else if (error == ENOENT) {
|
} else if (error == ENOENT) {
|
||||||
/* target fs does not exist; must be a full backup or clone */
|
/* target fs does not exist; must be a full backup or clone */
|
||||||
char buf[MAXNAMELEN];
|
char buf[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If it's a non-clone incremental, we are missing the
|
* If it's a non-clone incremental, we are missing the
|
||||||
@ -1328,7 +1328,7 @@ dmu_recv_begin_check(void *arg, dmu_tx_t *tx)
|
|||||||
return (SET_ERROR(EINVAL));
|
return (SET_ERROR(EINVAL));
|
||||||
|
|
||||||
/* Open the parent of tofs */
|
/* Open the parent of tofs */
|
||||||
ASSERT3U(strlen(tofs), <, MAXNAMELEN);
|
ASSERT3U(strlen(tofs), <, sizeof (buf));
|
||||||
(void) strlcpy(buf, tofs, strrchr(tofs, '/') - tofs + 1);
|
(void) strlcpy(buf, tofs, strrchr(tofs, '/') - tofs + 1);
|
||||||
error = dsl_dataset_hold(dp, buf, FTAG, &ds);
|
error = dsl_dataset_hold(dp, buf, FTAG, &ds);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
@ -1512,7 +1512,8 @@ dmu_recv_resume_begin_check(void *arg, dmu_tx_t *tx)
|
|||||||
!spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_LZ4_COMPRESS))
|
!spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_LZ4_COMPRESS))
|
||||||
return (SET_ERROR(ENOTSUP));
|
return (SET_ERROR(ENOTSUP));
|
||||||
|
|
||||||
char recvname[ZFS_MAXNAMELEN];
|
/* 6 extra bytes for /%recv */
|
||||||
|
char recvname[ZFS_MAX_DATASET_NAME_LEN + 6];
|
||||||
|
|
||||||
(void) snprintf(recvname, sizeof (recvname), "%s/%s",
|
(void) snprintf(recvname, sizeof (recvname), "%s/%s",
|
||||||
tofs, recv_clone_name);
|
tofs, recv_clone_name);
|
||||||
@ -1585,7 +1586,8 @@ dmu_recv_resume_begin_sync(void *arg, dmu_tx_t *tx)
|
|||||||
const char *tofs = drba->drba_cookie->drc_tofs;
|
const char *tofs = drba->drba_cookie->drc_tofs;
|
||||||
dsl_dataset_t *ds;
|
dsl_dataset_t *ds;
|
||||||
uint64_t dsobj;
|
uint64_t dsobj;
|
||||||
char recvname[ZFS_MAXNAMELEN];
|
/* 6 extra bytes for /%recv */
|
||||||
|
char recvname[ZFS_MAX_DATASET_NAME_LEN + 6];
|
||||||
|
|
||||||
(void) snprintf(recvname, sizeof (recvname), "%s/%s",
|
(void) snprintf(recvname, sizeof (recvname), "%s/%s",
|
||||||
tofs, recv_clone_name);
|
tofs, recv_clone_name);
|
||||||
@ -2300,7 +2302,7 @@ dmu_recv_cleanup_ds(dmu_recv_cookie_t *drc)
|
|||||||
txg_wait_synced(drc->drc_ds->ds_dir->dd_pool, 0);
|
txg_wait_synced(drc->drc_ds->ds_dir->dd_pool, 0);
|
||||||
dsl_dataset_disown(drc->drc_ds, dmu_recv_tag);
|
dsl_dataset_disown(drc->drc_ds, dmu_recv_tag);
|
||||||
} else {
|
} else {
|
||||||
char name[MAXNAMELEN];
|
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
dsl_dataset_name(drc->drc_ds, name);
|
dsl_dataset_name(drc->drc_ds, name);
|
||||||
dsl_dataset_disown(drc->drc_ds, dmu_recv_tag);
|
dsl_dataset_disown(drc->drc_ds, dmu_recv_tag);
|
||||||
(void) dsl_destroy_head(name);
|
(void) dsl_destroy_head(name);
|
||||||
@ -3118,13 +3120,13 @@ static int
|
|||||||
dmu_recv_existing_end(dmu_recv_cookie_t *drc)
|
dmu_recv_existing_end(dmu_recv_cookie_t *drc)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
char name[MAXNAMELEN];
|
|
||||||
|
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
/*
|
/*
|
||||||
* We will be destroying the ds; make sure its origin is unmounted if
|
* We will be destroying the ds; make sure its origin is unmounted if
|
||||||
* necessary.
|
* necessary.
|
||||||
*/
|
*/
|
||||||
|
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
dsl_dataset_name(drc->drc_ds, name);
|
dsl_dataset_name(drc->drc_ds, name);
|
||||||
zfs_destroy_unmount_origin(name);
|
zfs_destroy_unmount_origin(name);
|
||||||
#endif
|
#endif
|
||||||
|
@ -34,10 +34,10 @@ static int
|
|||||||
dsl_bookmark_hold_ds(dsl_pool_t *dp, const char *fullname,
|
dsl_bookmark_hold_ds(dsl_pool_t *dp, const char *fullname,
|
||||||
dsl_dataset_t **dsp, void *tag, char **shortnamep)
|
dsl_dataset_t **dsp, void *tag, char **shortnamep)
|
||||||
{
|
{
|
||||||
char buf[MAXNAMELEN];
|
char buf[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char *hashp;
|
char *hashp;
|
||||||
|
|
||||||
if (strlen(fullname) >= MAXNAMELEN)
|
if (strlen(fullname) >= ZFS_MAX_DATASET_NAME_LEN)
|
||||||
return (SET_ERROR(ENAMETOOLONG));
|
return (SET_ERROR(ENAMETOOLONG));
|
||||||
hashp = strchr(fullname, '#');
|
hashp = strchr(fullname, '#');
|
||||||
if (hashp == NULL)
|
if (hashp == NULL)
|
||||||
|
@ -665,22 +665,37 @@ dsl_dataset_name(dsl_dataset_t *ds, char *name)
|
|||||||
dsl_dir_name(ds->ds_dir, name);
|
dsl_dir_name(ds->ds_dir, name);
|
||||||
VERIFY0(dsl_dataset_get_snapname(ds));
|
VERIFY0(dsl_dataset_get_snapname(ds));
|
||||||
if (ds->ds_snapname[0]) {
|
if (ds->ds_snapname[0]) {
|
||||||
(void) strcat(name, "@");
|
VERIFY3U(strlcat(name, "@", ZFS_MAX_DATASET_NAME_LEN),
|
||||||
|
<, ZFS_MAX_DATASET_NAME_LEN);
|
||||||
/*
|
/*
|
||||||
* We use a "recursive" mutex so that we
|
* We use a "recursive" mutex so that we
|
||||||
* can call dprintf_ds() with ds_lock held.
|
* can call dprintf_ds() with ds_lock held.
|
||||||
*/
|
*/
|
||||||
if (!MUTEX_HELD(&ds->ds_lock)) {
|
if (!MUTEX_HELD(&ds->ds_lock)) {
|
||||||
mutex_enter(&ds->ds_lock);
|
mutex_enter(&ds->ds_lock);
|
||||||
(void) strcat(name, ds->ds_snapname);
|
VERIFY3U(strlcat(name, ds->ds_snapname,
|
||||||
|
ZFS_MAX_DATASET_NAME_LEN), <,
|
||||||
|
ZFS_MAX_DATASET_NAME_LEN);
|
||||||
mutex_exit(&ds->ds_lock);
|
mutex_exit(&ds->ds_lock);
|
||||||
} else {
|
} else {
|
||||||
(void) strcat(name, ds->ds_snapname);
|
VERIFY3U(strlcat(name, ds->ds_snapname,
|
||||||
|
ZFS_MAX_DATASET_NAME_LEN), <,
|
||||||
|
ZFS_MAX_DATASET_NAME_LEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
dsl_dataset_namelen(dsl_dataset_t *ds)
|
||||||
|
{
|
||||||
|
VERIFY0(dsl_dataset_get_snapname(ds));
|
||||||
|
mutex_enter(&ds->ds_lock);
|
||||||
|
int len = dsl_dir_namelen(ds->ds_dir) + 1 + strlen(ds->ds_snapname);
|
||||||
|
mutex_exit(&ds->ds_lock);
|
||||||
|
return (len);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dsl_dataset_rele(dsl_dataset_t *ds, void *tag)
|
dsl_dataset_rele(dsl_dataset_t *ds, void *tag)
|
||||||
{
|
{
|
||||||
@ -1243,10 +1258,10 @@ dsl_dataset_snapshot_check(void *arg, dmu_tx_t *tx)
|
|||||||
int error = 0;
|
int error = 0;
|
||||||
dsl_dataset_t *ds;
|
dsl_dataset_t *ds;
|
||||||
char *name, *atp;
|
char *name, *atp;
|
||||||
char dsname[MAXNAMELEN];
|
char dsname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
name = nvpair_name(pair);
|
name = nvpair_name(pair);
|
||||||
if (strlen(name) >= MAXNAMELEN)
|
if (strlen(name) >= ZFS_MAX_DATASET_NAME_LEN)
|
||||||
error = SET_ERROR(ENAMETOOLONG);
|
error = SET_ERROR(ENAMETOOLONG);
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
atp = strchr(name, '@');
|
atp = strchr(name, '@');
|
||||||
@ -1419,7 +1434,7 @@ dsl_dataset_snapshot_sync(void *arg, dmu_tx_t *tx)
|
|||||||
pair != NULL; pair = nvlist_next_nvpair(ddsa->ddsa_snaps, pair)) {
|
pair != NULL; pair = nvlist_next_nvpair(ddsa->ddsa_snaps, pair)) {
|
||||||
dsl_dataset_t *ds;
|
dsl_dataset_t *ds;
|
||||||
char *name, *atp;
|
char *name, *atp;
|
||||||
char dsname[MAXNAMELEN];
|
char dsname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
name = nvpair_name(pair);
|
name = nvpair_name(pair);
|
||||||
atp = strchr(name, '@');
|
atp = strchr(name, '@');
|
||||||
@ -1465,7 +1480,7 @@ dsl_dataset_snapshot(nvlist_t *snaps, nvlist_t *props, nvlist_t *errors)
|
|||||||
suspended = fnvlist_alloc();
|
suspended = fnvlist_alloc();
|
||||||
for (pair = nvlist_next_nvpair(snaps, NULL); pair != NULL;
|
for (pair = nvlist_next_nvpair(snaps, NULL); pair != NULL;
|
||||||
pair = nvlist_next_nvpair(snaps, pair)) {
|
pair = nvlist_next_nvpair(snaps, pair)) {
|
||||||
char fsname[MAXNAMELEN];
|
char fsname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char *snapname = nvpair_name(pair);
|
char *snapname = nvpair_name(pair);
|
||||||
char *atp;
|
char *atp;
|
||||||
void *cookie;
|
void *cookie;
|
||||||
@ -1672,7 +1687,7 @@ get_clones_stat(dsl_dataset_t *ds, nvlist_t *nv)
|
|||||||
zap_cursor_retrieve(&zc, &za) == 0;
|
zap_cursor_retrieve(&zc, &za) == 0;
|
||||||
zap_cursor_advance(&zc)) {
|
zap_cursor_advance(&zc)) {
|
||||||
dsl_dataset_t *clone;
|
dsl_dataset_t *clone;
|
||||||
char buf[ZFS_MAXNAMELEN];
|
char buf[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
VERIFY0(dsl_dataset_hold_obj(ds->ds_dir->dd_pool,
|
VERIFY0(dsl_dataset_hold_obj(ds->ds_dir->dd_pool,
|
||||||
za.za_first_integer, FTAG, &clone));
|
za.za_first_integer, FTAG, &clone));
|
||||||
dsl_dir_name(clone->ds_dir, buf);
|
dsl_dir_name(clone->ds_dir, buf);
|
||||||
@ -1780,7 +1795,7 @@ dsl_dataset_stats(dsl_dataset_t *ds, nvlist_t *nv)
|
|||||||
get_clones_stat(ds, nv);
|
get_clones_stat(ds, nv);
|
||||||
} else {
|
} else {
|
||||||
if (ds->ds_prev != NULL && ds->ds_prev != dp->dp_origin_snap) {
|
if (ds->ds_prev != NULL && ds->ds_prev != dp->dp_origin_snap) {
|
||||||
char buf[MAXNAMELEN];
|
char buf[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
dsl_dataset_name(ds->ds_prev, buf);
|
dsl_dataset_name(ds->ds_prev, buf);
|
||||||
dsl_prop_nvlist_add_string(nv, ZFS_PROP_PREV_SNAP, buf);
|
dsl_prop_nvlist_add_string(nv, ZFS_PROP_PREV_SNAP, buf);
|
||||||
}
|
}
|
||||||
@ -1841,12 +1856,15 @@ dsl_dataset_stats(dsl_dataset_t *ds, nvlist_t *nv)
|
|||||||
* stats set on our child named "%recv". Check the child
|
* stats set on our child named "%recv". Check the child
|
||||||
* for the prop.
|
* for the prop.
|
||||||
*/
|
*/
|
||||||
char recvname[ZFS_MAXNAMELEN];
|
/* 6 extra bytes for /%recv */
|
||||||
|
char recvname[ZFS_MAX_DATASET_NAME_LEN + 6];
|
||||||
dsl_dataset_t *recv_ds;
|
dsl_dataset_t *recv_ds;
|
||||||
dsl_dataset_name(ds, recvname);
|
dsl_dataset_name(ds, recvname);
|
||||||
(void) strcat(recvname, "/");
|
if (strlcat(recvname, "/", sizeof (recvname)) <
|
||||||
(void) strcat(recvname, recv_clone_name);
|
sizeof (recvname) &&
|
||||||
if (dsl_dataset_hold(dp, recvname, FTAG, &recv_ds) == 0) {
|
strlcat(recvname, recv_clone_name, sizeof (recvname)) <
|
||||||
|
sizeof (recvname) &&
|
||||||
|
dsl_dataset_hold(dp, recvname, FTAG, &recv_ds) == 0) {
|
||||||
get_receive_resume_stats(recv_ds, nv);
|
get_receive_resume_stats(recv_ds, nv);
|
||||||
dsl_dataset_rele(recv_ds, FTAG);
|
dsl_dataset_rele(recv_ds, FTAG);
|
||||||
}
|
}
|
||||||
@ -1973,7 +1991,7 @@ dsl_dataset_rename_snapshot_check_impl(dsl_pool_t *dp,
|
|||||||
|
|
||||||
/* dataset name + 1 for the "@" + the new snapshot name must fit */
|
/* dataset name + 1 for the "@" + the new snapshot name must fit */
|
||||||
if (dsl_dir_namelen(hds->ds_dir) + 1 +
|
if (dsl_dir_namelen(hds->ds_dir) + 1 +
|
||||||
strlen(ddrsa->ddrsa_newsnapname) >= MAXNAMELEN)
|
strlen(ddrsa->ddrsa_newsnapname) >= ZFS_MAX_DATASET_NAME_LEN)
|
||||||
error = SET_ERROR(ENAMETOOLONG);
|
error = SET_ERROR(ENAMETOOLONG);
|
||||||
|
|
||||||
return (error);
|
return (error);
|
||||||
@ -2201,7 +2219,7 @@ dsl_dataset_rollback_sync(void *arg, dmu_tx_t *tx)
|
|||||||
dsl_pool_t *dp = dmu_tx_pool(tx);
|
dsl_pool_t *dp = dmu_tx_pool(tx);
|
||||||
dsl_dataset_t *ds, *clone;
|
dsl_dataset_t *ds, *clone;
|
||||||
uint64_t cloneobj;
|
uint64_t cloneobj;
|
||||||
char namebuf[ZFS_MAXNAMELEN];
|
char namebuf[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
VERIFY0(dsl_dataset_hold(dp, ddra->ddra_fsname, FTAG, &ds));
|
VERIFY0(dsl_dataset_hold(dp, ddra->ddra_fsname, FTAG, &ds));
|
||||||
|
|
||||||
@ -2754,7 +2772,7 @@ promote_rele(dsl_dataset_promote_arg_t *ddpa, void *tag)
|
|||||||
* Promote a clone.
|
* Promote a clone.
|
||||||
*
|
*
|
||||||
* If it fails due to a conflicting snapshot name, "conflsnap" will be filled
|
* If it fails due to a conflicting snapshot name, "conflsnap" will be filled
|
||||||
* in with the name. (It must be at least MAXNAMELEN bytes long.)
|
* in with the name. (It must be at least ZFS_MAX_DATASET_NAME_LEN bytes long.)
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
dsl_dataset_promote(const char *name, char *conflsnap)
|
dsl_dataset_promote(const char *name, char *conflsnap)
|
||||||
|
@ -20,7 +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 (c) 2011, 2014 by Delphix. All rights reserved.
|
* Copyright (c) 2011, 2015 by Delphix. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -330,7 +330,7 @@ dsl_deleg_get(const char *ddname, nvlist_t **nvp)
|
|||||||
zap_attribute_t baseza;
|
zap_attribute_t baseza;
|
||||||
nvlist_t *sp_nvp;
|
nvlist_t *sp_nvp;
|
||||||
uint64_t n;
|
uint64_t n;
|
||||||
char source[MAXNAMELEN];
|
char source[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
if (dsl_dir_phys(dd)->dd_deleg_zapobj == 0 ||
|
if (dsl_dir_phys(dd)->dd_deleg_zapobj == 0 ||
|
||||||
zap_count(mos,
|
zap_count(mos,
|
||||||
|
@ -298,13 +298,14 @@ dsl_dir_async_rele(dsl_dir_t *dd, void *tag)
|
|||||||
dmu_buf_rele(dd->dd_dbuf, tag);
|
dmu_buf_rele(dd->dd_dbuf, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* buf must be long enough (MAXNAMELEN + strlen(MOS_DIR_NAME) + 1 should do) */
|
/* buf must be at least ZFS_MAX_DATASET_NAME_LEN bytes */
|
||||||
void
|
void
|
||||||
dsl_dir_name(dsl_dir_t *dd, char *buf)
|
dsl_dir_name(dsl_dir_t *dd, char *buf)
|
||||||
{
|
{
|
||||||
if (dd->dd_parent) {
|
if (dd->dd_parent) {
|
||||||
dsl_dir_name(dd->dd_parent, buf);
|
dsl_dir_name(dd->dd_parent, buf);
|
||||||
(void) strcat(buf, "/");
|
VERIFY3U(strlcat(buf, "/", ZFS_MAX_DATASET_NAME_LEN), <,
|
||||||
|
ZFS_MAX_DATASET_NAME_LEN);
|
||||||
} else {
|
} else {
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
}
|
}
|
||||||
@ -314,10 +315,12 @@ dsl_dir_name(dsl_dir_t *dd, char *buf)
|
|||||||
* dprintf_dd() with dd_lock held
|
* dprintf_dd() with dd_lock held
|
||||||
*/
|
*/
|
||||||
mutex_enter(&dd->dd_lock);
|
mutex_enter(&dd->dd_lock);
|
||||||
(void) strcat(buf, dd->dd_myname);
|
VERIFY3U(strlcat(buf, dd->dd_myname, ZFS_MAX_DATASET_NAME_LEN),
|
||||||
|
<, ZFS_MAX_DATASET_NAME_LEN);
|
||||||
mutex_exit(&dd->dd_lock);
|
mutex_exit(&dd->dd_lock);
|
||||||
} else {
|
} else {
|
||||||
(void) strcat(buf, dd->dd_myname);
|
VERIFY3U(strlcat(buf, dd->dd_myname, ZFS_MAX_DATASET_NAME_LEN),
|
||||||
|
<, ZFS_MAX_DATASET_NAME_LEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,12 +369,12 @@ getcomponent(const char *path, char *component, const char **nextp)
|
|||||||
if (p != NULL &&
|
if (p != NULL &&
|
||||||
(p[0] != '@' || strpbrk(path+1, "/@") || p[1] == '\0'))
|
(p[0] != '@' || strpbrk(path+1, "/@") || p[1] == '\0'))
|
||||||
return (SET_ERROR(EINVAL));
|
return (SET_ERROR(EINVAL));
|
||||||
if (strlen(path) >= MAXNAMELEN)
|
if (strlen(path) >= ZFS_MAX_DATASET_NAME_LEN)
|
||||||
return (SET_ERROR(ENAMETOOLONG));
|
return (SET_ERROR(ENAMETOOLONG));
|
||||||
(void) strcpy(component, path);
|
(void) strcpy(component, path);
|
||||||
p = NULL;
|
p = NULL;
|
||||||
} else if (p[0] == '/') {
|
} else if (p[0] == '/') {
|
||||||
if (p - path >= MAXNAMELEN)
|
if (p - path >= ZFS_MAX_DATASET_NAME_LEN)
|
||||||
return (SET_ERROR(ENAMETOOLONG));
|
return (SET_ERROR(ENAMETOOLONG));
|
||||||
(void) strncpy(component, path, p - path);
|
(void) strncpy(component, path, p - path);
|
||||||
component[p - path] = '\0';
|
component[p - path] = '\0';
|
||||||
@ -383,7 +386,7 @@ getcomponent(const char *path, char *component, const char **nextp)
|
|||||||
*/
|
*/
|
||||||
if (strchr(path, '/'))
|
if (strchr(path, '/'))
|
||||||
return (SET_ERROR(EINVAL));
|
return (SET_ERROR(EINVAL));
|
||||||
if (p - path >= MAXNAMELEN)
|
if (p - path >= ZFS_MAX_DATASET_NAME_LEN)
|
||||||
return (SET_ERROR(ENAMETOOLONG));
|
return (SET_ERROR(ENAMETOOLONG));
|
||||||
(void) strncpy(component, path, p - path);
|
(void) strncpy(component, path, p - path);
|
||||||
component[p - path] = '\0';
|
component[p - path] = '\0';
|
||||||
@ -405,7 +408,7 @@ int
|
|||||||
dsl_dir_hold(dsl_pool_t *dp, const char *name, void *tag,
|
dsl_dir_hold(dsl_pool_t *dp, const char *name, void *tag,
|
||||||
dsl_dir_t **ddp, const char **tailp)
|
dsl_dir_t **ddp, const char **tailp)
|
||||||
{
|
{
|
||||||
char buf[MAXNAMELEN];
|
char buf[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
const char *spaname, *next, *nextnext = NULL;
|
const char *spaname, *next, *nextnext = NULL;
|
||||||
int err;
|
int err;
|
||||||
dsl_dir_t *dd;
|
dsl_dir_t *dd;
|
||||||
@ -968,7 +971,7 @@ dsl_dir_stats(dsl_dir_t *dd, nvlist_t *nv)
|
|||||||
|
|
||||||
if (dsl_dir_is_clone(dd)) {
|
if (dsl_dir_is_clone(dd)) {
|
||||||
dsl_dataset_t *ds;
|
dsl_dataset_t *ds;
|
||||||
char buf[MAXNAMELEN];
|
char buf[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
VERIFY0(dsl_dataset_hold_obj(dd->dd_pool,
|
VERIFY0(dsl_dataset_hold_obj(dd->dd_pool,
|
||||||
dsl_dir_phys(dd)->dd_origin_obj, FTAG, &ds));
|
dsl_dir_phys(dd)->dd_origin_obj, FTAG, &ds));
|
||||||
@ -1676,11 +1679,11 @@ static int
|
|||||||
dsl_valid_rename(dsl_pool_t *dp, dsl_dataset_t *ds, void *arg)
|
dsl_valid_rename(dsl_pool_t *dp, dsl_dataset_t *ds, void *arg)
|
||||||
{
|
{
|
||||||
int *deltap = arg;
|
int *deltap = arg;
|
||||||
char namebuf[MAXNAMELEN];
|
char namebuf[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
dsl_dataset_name(ds, namebuf);
|
dsl_dataset_name(ds, namebuf);
|
||||||
|
|
||||||
if (strlen(namebuf) + *deltap >= MAXNAMELEN)
|
if (strlen(namebuf) + *deltap >= ZFS_MAX_DATASET_NAME_LEN)
|
||||||
return (SET_ERROR(ENAMETOOLONG));
|
return (SET_ERROR(ENAMETOOLONG));
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,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) 2012, 2014 by Delphix. All rights reserved.
|
* Copyright (c) 2012, 2015 by Delphix. All rights reserved.
|
||||||
* Copyright (c) 2013 Martin Matuska. All rights reserved.
|
* Copyright (c) 2013 Martin Matuska. All rights reserved.
|
||||||
* Copyright 2015, Joyent, Inc.
|
* Copyright 2015, Joyent, Inc.
|
||||||
*/
|
*/
|
||||||
@ -1058,7 +1058,7 @@ dsl_prop_get_all_ds(dsl_dataset_t *ds, nvlist_t **nvp,
|
|||||||
dsl_pool_t *dp = dd->dd_pool;
|
dsl_pool_t *dp = dd->dd_pool;
|
||||||
objset_t *mos = dp->dp_meta_objset;
|
objset_t *mos = dp->dp_meta_objset;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
char setpoint[MAXNAMELEN];
|
char setpoint[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
VERIFY(nvlist_alloc(nvp, NV_UNIQUE_NAME, KM_SLEEP) == 0);
|
VERIFY(nvlist_alloc(nvp, NV_UNIQUE_NAME, KM_SLEEP) == 0);
|
||||||
|
|
||||||
|
@ -1087,7 +1087,7 @@ dsl_scan_visitds(dsl_scan_t *scn, uint64_t dsobj, dmu_tx_t *tx)
|
|||||||
dmu_buf_will_dirty(ds->ds_dbuf, tx);
|
dmu_buf_will_dirty(ds->ds_dbuf, tx);
|
||||||
dsl_scan_visit_rootbp(scn, ds, &dsl_dataset_phys(ds)->ds_bp, tx);
|
dsl_scan_visit_rootbp(scn, ds, &dsl_dataset_phys(ds)->ds_bp, tx);
|
||||||
|
|
||||||
char *dsname = kmem_alloc(ZFS_MAXNAMELEN, KM_SLEEP);
|
char *dsname = kmem_alloc(ZFS_MAX_DATASET_NAME_LEN, KM_SLEEP);
|
||||||
dsl_dataset_name(ds, dsname);
|
dsl_dataset_name(ds, dsname);
|
||||||
zfs_dbgmsg("scanned dataset %llu (%s) with min=%llu max=%llu; "
|
zfs_dbgmsg("scanned dataset %llu (%s) with min=%llu max=%llu; "
|
||||||
"pausing=%u",
|
"pausing=%u",
|
||||||
@ -1095,7 +1095,7 @@ dsl_scan_visitds(dsl_scan_t *scn, uint64_t dsobj, dmu_tx_t *tx)
|
|||||||
(longlong_t)scn->scn_phys.scn_cur_min_txg,
|
(longlong_t)scn->scn_phys.scn_cur_min_txg,
|
||||||
(longlong_t)scn->scn_phys.scn_cur_max_txg,
|
(longlong_t)scn->scn_phys.scn_cur_max_txg,
|
||||||
(int)scn->scn_pausing);
|
(int)scn->scn_pausing);
|
||||||
kmem_free(dsname, ZFS_MAXNAMELEN);
|
kmem_free(dsname, ZFS_MAX_DATASET_NAME_LEN);
|
||||||
|
|
||||||
if (scn->scn_pausing)
|
if (scn->scn_pausing)
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -20,7 +20,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) 2012, 2014 by Delphix. All rights reserved.
|
* Copyright (c) 2012, 2015 by Delphix. All rights reserved.
|
||||||
* Copyright (c) 2013 Steven Hartland. All rights reserved.
|
* Copyright (c) 2013 Steven Hartland. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ dsl_dataset_user_hold_sync_one_impl(nvlist_t *tmpholds, dsl_dataset_t *ds,
|
|||||||
}
|
}
|
||||||
|
|
||||||
typedef struct zfs_hold_cleanup_arg {
|
typedef struct zfs_hold_cleanup_arg {
|
||||||
char zhca_spaname[MAXNAMELEN];
|
char zhca_spaname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
uint64_t zhca_spa_load_guid;
|
uint64_t zhca_spa_load_guid;
|
||||||
nvlist_t *zhca_holds;
|
nvlist_t *zhca_holds;
|
||||||
} zfs_hold_cleanup_arg_t;
|
} zfs_hold_cleanup_arg_t;
|
||||||
@ -574,7 +574,7 @@ dsl_dataset_user_release_impl(nvlist_t *holds, nvlist_t *errlist,
|
|||||||
error = dsl_dataset_hold_obj_string(tmpdp,
|
error = dsl_dataset_hold_obj_string(tmpdp,
|
||||||
nvpair_name(pair), FTAG, &ds);
|
nvpair_name(pair), FTAG, &ds);
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
char name[MAXNAMELEN];
|
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
dsl_dataset_name(ds, name);
|
dsl_dataset_name(ds, name);
|
||||||
dsl_pool_config_exit(tmpdp, FTAG);
|
dsl_pool_config_exit(tmpdp, FTAG);
|
||||||
dsl_dataset_rele(ds, FTAG);
|
dsl_dataset_rele(ds, FTAG);
|
||||||
|
@ -350,8 +350,7 @@ spa_prop_get(spa_t *spa, nvlist_t **nvp)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
strval = kmem_alloc(
|
strval = kmem_alloc(ZFS_MAX_DATASET_NAME_LEN,
|
||||||
MAXNAMELEN + strlen(MOS_DIR_NAME) + 1,
|
|
||||||
KM_SLEEP);
|
KM_SLEEP);
|
||||||
dsl_dataset_name(ds, strval);
|
dsl_dataset_name(ds, strval);
|
||||||
dsl_dataset_rele(ds, FTAG);
|
dsl_dataset_rele(ds, FTAG);
|
||||||
@ -364,8 +363,7 @@ spa_prop_get(spa_t *spa, nvlist_t **nvp)
|
|||||||
spa_prop_add_list(*nvp, prop, strval, intval, src);
|
spa_prop_add_list(*nvp, prop, strval, intval, src);
|
||||||
|
|
||||||
if (strval != NULL)
|
if (strval != NULL)
|
||||||
kmem_free(strval,
|
kmem_free(strval, ZFS_MAX_DATASET_NAME_LEN);
|
||||||
MAXNAMELEN + strlen(MOS_DIR_NAME) + 1);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1930,11 +1928,8 @@ spa_load_verify_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
|
|||||||
int
|
int
|
||||||
verify_dataset_name_len(dsl_pool_t *dp, dsl_dataset_t *ds, void *arg)
|
verify_dataset_name_len(dsl_pool_t *dp, dsl_dataset_t *ds, void *arg)
|
||||||
{
|
{
|
||||||
char namebuf[MAXPATHLEN];
|
if (dsl_dataset_namelen(ds) >= ZFS_MAX_DATASET_NAME_LEN)
|
||||||
dsl_dataset_name(ds, namebuf);
|
|
||||||
if (strlen(namebuf) > MAXNAMELEN) {
|
|
||||||
return (SET_ERROR(ENAMETOOLONG));
|
return (SET_ERROR(ENAMETOOLONG));
|
||||||
}
|
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2011, 2014 by Delphix. All rights reserved.
|
* Copyright (c) 2011, 2015 by Delphix. All rights reserved.
|
||||||
* Copyright (c) 2014 Integros [integros.com]
|
* Copyright (c) 2014 Integros [integros.com]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -494,7 +494,7 @@ spa_history_log_internal_ds(dsl_dataset_t *ds, const char *operation,
|
|||||||
dmu_tx_t *tx, const char *fmt, ...)
|
dmu_tx_t *tx, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list adx;
|
va_list adx;
|
||||||
char namebuf[MAXNAMELEN];
|
char namebuf[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
nvlist_t *nvl = fnvlist_alloc();
|
nvlist_t *nvl = fnvlist_alloc();
|
||||||
|
|
||||||
ASSERT(tx != NULL);
|
ASSERT(tx != NULL);
|
||||||
@ -513,7 +513,7 @@ spa_history_log_internal_dd(dsl_dir_t *dd, const char *operation,
|
|||||||
dmu_tx_t *tx, const char *fmt, ...)
|
dmu_tx_t *tx, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list adx;
|
va_list adx;
|
||||||
char namebuf[MAXNAMELEN];
|
char namebuf[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
nvlist_t *nvl = fnvlist_alloc();
|
nvlist_t *nvl = fnvlist_alloc();
|
||||||
|
|
||||||
ASSERT(tx != NULL);
|
ASSERT(tx != NULL);
|
||||||
|
@ -807,7 +807,7 @@ typedef struct dmu_objset_stats {
|
|||||||
dmu_objset_type_t dds_type;
|
dmu_objset_type_t dds_type;
|
||||||
uint8_t dds_is_snapshot;
|
uint8_t dds_is_snapshot;
|
||||||
uint8_t dds_inconsistent;
|
uint8_t dds_inconsistent;
|
||||||
char dds_origin[MAXNAMELEN];
|
char dds_origin[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
} dmu_objset_stats_t;
|
} dmu_objset_stats_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -221,7 +221,7 @@ typedef struct dsl_dataset {
|
|||||||
uint8_t ds_feature_activation_needed[SPA_FEATURES];
|
uint8_t ds_feature_activation_needed[SPA_FEATURES];
|
||||||
|
|
||||||
/* Protected by ds_lock; keep at end of struct for better locality */
|
/* Protected by ds_lock; keep at end of struct for better locality */
|
||||||
char ds_snapname[MAXNAMELEN];
|
char ds_snapname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
} dsl_dataset_t;
|
} dsl_dataset_t;
|
||||||
|
|
||||||
inline dsl_dataset_phys_t *
|
inline dsl_dataset_phys_t *
|
||||||
@ -256,6 +256,7 @@ int dsl_dataset_own_obj(struct dsl_pool *dp, uint64_t dsobj,
|
|||||||
void dsl_dataset_disown(dsl_dataset_t *ds, void *tag);
|
void dsl_dataset_disown(dsl_dataset_t *ds, void *tag);
|
||||||
void dsl_dataset_name(dsl_dataset_t *ds, char *name);
|
void dsl_dataset_name(dsl_dataset_t *ds, char *name);
|
||||||
boolean_t dsl_dataset_tryown(dsl_dataset_t *ds, void *tag);
|
boolean_t dsl_dataset_tryown(dsl_dataset_t *ds, void *tag);
|
||||||
|
int dsl_dataset_namelen(dsl_dataset_t *ds);
|
||||||
boolean_t dsl_dataset_has_owner(dsl_dataset_t *ds);
|
boolean_t dsl_dataset_has_owner(dsl_dataset_t *ds);
|
||||||
uint64_t dsl_dataset_create_sync(dsl_dir_t *pds, const char *lastname,
|
uint64_t dsl_dataset_create_sync(dsl_dir_t *pds, const char *lastname,
|
||||||
dsl_dataset_t *origin, uint64_t flags, cred_t *, dmu_tx_t *);
|
dsl_dataset_t *origin, uint64_t flags, cred_t *, dmu_tx_t *);
|
||||||
@ -347,10 +348,10 @@ void dsl_dataset_deactivate_feature(uint64_t dsobj,
|
|||||||
#ifdef ZFS_DEBUG
|
#ifdef ZFS_DEBUG
|
||||||
#define dprintf_ds(ds, fmt, ...) do { \
|
#define dprintf_ds(ds, fmt, ...) do { \
|
||||||
if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
|
if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
|
||||||
char *__ds_name = kmem_alloc(MAXNAMELEN, KM_SLEEP); \
|
char *__ds_name = kmem_alloc(ZFS_MAX_DATASET_NAME_LEN, KM_SLEEP); \
|
||||||
dsl_dataset_name(ds, __ds_name); \
|
dsl_dataset_name(ds, __ds_name); \
|
||||||
dprintf("ds=%s " fmt, __ds_name, __VA_ARGS__); \
|
dprintf("ds=%s " fmt, __ds_name, __VA_ARGS__); \
|
||||||
kmem_free(__ds_name, MAXNAMELEN); \
|
kmem_free(__ds_name, ZFS_MAX_DATASET_NAME_LEN); \
|
||||||
} \
|
} \
|
||||||
_NOTE(CONSTCOND) } while (0)
|
_NOTE(CONSTCOND) } while (0)
|
||||||
#else
|
#else
|
||||||
|
@ -112,7 +112,7 @@ struct dsl_dir {
|
|||||||
int64_t dd_space_towrite[TXG_SIZE];
|
int64_t dd_space_towrite[TXG_SIZE];
|
||||||
|
|
||||||
/* protected by dd_lock; keep at end of struct for better locality */
|
/* protected by dd_lock; keep at end of struct for better locality */
|
||||||
char dd_myname[MAXNAMELEN];
|
char dd_myname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
};
|
};
|
||||||
|
|
||||||
inline dsl_dir_phys_t *
|
inline dsl_dir_phys_t *
|
||||||
@ -176,11 +176,10 @@ boolean_t dsl_dir_is_zapified(dsl_dir_t *dd);
|
|||||||
#ifdef ZFS_DEBUG
|
#ifdef ZFS_DEBUG
|
||||||
#define dprintf_dd(dd, fmt, ...) do { \
|
#define dprintf_dd(dd, fmt, ...) do { \
|
||||||
if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
|
if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
|
||||||
char *__ds_name = kmem_alloc(MAXNAMELEN + strlen(MOS_DIR_NAME) + 1, \
|
char *__ds_name = kmem_alloc(ZFS_MAX_DATASET_NAME_LEN, KM_SLEEP); \
|
||||||
KM_SLEEP); \
|
|
||||||
dsl_dir_name(dd, __ds_name); \
|
dsl_dir_name(dd, __ds_name); \
|
||||||
dprintf("dd=%s " fmt, __ds_name, __VA_ARGS__); \
|
dprintf("dd=%s " fmt, __ds_name, __VA_ARGS__); \
|
||||||
kmem_free(__ds_name, MAXNAMELEN + strlen(MOS_DIR_NAME) + 1); \
|
kmem_free(__ds_name, ZFS_MAX_DATASET_NAME_LEN); \
|
||||||
} \
|
} \
|
||||||
_NOTE(CONSTCOND) } while (0)
|
_NOTE(CONSTCOND) } while (0)
|
||||||
#else
|
#else
|
||||||
|
@ -126,7 +126,7 @@ struct spa {
|
|||||||
/*
|
/*
|
||||||
* Fields protected by spa_namespace_lock.
|
* Fields protected by spa_namespace_lock.
|
||||||
*/
|
*/
|
||||||
char spa_name[MAXNAMELEN]; /* pool name */
|
char spa_name[ZFS_MAX_DATASET_NAME_LEN]; /* pool name */
|
||||||
char *spa_comment; /* comment */
|
char *spa_comment; /* comment */
|
||||||
avl_node_t spa_avl; /* node in spa_namespace_avl */
|
avl_node_t spa_avl; /* node in spa_namespace_avl */
|
||||||
nvlist_t *spa_config; /* last synced config */
|
nvlist_t *spa_config; /* last synced config */
|
||||||
|
@ -344,7 +344,7 @@ typedef struct {
|
|||||||
boolean_t za_normalization_conflict;
|
boolean_t za_normalization_conflict;
|
||||||
uint64_t za_num_integers;
|
uint64_t za_num_integers;
|
||||||
uint64_t za_first_integer; /* no sign extension for <8byte ints */
|
uint64_t za_first_integer; /* no sign extension for <8byte ints */
|
||||||
char za_name[MAXNAMELEN];
|
char za_name[ZAP_MAXNAMELEN];
|
||||||
} zap_attribute_t;
|
} zap_attribute_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -20,7 +20,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) 2012 by Delphix. All rights reserved.
|
* Copyright (c) 2012, 2015 by Delphix. All rights reserved.
|
||||||
* Copyright (c) 2014 Integros [integros.com]
|
* Copyright (c) 2014 Integros [integros.com]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -137,17 +137,6 @@ extern "C" {
|
|||||||
#define ZFS_SHARES_DIR "SHARES"
|
#define ZFS_SHARES_DIR "SHARES"
|
||||||
#define ZFS_SA_ATTRS "SA_ATTRS"
|
#define ZFS_SA_ATTRS "SA_ATTRS"
|
||||||
|
|
||||||
/*
|
|
||||||
* Path component length
|
|
||||||
*
|
|
||||||
* The generic fs code uses MAXNAMELEN to represent
|
|
||||||
* what the largest component length is. Unfortunately,
|
|
||||||
* this length includes the terminating NULL. ZFS needs
|
|
||||||
* to tell the users via pathconf() and statvfs() what the
|
|
||||||
* true maximum length of a component is, excluding the NULL.
|
|
||||||
*/
|
|
||||||
#define ZFS_MAXNAMELEN (MAXNAMELEN - 1)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert mode bits (zp_mode) to BSD-style DT_* values for storing in
|
* Convert mode bits (zp_mode) to BSD-style DT_* values for storing in
|
||||||
* the directory entries.
|
* the directory entries.
|
||||||
|
@ -20,7 +20,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) 2012, 2014 by Delphix. All rights reserved.
|
* Copyright (c) 2012, 2015 by Delphix. All rights reserved.
|
||||||
* Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
|
* Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -621,8 +621,8 @@ zfsctl_snapdir_rename(vnode_t *sdvp, char *snm, vnode_t *tdvp, char *tnm,
|
|||||||
zfs_snapentry_t search, *sep;
|
zfs_snapentry_t search, *sep;
|
||||||
zfsvfs_t *zfsvfs;
|
zfsvfs_t *zfsvfs;
|
||||||
avl_index_t where;
|
avl_index_t where;
|
||||||
char from[MAXNAMELEN], to[MAXNAMELEN];
|
char from[ZFS_MAX_DATASET_NAME_LEN], to[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char real[MAXNAMELEN], fsname[MAXNAMELEN];
|
char real[ZFS_MAX_DATASET_NAME_LEN], fsname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
zfsvfs = sdvp->v_vfsp->vfs_data;
|
zfsvfs = sdvp->v_vfsp->vfs_data;
|
||||||
@ -630,7 +630,7 @@ zfsctl_snapdir_rename(vnode_t *sdvp, char *snm, vnode_t *tdvp, char *tnm,
|
|||||||
|
|
||||||
if ((flags & FIGNORECASE) || zfsvfs->z_case == ZFS_CASE_INSENSITIVE) {
|
if ((flags & FIGNORECASE) || zfsvfs->z_case == ZFS_CASE_INSENSITIVE) {
|
||||||
err = dmu_snapshot_realname(zfsvfs->z_os, snm, real,
|
err = dmu_snapshot_realname(zfsvfs->z_os, snm, real,
|
||||||
MAXNAMELEN, NULL);
|
sizeof (real), NULL);
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
snm = real;
|
snm = real;
|
||||||
} else if (err != ENOTSUP) {
|
} else if (err != ENOTSUP) {
|
||||||
@ -643,9 +643,9 @@ zfsctl_snapdir_rename(vnode_t *sdvp, char *snm, vnode_t *tdvp, char *tnm,
|
|||||||
|
|
||||||
dmu_objset_name(zfsvfs->z_os, fsname);
|
dmu_objset_name(zfsvfs->z_os, fsname);
|
||||||
|
|
||||||
err = zfsctl_snapshot_zname(sdvp, snm, MAXNAMELEN, from);
|
err = zfsctl_snapshot_zname(sdvp, snm, sizeof (from), from);
|
||||||
if (err == 0)
|
if (err == 0)
|
||||||
err = zfsctl_snapshot_zname(tdvp, tnm, MAXNAMELEN, to);
|
err = zfsctl_snapshot_zname(tdvp, tnm, sizeof (to), to);
|
||||||
if (err == 0)
|
if (err == 0)
|
||||||
err = zfs_secpolicy_rename_perms(from, to, cr);
|
err = zfs_secpolicy_rename_perms(from, to, cr);
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
@ -686,8 +686,8 @@ zfsctl_snapdir_remove(vnode_t *dvp, char *name, vnode_t *cwd, cred_t *cr,
|
|||||||
zfs_snapentry_t *sep;
|
zfs_snapentry_t *sep;
|
||||||
zfs_snapentry_t search;
|
zfs_snapentry_t search;
|
||||||
zfsvfs_t *zfsvfs;
|
zfsvfs_t *zfsvfs;
|
||||||
char snapname[MAXNAMELEN];
|
char snapname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char real[MAXNAMELEN];
|
char real[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
zfsvfs = dvp->v_vfsp->vfs_data;
|
zfsvfs = dvp->v_vfsp->vfs_data;
|
||||||
@ -696,7 +696,7 @@ zfsctl_snapdir_remove(vnode_t *dvp, char *name, vnode_t *cwd, cred_t *cr,
|
|||||||
if ((flags & FIGNORECASE) || zfsvfs->z_case == ZFS_CASE_INSENSITIVE) {
|
if ((flags & FIGNORECASE) || zfsvfs->z_case == ZFS_CASE_INSENSITIVE) {
|
||||||
|
|
||||||
err = dmu_snapshot_realname(zfsvfs->z_os, name, real,
|
err = dmu_snapshot_realname(zfsvfs->z_os, name, real,
|
||||||
MAXNAMELEN, NULL);
|
sizeof (real), NULL);
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
name = real;
|
name = real;
|
||||||
} else if (err != ENOTSUP) {
|
} else if (err != ENOTSUP) {
|
||||||
@ -707,7 +707,7 @@ zfsctl_snapdir_remove(vnode_t *dvp, char *name, vnode_t *cwd, cred_t *cr,
|
|||||||
|
|
||||||
ZFS_EXIT(zfsvfs);
|
ZFS_EXIT(zfsvfs);
|
||||||
|
|
||||||
err = zfsctl_snapshot_zname(dvp, name, MAXNAMELEN, snapname);
|
err = zfsctl_snapshot_zname(dvp, name, sizeof (snapname), snapname);
|
||||||
if (err == 0)
|
if (err == 0)
|
||||||
err = zfs_secpolicy_destroy_perms(snapname, cr);
|
err = zfs_secpolicy_destroy_perms(snapname, cr);
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
@ -742,7 +742,7 @@ zfsctl_snapdir_mkdir(vnode_t *dvp, char *dirname, vattr_t *vap, vnode_t **vpp,
|
|||||||
cred_t *cr, caller_context_t *cc, int flags, vsecattr_t *vsecp)
|
cred_t *cr, caller_context_t *cc, int flags, vsecattr_t *vsecp)
|
||||||
{
|
{
|
||||||
zfsvfs_t *zfsvfs = dvp->v_vfsp->vfs_data;
|
zfsvfs_t *zfsvfs = dvp->v_vfsp->vfs_data;
|
||||||
char name[MAXNAMELEN];
|
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
int err;
|
int err;
|
||||||
static enum symfollow follow = NO_FOLLOW;
|
static enum symfollow follow = NO_FOLLOW;
|
||||||
static enum uio_seg seg = UIO_SYSSPACE;
|
static enum uio_seg seg = UIO_SYSSPACE;
|
||||||
@ -781,8 +781,8 @@ zfsctl_snapdir_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, pathname_t *pnp,
|
|||||||
{
|
{
|
||||||
zfsctl_snapdir_t *sdp = dvp->v_data;
|
zfsctl_snapdir_t *sdp = dvp->v_data;
|
||||||
objset_t *snap;
|
objset_t *snap;
|
||||||
char snapname[MAXNAMELEN];
|
char snapname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char real[MAXNAMELEN];
|
char real[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char *mountpoint;
|
char *mountpoint;
|
||||||
zfs_snapentry_t *sep, search;
|
zfs_snapentry_t *sep, search;
|
||||||
struct mounta margs;
|
struct mounta margs;
|
||||||
@ -820,7 +820,7 @@ zfsctl_snapdir_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, pathname_t *pnp,
|
|||||||
boolean_t conflict = B_FALSE;
|
boolean_t conflict = B_FALSE;
|
||||||
|
|
||||||
err = dmu_snapshot_realname(zfsvfs->z_os, nm, real,
|
err = dmu_snapshot_realname(zfsvfs->z_os, nm, real,
|
||||||
MAXNAMELEN, &conflict);
|
sizeof (real), &conflict);
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
nm = real;
|
nm = real;
|
||||||
} else if (err != ENOTSUP) {
|
} else if (err != ENOTSUP) {
|
||||||
@ -865,7 +865,7 @@ zfsctl_snapdir_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, pathname_t *pnp,
|
|||||||
/*
|
/*
|
||||||
* The requested snapshot is not currently mounted, look it up.
|
* The requested snapshot is not currently mounted, look it up.
|
||||||
*/
|
*/
|
||||||
err = zfsctl_snapshot_zname(dvp, nm, MAXNAMELEN, snapname);
|
err = zfsctl_snapshot_zname(dvp, nm, sizeof (snapname), snapname);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
mutex_exit(&sdp->sd_lock);
|
mutex_exit(&sdp->sd_lock);
|
||||||
ZFS_EXIT(zfsvfs);
|
ZFS_EXIT(zfsvfs);
|
||||||
@ -984,7 +984,7 @@ zfsctl_snapdir_readdir_cb(vnode_t *vp, void *dp, int *eofp,
|
|||||||
offset_t *offp, offset_t *nextp, void *data, int flags)
|
offset_t *offp, offset_t *nextp, void *data, int flags)
|
||||||
{
|
{
|
||||||
zfsvfs_t *zfsvfs = vp->v_vfsp->vfs_data;
|
zfsvfs_t *zfsvfs = vp->v_vfsp->vfs_data;
|
||||||
char snapname[MAXNAMELEN];
|
char snapname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
uint64_t id, cookie;
|
uint64_t id, cookie;
|
||||||
boolean_t case_conflict;
|
boolean_t case_conflict;
|
||||||
int error;
|
int error;
|
||||||
@ -993,8 +993,8 @@ zfsctl_snapdir_readdir_cb(vnode_t *vp, void *dp, int *eofp,
|
|||||||
|
|
||||||
cookie = *offp;
|
cookie = *offp;
|
||||||
dsl_pool_config_enter(dmu_objset_pool(zfsvfs->z_os), FTAG);
|
dsl_pool_config_enter(dmu_objset_pool(zfsvfs->z_os), FTAG);
|
||||||
error = dmu_snapshot_list_next(zfsvfs->z_os, MAXNAMELEN, snapname, &id,
|
error = dmu_snapshot_list_next(zfsvfs->z_os,
|
||||||
&cookie, &case_conflict);
|
sizeof (snapname), snapname, &id, &cookie, &case_conflict);
|
||||||
dsl_pool_config_exit(dmu_objset_pool(zfsvfs->z_os), FTAG);
|
dsl_pool_config_exit(dmu_objset_pool(zfsvfs->z_os), FTAG);
|
||||||
if (error) {
|
if (error) {
|
||||||
ZFS_EXIT(zfsvfs);
|
ZFS_EXIT(zfsvfs);
|
||||||
|
@ -628,7 +628,7 @@ zfs_secpolicy_setprop(const char *dsname, zfs_prop_t prop, nvpair_t *propval,
|
|||||||
case ZFS_PROP_SNAPSHOT_LIMIT:
|
case ZFS_PROP_SNAPSHOT_LIMIT:
|
||||||
if (!INGLOBALZONE(curproc)) {
|
if (!INGLOBALZONE(curproc)) {
|
||||||
uint64_t zoned;
|
uint64_t zoned;
|
||||||
char setpoint[MAXNAMELEN];
|
char setpoint[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
/*
|
/*
|
||||||
* Unprivileged users are allowed to modify the
|
* Unprivileged users are allowed to modify the
|
||||||
* limit on things *under* (ie. contained by)
|
* limit on things *under* (ie. contained by)
|
||||||
@ -860,7 +860,7 @@ zfs_secpolicy_destroy_snaps(zfs_cmd_t *zc, nvlist_t *innvl, cred_t *cr)
|
|||||||
int
|
int
|
||||||
zfs_secpolicy_rename_perms(const char *from, const char *to, cred_t *cr)
|
zfs_secpolicy_rename_perms(const char *from, const char *to, cred_t *cr)
|
||||||
{
|
{
|
||||||
char parentname[MAXNAMELEN];
|
char parentname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if ((error = zfs_secpolicy_write_perms(from,
|
if ((error = zfs_secpolicy_write_perms(from,
|
||||||
@ -913,7 +913,7 @@ zfs_secpolicy_promote(zfs_cmd_t *zc, nvlist_t *innvl, cred_t *cr)
|
|||||||
error = dsl_dataset_hold(dp, zc->zc_name, FTAG, &clone);
|
error = dsl_dataset_hold(dp, zc->zc_name, FTAG, &clone);
|
||||||
|
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
char parentname[MAXNAMELEN];
|
char parentname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
dsl_dataset_t *origin = NULL;
|
dsl_dataset_t *origin = NULL;
|
||||||
dsl_dir_t *dd;
|
dsl_dir_t *dd;
|
||||||
dd = clone->ds_dir;
|
dd = clone->ds_dir;
|
||||||
@ -1082,7 +1082,7 @@ zfs_secpolicy_log_history(zfs_cmd_t *zc, nvlist_t *innvl, cred_t *cr)
|
|||||||
static int
|
static int
|
||||||
zfs_secpolicy_create_clone(zfs_cmd_t *zc, nvlist_t *innvl, cred_t *cr)
|
zfs_secpolicy_create_clone(zfs_cmd_t *zc, nvlist_t *innvl, cred_t *cr)
|
||||||
{
|
{
|
||||||
char parentname[MAXNAMELEN];
|
char parentname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
int error;
|
int error;
|
||||||
char *origin;
|
char *origin;
|
||||||
|
|
||||||
@ -1225,7 +1225,7 @@ zfs_secpolicy_hold(zfs_cmd_t *zc, nvlist_t *innvl, cred_t *cr)
|
|||||||
|
|
||||||
for (pair = nvlist_next_nvpair(holds, NULL); pair != NULL;
|
for (pair = nvlist_next_nvpair(holds, NULL); pair != NULL;
|
||||||
pair = nvlist_next_nvpair(holds, pair)) {
|
pair = nvlist_next_nvpair(holds, pair)) {
|
||||||
char fsname[MAXNAMELEN];
|
char fsname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
error = dmu_fsname(nvpair_name(pair), fsname);
|
error = dmu_fsname(nvpair_name(pair), fsname);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
@ -1246,7 +1246,7 @@ zfs_secpolicy_release(zfs_cmd_t *zc, nvlist_t *innvl, cred_t *cr)
|
|||||||
|
|
||||||
for (pair = nvlist_next_nvpair(innvl, NULL); pair != NULL;
|
for (pair = nvlist_next_nvpair(innvl, NULL); pair != NULL;
|
||||||
pair = nvlist_next_nvpair(innvl, pair)) {
|
pair = nvlist_next_nvpair(innvl, pair)) {
|
||||||
char fsname[MAXNAMELEN];
|
char fsname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
error = dmu_fsname(nvpair_name(pair), fsname);
|
error = dmu_fsname(nvpair_name(pair), fsname);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
@ -2292,7 +2292,8 @@ zfs_ioc_snapshot_list_next(zfs_cmd_t *zc)
|
|||||||
* A dataset name of maximum length cannot have any snapshots,
|
* A dataset name of maximum length cannot have any snapshots,
|
||||||
* so exit immediately.
|
* so exit immediately.
|
||||||
*/
|
*/
|
||||||
if (strlcat(zc->zc_name, "@", sizeof (zc->zc_name)) >= MAXNAMELEN) {
|
if (strlcat(zc->zc_name, "@", sizeof (zc->zc_name)) >=
|
||||||
|
ZFS_MAX_DATASET_NAME_LEN) {
|
||||||
dmu_objset_rele(os, FTAG);
|
dmu_objset_rele(os, FTAG);
|
||||||
return (SET_ERROR(ESRCH));
|
return (SET_ERROR(ESRCH));
|
||||||
}
|
}
|
||||||
@ -3098,7 +3099,7 @@ zfs_fill_zplprops(const char *dataset, nvlist_t *createprops,
|
|||||||
boolean_t fuids_ok, sa_ok;
|
boolean_t fuids_ok, sa_ok;
|
||||||
uint64_t zplver = ZPL_VERSION;
|
uint64_t zplver = ZPL_VERSION;
|
||||||
objset_t *os = NULL;
|
objset_t *os = NULL;
|
||||||
char parentname[MAXNAMELEN];
|
char parentname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
char *cp;
|
char *cp;
|
||||||
spa_t *spa;
|
spa_t *spa;
|
||||||
uint64_t spa_vers;
|
uint64_t spa_vers;
|
||||||
@ -3459,7 +3460,7 @@ zfs_destroy_unmount_origin(const char *fsname)
|
|||||||
return;
|
return;
|
||||||
ds = dmu_objset_ds(os);
|
ds = dmu_objset_ds(os);
|
||||||
if (dsl_dir_is_clone(ds->ds_dir) && DS_IS_DEFER_DESTROY(ds->ds_prev)) {
|
if (dsl_dir_is_clone(ds->ds_dir) && DS_IS_DEFER_DESTROY(ds->ds_prev)) {
|
||||||
char originname[MAXNAMELEN];
|
char originname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
dsl_dataset_name(ds->ds_prev, originname);
|
dsl_dataset_name(ds->ds_prev, originname);
|
||||||
dmu_objset_rele(os, FTAG);
|
dmu_objset_rele(os, FTAG);
|
||||||
(void) zfs_unmount_snap(originname);
|
(void) zfs_unmount_snap(originname);
|
||||||
@ -3654,7 +3655,7 @@ static int
|
|||||||
recursive_unmount(const char *fsname, void *arg)
|
recursive_unmount(const char *fsname, void *arg)
|
||||||
{
|
{
|
||||||
const char *snapname = arg;
|
const char *snapname = arg;
|
||||||
char fullname[MAXNAMELEN];
|
char fullname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
(void) snprintf(fullname, sizeof (fullname), "%s@%s", fsname, snapname);
|
(void) snprintf(fullname, sizeof (fullname), "%s@%s", fsname, snapname);
|
||||||
return (zfs_unmount_snap(fullname));
|
return (zfs_unmount_snap(fullname));
|
||||||
@ -4182,7 +4183,7 @@ zfs_ioc_recv(zfs_cmd_t *zc)
|
|||||||
nvlist_t *delayprops = NULL; /* sent properties applied post-receive */
|
nvlist_t *delayprops = NULL; /* sent properties applied post-receive */
|
||||||
char *origin = NULL;
|
char *origin = NULL;
|
||||||
char *tosnap;
|
char *tosnap;
|
||||||
char tofs[ZFS_MAXNAMELEN];
|
char tofs[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
boolean_t first_recvd_props = B_FALSE;
|
boolean_t first_recvd_props = B_FALSE;
|
||||||
|
|
||||||
if (dataset_namecheck(zc->zc_value, NULL, NULL) != 0 ||
|
if (dataset_namecheck(zc->zc_value, NULL, NULL) != 0 ||
|
||||||
|
@ -496,7 +496,7 @@ zfs_register_callbacks(vfs_t *vfsp)
|
|||||||
} else if (vfs_optionisset(vfsp, MNTOPT_NBMAND, NULL)) {
|
} else if (vfs_optionisset(vfsp, MNTOPT_NBMAND, NULL)) {
|
||||||
nbmand = B_TRUE;
|
nbmand = B_TRUE;
|
||||||
} else {
|
} else {
|
||||||
char osname[MAXNAMELEN];
|
char osname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
dmu_objset_name(os, osname);
|
dmu_objset_name(os, osname);
|
||||||
if (error = dsl_prop_get_integer(osname, "nbmand", &nbmand,
|
if (error = dsl_prop_get_integer(osname, "nbmand", &nbmand,
|
||||||
@ -1696,7 +1696,7 @@ zfs_statvfs(vfs_t *vfsp, struct statvfs64 *statp)
|
|||||||
|
|
||||||
statp->f_flag = vf_to_stf(vfsp->vfs_flag);
|
statp->f_flag = vf_to_stf(vfsp->vfs_flag);
|
||||||
|
|
||||||
statp->f_namemax = ZFS_MAXNAMELEN;
|
statp->f_namemax = MAXNAMELEN - 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We have all of 32 characters to stuff a string here.
|
* We have all of 32 characters to stuff a string here.
|
||||||
|
@ -1961,7 +1961,7 @@ typedef struct zil_replay_arg {
|
|||||||
static int
|
static int
|
||||||
zil_replay_error(zilog_t *zilog, lr_t *lr, int error)
|
zil_replay_error(zilog_t *zilog, lr_t *lr, int error)
|
||||||
{
|
{
|
||||||
char name[MAXNAMELEN];
|
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
zilog->zl_replaying_seq--; /* didn't actually replay this one */
|
zilog->zl_replaying_seq--; /* didn't actually replay this one */
|
||||||
|
|
||||||
|
@ -71,9 +71,13 @@ typedef enum dmu_objset_type {
|
|||||||
#define ZFS_TYPE_DATASET \
|
#define ZFS_TYPE_DATASET \
|
||||||
(ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
|
(ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* All of these include the terminating NUL byte.
|
||||||
|
*/
|
||||||
#define ZAP_MAXNAMELEN 256
|
#define ZAP_MAXNAMELEN 256
|
||||||
#define ZAP_MAXVALUELEN (1024 * 8)
|
#define ZAP_MAXVALUELEN (1024 * 8)
|
||||||
#define ZAP_OLDMAXVALUELEN 1024
|
#define ZAP_OLDMAXVALUELEN 1024
|
||||||
|
#define ZFS_MAX_DATASET_NAME_LEN 256
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dataset properties are identified by these constants and must be added to
|
* Dataset properties are identified by these constants and must be added to
|
||||||
|
Loading…
Reference in New Issue
Block a user