aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/libzfs.h2
-rw-r--r--include/libzfs_impl.h10
-rw-r--r--include/sys/dmu.h2
-rw-r--r--include/sys/dsl_dataset.h7
-rw-r--r--include/sys/dsl_dir.h7
-rw-r--r--include/sys/fs/zfs.h6
-rw-r--r--include/sys/spa_impl.h2
-rw-r--r--include/sys/zap.h2
-rw-r--r--include/sys/zfs_znode.h13
9 files changed, 21 insertions, 30 deletions
diff --git a/include/libzfs.h b/include/libzfs.h
index 40eb20781..f83e21423 100644
--- a/include/libzfs.h
+++ b/include/libzfs.h
@@ -49,8 +49,6 @@ extern "C" {
/*
* Miscellaneous ZFS constants
*/
-#define ZFS_MAXNAMELEN MAXNAMELEN
-#define ZPOOL_MAXNAMELEN MAXNAMELEN
#define ZFS_MAXPROPLEN MAXPATHLEN
#define ZPOOL_MAXPROPLEN MAXPATHLEN
diff --git a/include/libzfs_impl.h b/include/libzfs_impl.h
index 1efe4e233..36441ed7b 100644
--- a/include/libzfs_impl.h
+++ b/include/libzfs_impl.h
@@ -21,17 +21,17 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
*/
#ifndef _LIBZFS_IMPL_H
#define _LIBZFS_IMPL_H
-#include <sys/dmu.h>
#include <sys/fs/zfs.h>
-#include <sys/zfs_ioctl.h>
#include <sys/spa.h>
#include <sys/nvpair.h>
+#include <sys/dmu.h>
+#include <sys/zfs_ioctl.h>
#include <libuutil.h>
#include <libzfs.h>
@@ -85,7 +85,7 @@ struct libzfs_handle {
struct zfs_handle {
libzfs_handle_t *zfs_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_head_type; /* type excluding snapshot */
dmu_objset_stats_t zfs_dmustats;
@@ -106,7 +106,7 @@ struct zfs_handle {
struct zpool_handle {
libzfs_handle_t *zpool_hdl;
zpool_handle_t *zpool_next;
- char zpool_name[ZPOOL_MAXNAMELEN];
+ char zpool_name[ZFS_MAX_DATASET_NAME_LEN];
int zpool_state;
size_t zpool_config_size;
nvlist_t *zpool_config;
diff --git a/include/sys/dmu.h b/include/sys/dmu.h
index 74001d8f3..87a8a40eb 100644
--- a/include/sys/dmu.h
+++ b/include/sys/dmu.h
@@ -816,7 +816,7 @@ typedef struct dmu_objset_stats {
dmu_objset_type_t dds_type;
uint8_t dds_is_snapshot;
uint8_t dds_inconsistent;
- char dds_origin[MAXNAMELEN];
+ char dds_origin[ZFS_MAX_DATASET_NAME_LEN];
} dmu_objset_stats_t;
/*
diff --git a/include/sys/dsl_dataset.h b/include/sys/dsl_dataset.h
index 195a271c9..4d2f5e418 100644
--- a/include/sys/dsl_dataset.h
+++ b/include/sys/dsl_dataset.h
@@ -227,7 +227,7 @@ typedef struct dsl_dataset {
uint8_t ds_feature_activation_needed[SPA_FEATURES];
/* 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;
static inline dsl_dataset_phys_t *
@@ -262,6 +262,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_name(dsl_dataset_t *ds, char *name);
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);
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 *);
@@ -353,10 +354,10 @@ void dsl_dataset_deactivate_feature(uint64_t dsobj,
#ifdef ZFS_DEBUG
#define dprintf_ds(ds, fmt, ...) do { \
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); \
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)
#else
diff --git a/include/sys/dsl_dir.h b/include/sys/dsl_dir.h
index a025c50a0..fb299684c 100644
--- a/include/sys/dsl_dir.h
+++ b/include/sys/dsl_dir.h
@@ -112,7 +112,7 @@ struct dsl_dir {
int64_t dd_space_towrite[TXG_SIZE];
/* protected by dd_lock; keep at end of struct for better locality */
- char dd_myname[MAXNAMELEN];
+ char dd_myname[ZFS_MAX_DATASET_NAME_LEN];
};
static inline dsl_dir_phys_t *
@@ -176,11 +176,10 @@ boolean_t dsl_dir_is_zapified(dsl_dir_t *dd);
#ifdef ZFS_DEBUG
#define dprintf_dd(dd, fmt, ...) do { \
if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
- char *__ds_name = kmem_alloc(MAXNAMELEN + strlen(MOS_DIR_NAME) + 1, \
- KM_SLEEP); \
+ char *__ds_name = kmem_alloc(ZFS_MAX_DATASET_NAME_LEN, KM_SLEEP); \
dsl_dir_name(dd, __ds_name); \
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)
#else
diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h
index e802454b9..b25d3016a 100644
--- a/include/sys/fs/zfs.h
+++ b/include/sys/fs/zfs.h
@@ -67,9 +67,13 @@ typedef enum dmu_objset_type {
#define ZFS_TYPE_DATASET \
(ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
+/*
+ * All of these include the terminating NUL byte.
+ */
#define ZAP_MAXNAMELEN 256
#define ZAP_MAXVALUELEN (1024 * 8)
#define ZAP_OLDMAXVALUELEN 1024
+#define ZFS_MAX_DATASET_NAME_LEN 256
/*
* Dataset properties are identified by these constants and must be added to
@@ -1019,7 +1023,7 @@ typedef enum zfs_ioc {
/*
* zvol ioctl to get dataset name
*/
-#define BLKZNAME _IOR(0x12, 125, char[ZFS_MAXNAMELEN])
+#define BLKZNAME _IOR(0x12, 125, char[ZFS_MAX_DATASET_NAME_LEN])
/*
* Internal SPA load state. Used by FMA diagnosis engine.
diff --git a/include/sys/spa_impl.h b/include/sys/spa_impl.h
index 2eb5fa12a..59cb44de2 100644
--- a/include/sys/spa_impl.h
+++ b/include/sys/spa_impl.h
@@ -126,7 +126,7 @@ struct spa {
/*
* 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 */
avl_node_t spa_avl; /* node in spa_namespace_avl */
nvlist_t *spa_config; /* last synced config */
diff --git a/include/sys/zap.h b/include/sys/zap.h
index 70cbaae97..700947397 100644
--- a/include/sys/zap.h
+++ b/include/sys/zap.h
@@ -363,7 +363,7 @@ typedef struct {
boolean_t za_normalization_conflict;
uint64_t za_num_integers;
uint64_t za_first_integer; /* no sign extension for <8byte ints */
- char za_name[MAXNAMELEN];
+ char za_name[ZAP_MAXNAMELEN];
} zap_attribute_t;
/*
diff --git a/include/sys/zfs_znode.h b/include/sys/zfs_znode.h
index 2c09feee1..8e563a572 100644
--- a/include/sys/zfs_znode.h
+++ b/include/sys/zfs_znode.h
@@ -20,7 +20,7 @@
*/
/*
* 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.
*/
#ifndef _SYS_FS_ZFS_ZNODE_H
@@ -139,17 +139,6 @@ extern "C" {
#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
* the directory entries. On Linux systems this value is already
* defined correctly as part of the /usr/include/dirent.h header file.