aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/dsl_dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'module/zfs/dsl_dir.c')
-rw-r--r--module/zfs/dsl_dir.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/module/zfs/dsl_dir.c b/module/zfs/dsl_dir.c
index 69a28ef25..572086b93 100644
--- a/module/zfs/dsl_dir.c
+++ b/module/zfs/dsl_dir.c
@@ -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) 2013 by Delphix. All rights reserved.
*/
#include <sys/dmu.h>
@@ -249,12 +249,12 @@ getcomponent(const char *path, char *component, const char **nextp)
char *p;
if ((path == NULL) || (path[0] == '\0'))
- return (ENOENT);
+ return (SET_ERROR(ENOENT));
/* This would be a good place to reserve some namespace... */
p = strpbrk(path, "/@");
if (p && (p[1] == '/' || p[1] == '@')) {
/* two separators in a row */
- return (EINVAL);
+ return (SET_ERROR(EINVAL));
}
if (p == NULL || p == path) {
/*
@@ -264,14 +264,14 @@ getcomponent(const char *path, char *component, const char **nextp)
*/
if (p != NULL &&
(p[0] != '@' || strpbrk(path+1, "/@") || p[1] == '\0'))
- return (EINVAL);
+ return (SET_ERROR(EINVAL));
if (strlen(path) >= MAXNAMELEN)
- return (ENAMETOOLONG);
+ return (SET_ERROR(ENAMETOOLONG));
(void) strcpy(component, path);
p = NULL;
} else if (p[0] == '/') {
if (p - path >= MAXNAMELEN)
- return (ENAMETOOLONG);
+ return (SET_ERROR(ENAMETOOLONG));
(void) strncpy(component, path, p - path);
component[p - path] = '\0';
p++;
@@ -281,9 +281,9 @@ getcomponent(const char *path, char *component, const char **nextp)
* any more slashes.
*/
if (strchr(path, '/'))
- return (EINVAL);
+ return (SET_ERROR(EINVAL));
if (p - path >= MAXNAMELEN)
- return (ENAMETOOLONG);
+ return (SET_ERROR(ENAMETOOLONG));
(void) strncpy(component, path, p - path);
component[p - path] = '\0';
} else {
@@ -318,7 +318,7 @@ dsl_dir_hold(dsl_pool_t *dp, const char *name, void *tag,
/* Make sure the name is in the specified pool. */
spaname = spa_name(dp->dp_spa);
if (strcmp(buf, spaname) != 0) {
- err = EINVAL;
+ err = SET_ERROR(EINVAL);
goto error;
}
@@ -371,7 +371,7 @@ dsl_dir_hold(dsl_pool_t *dp, const char *name, void *tag,
/* bad path name */
dsl_dir_rele(dd, tag);
dprintf("next=%p (%s) tail=%p\n", next, next?next:"", tailp);
- err = ENOENT;
+ err = SET_ERROR(ENOENT);
}
if (tailp != NULL)
*tailp = next;
@@ -682,7 +682,7 @@ dsl_dir_tempreserve_impl(dsl_dir_t *dd, uint64_t asize, boolean_t netfree,
used_on_disk>>10, est_inflight>>10,
quota>>10, asize>>10, retval);
mutex_exit(&dd->dd_lock);
- return (retval);
+ return (SET_ERROR(retval));
}
/* We need to up our estimated delta before dropping dd_lock */
@@ -744,7 +744,7 @@ dsl_dir_tempreserve_space(dsl_dir_t *dd, uint64_t lsize, uint64_t asize,
} else {
if (err == EAGAIN) {
txg_delay(dd->dd_pool, tx->tx_txg, 1);
- err = ERESTART;
+ err = SET_ERROR(ERESTART);
}
dsl_pool_memory_pressure(dd->dd_pool);
}
@@ -956,7 +956,7 @@ dsl_dir_set_quota_check(void *arg, dmu_tx_t *tx)
if ((dmu_tx_is_syncing(tx) || towrite == 0) &&
(newval < ds->ds_dir->dd_phys->dd_reserved ||
newval < ds->ds_dir->dd_phys->dd_used_bytes + towrite)) {
- error = ENOSPC;
+ error = SET_ERROR(ENOSPC);
}
mutex_exit(&ds->ds_dir->dd_lock);
dsl_dataset_rele(ds, FTAG);
@@ -1050,7 +1050,7 @@ dsl_dir_set_reservation_check(void *arg, dmu_tx_t *tx)
if (delta > avail ||
(dd->dd_phys->dd_quota > 0 &&
newval > dd->dd_phys->dd_quota))
- error = ENOSPC;
+ error = SET_ERROR(ENOSPC);
}
dsl_dataset_rele(ds, FTAG);
@@ -1157,7 +1157,7 @@ dsl_valid_rename(dsl_pool_t *dp, dsl_dataset_t *ds, void *arg)
dsl_dataset_name(ds, namebuf);
if (strlen(namebuf) + *deltap >= MAXNAMELEN)
- return (ENAMETOOLONG);
+ return (SET_ERROR(ENAMETOOLONG));
return (0);
}
@@ -1188,14 +1188,14 @@ dsl_dir_rename_check(void *arg, dmu_tx_t *tx)
if (dd->dd_pool != newparent->dd_pool) {
dsl_dir_rele(newparent, FTAG);
dsl_dir_rele(dd, FTAG);
- return (ENXIO);
+ return (SET_ERROR(ENXIO));
}
/* new name should not already exist */
if (mynewname == NULL) {
dsl_dir_rele(newparent, FTAG);
dsl_dir_rele(dd, FTAG);
- return (EEXIST);
+ return (SET_ERROR(EEXIST));
}
/* if the name length is growing, validate child name lengths */
@@ -1218,7 +1218,7 @@ dsl_dir_rename_check(void *arg, dmu_tx_t *tx)
if (closest_common_ancestor(dd, newparent) == dd) {
dsl_dir_rele(newparent, FTAG);
dsl_dir_rele(dd, FTAG);
- return (EINVAL);
+ return (SET_ERROR(EINVAL));
}
error = dsl_dir_transfer_possible(dd->dd_parent,
@@ -1320,7 +1320,7 @@ dsl_dir_transfer_possible(dsl_dir_t *sdd, dsl_dir_t *tdd, uint64_t space)
adelta = would_change(sdd, -space, ancestor);
avail = dsl_dir_space_available(tdd, ancestor, adelta, FALSE);
if (avail < space)
- return (ENOSPC);
+ return (SET_ERROR(ENOSPC));
return (0);
}