aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2017-09-20 07:27:45 +0000
committerAndriy Gapon <avg@FreeBSD.org>2017-09-20 07:27:45 +0000
commitde90fd216825a6aa001663d4e64eab0374b15933 (patch)
tree06e76f7a67750fa50f62ea967e3d8a34ad5b085d
parent7257b152dc60cf5cc09ae6aa3a3a2d6e2da851fd (diff)
downloadsrc-de90fd216825a6aa001663d4e64eab0374b15933.tar.gz
src-de90fd216825a6aa001663d4e64eab0374b15933.zip
8605 zfs channel programs: zfs.exists undocumented and non-working
illumos/illumos-gate@5f39f884e2035d671ec02148fc4d8420c670bcb4 https://github.com/illumos/illumos-gate/commit/5f39f884e2035d671ec02148fc4d8420c670bcb4 https://www.illumos.org/issues/8605 zfs.exists() in channel programs doesn't return any result, and should have a man page entry. Reviewed by: Paul Dagnelie <pcd@delphix.com> Reviewed by: Dan Kimmel <dan.kimmel@delphix.com> Reviewed by: Matt Ahrens <mahrens@delphix.com> Approved by: Robert Mustacchi <rm@joyent.com> Author: Chris Williamson <chris.williamson@delphix.com>
Notes
Notes: svn path=/vendor-sys/illumos/dist/; revision=323794
-rw-r--r--man/man1m/zfs-program.1m12
-rw-r--r--uts/common/fs/zfs/zcp.c2
2 files changed, 13 insertions, 1 deletions
diff --git a/man/man1m/zfs-program.1m b/man/man1m/zfs-program.1m
index 0834607f94e1..0e1793e9d539 100644
--- a/man/man1m/zfs-program.1m
+++ b/man/man1m/zfs-program.1m
@@ -289,6 +289,18 @@ msg (string)
.Bd -ragged -compact -offset "xxxx"
Debug message to be printed.
.Ed
+.It Em zfs.exists(dataset)
+Returns true if the given dataset exists, or false if it doesn't.
+A fatal error will be thrown if the dataset is not in the target pool.
+That is, in a channel program running on rpool,
+zfs.exists("rpool/nonexistent_fs") returns false, but
+zfs.exists("somepool/fs_that_may_exist") will error.
+.Pp
+dataset (string)
+.Bd -ragged -compact -offset "xxxx"
+Dataset to check for existence.
+Must be in the target pool.
+.Ed
.It Em zfs.get_prop(dataset, property)
Returns two values.
First, a string, number or table containing the property value for the given
diff --git a/uts/common/fs/zfs/zcp.c b/uts/common/fs/zfs/zcp.c
index 8dbde05262d9..7736deddefef 100644
--- a/uts/common/fs/zfs/zcp.c
+++ b/uts/common/fs/zfs/zcp.c
@@ -710,7 +710,7 @@ zcp_exists(lua_State *state)
return (luaL_error(state, "unexpected error %d", error));
}
- return (0);
+ return (1);
}
/*