summaryrefslogtreecommitdiffstats
path: root/module/zcommon/zfs_namecheck.c
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2010-08-26 11:45:02 -0700
committerBrian Behlendorf <[email protected]>2010-08-31 13:41:57 -0700
commit60101509ee73c6e61e50c0a4079097f31bb39f4b (patch)
tree4d17e0f9a56f9c6e70e79d15aa18a563c3e70b3a /module/zcommon/zfs_namecheck.c
parent325f023544bbec6a478882c442e15304ee379759 (diff)
Add linux kernel disk support
Native Linux vdev disk interfaces Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'module/zcommon/zfs_namecheck.c')
-rw-r--r--module/zcommon/zfs_namecheck.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/module/zcommon/zfs_namecheck.c b/module/zcommon/zfs_namecheck.c
index 5cfafea47..2398c2755 100644
--- a/module/zcommon/zfs_namecheck.c
+++ b/module/zcommon/zfs_namecheck.c
@@ -142,9 +142,22 @@ dataset_namecheck(const char *path, namecheck_err_t *why, char *what)
* which is the same as MAXNAMELEN used in the kernel.
* If ZFS_MAXNAMELEN value is changed, make sure to cleanup all
* places using MAXNAMELEN.
+ *
+ * When HAVE_KOBJ_NAME_LEN is defined the maximum safe kobject name
+ * length is 20 bytes. This 20 bytes is broken down as follows to
+ * provide a maximum safe <pool>/<dataset>[@snapshot] length of only
+ * 18 bytes. To ensure bytes are left for <dataset>[@snapshot] the
+ * <pool> portition is futher limited to 9 bytes. For 2.6.27 and
+ * newer kernels this limit is set to MAXNAMELEN.
+ *
+ * <pool>/<dataset> + <partition> + <newline>
+ * (18) + (1) + (1)
*/
-
+#ifdef HAVE_KOBJ_NAME_LEN
+ if (strlen(path) > 18) {
+#else
if (strlen(path) >= MAXNAMELEN) {
+#endif /* HAVE_KOBJ_NAME_LEN */
if (why)
*why = NAME_ERR_TOOLONG;
return (-1);
@@ -303,8 +316,22 @@ pool_namecheck(const char *pool, namecheck_err_t *why, char *what)
* which is the same as MAXNAMELEN used in the kernel.
* If ZPOOL_MAXNAMELEN value is changed, make sure to cleanup all
* places using MAXNAMELEN.
+ *
+ * When HAVE_KOBJ_NAME_LEN is defined the maximum safe kobject name
+ * length is 20 bytes. This 20 bytes is broken down as follows to
+ * provide a maximum safe <pool>/<dataset>[@snapshot] length of only
+ * 18 bytes. To ensure bytes are left for <dataset>[@snapshot] the
+ * <pool> portition is futher limited to 8 bytes. For 2.6.27 and
+ * newer kernels this limit is set to MAXNAMELEN.
+ *
+ * <pool>/<dataset> + <partition> + <newline>
+ * (18) + (1) + (1)
*/
+#ifdef HAVE_KOBJ_NAME_LEN
+ if (strlen(pool) > 8) {
+#else
if (strlen(pool) >= MAXNAMELEN) {
+#endif /* HAVE_KOBJ_NAME_LEN */
if (why)
*why = NAME_ERR_TOOLONG;
return (-1);