From owner-svn-src-head@freebsd.org Sun Oct 1 16:51:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8FF3E29244; Sun, 1 Oct 2017 16:51:06 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 948756676C; Sun, 1 Oct 2017 16:51:06 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v91Gp5Ur039804; Sun, 1 Oct 2017 16:51:05 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v91Gp56C039802; Sun, 1 Oct 2017 16:51:05 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201710011651.v91Gp56C039802@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sun, 1 Oct 2017 16:51:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324170 - in head: cddl/contrib/opensolaris/cmd/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 324170 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Oct 2017 16:51:06 -0000 Author: avg Date: Sun Oct 1 16:51:05 2017 New Revision: 324170 URL: https://svnweb.freebsd.org/changeset/base/324170 Log: MFV r323794: 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 Reviewed by: Dan Kimmel Reviewed by: Matt Ahrens Approved by: Robert Mustacchi Author: Chris Williamson MFC after: 5 weeks X-MFC after: r324163 Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Sun Oct 1 16:48:36 2017 (r324169) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Sun Oct 1 16:51:05 2017 (r324170) @@ -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 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c Sun Oct 1 16:48:36 2017 (r324169) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c Sun Oct 1 16:51:05 2017 (r324170) @@ -717,7 +717,7 @@ zcp_exists(lua_State *state) return (luaL_error(state, "unexpected error %d", error)); } - return (0); + return (1); } /*