[Zrouter-src-freebsd] ZRouter.org: push to FreeBSD HEAD tree
zrouter-src-freebsd at zrouter.org
zrouter-src-freebsd at zrouter.org
Fri Mar 2 15:37:52 UTC 2012
details: http://zrouter.org/hg/FreeBSD/head//rev/aeeb5a674d34
changeset: 358:aeeb5a674d34
user: ray at terran.dlink.ua
date: Fri Mar 02 16:55:36 2012 +0200
description:
Update to FreeBSD-HEAD @232391
diffstat:
head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 | 41 ++++++++---
head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c | 81 +++++++++++++++++------
2 files changed, 86 insertions(+), 36 deletions(-)
diffs (357 lines):
diff -r 71c478d74e2f -r aeeb5a674d34 head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
--- a/head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Mar 02 16:55:25 2012 +0200
+++ b/head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Mar 02 16:55:36 2012 +0200
@@ -1,5 +1,5 @@
'\" te
-.\" Copyright (c) 2011, Martin Matuska <mm at FreeBSD.org>.
+.\" Copyright (c) 2012, Martin Matuska <mm at FreeBSD.org>.
.\" All Rights Reserved.
.\"
.\" The contents of this file are subject to the terms of the
@@ -18,13 +18,13 @@
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved.
-.\" Copyright 2011 Nexenta Systems, Inc. All rights reserved.
.\" Copyright (c) 2011 by Delphix. All rights reserved.
+.\" Copyright (c) 2012 Nexenta Systems, Inc. All Rights Reserved.
.\" Copyright (c) 2011, Pawel Jakub Dawidek <pjd at FreeBSD.org>
.\"
-.\" $FreeBSD: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 228353 2011-12-08 19:38:42Z mm $
+.\" $FreeBSD: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 232186 2012-02-26 16:30:39Z mm $
.\"
-.Dd November 26, 2011
+.Dd February 26, 2012
.Dt ZFS 8
.Os
.Sh NAME
@@ -113,6 +113,7 @@
.Op Fl r Ns | Ns Fl d Ar depth
.Op Fl Hp
.Op Fl o Ar all | field Ns Op , Ns Ar ...
+.Op Fl t Ar type Ns Op , Ns Ar ...
.Op Fl s Ar source Ns Op , Ns Ar ...
.Ar all | property Ns Op , Ns Ar ...
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
@@ -412,9 +413,15 @@
same dataset to another jails. To allow management of the dataset from within
a jail, the
.Sy jailed
-property has to be set. The
+property has to be set and the jail needs access to the
+.Pa /dev/zfs
+device. The
.Sy quota
-property cannot be changed from within a jail.
+property cannot be changed from within a jail. See
+.Xr jail 8
+for information on how to allow mounting
+.Tn ZFS
+datasets from within a jail.
.Pp
.No A Tn ZFS
dataset can be detached from a jail using the
@@ -1753,7 +1760,7 @@
is one of
.Sy filesystem , snapshot , volume , No or Sy all .
For example, specifying
-.Fl o Cm snapshot
+.Fl t Cm snapshot
displays only snapshots.
.It Fl s Ar property
A property for sorting the output by column in ascending order based on the
@@ -1811,6 +1818,7 @@
.Op Fl r Ns | Ns Fl d Ar depth
.Op Fl Hp
.Op Fl o Ar all | field Ns Op , Ns Ar ...
+.Op Fl t Ar type Ns Op , Ns Ar ...
.Op Fl s Ar source Ns Op , Ns Ar ...
.Ar all | property Ns Op , Ns Ar ...
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
@@ -1871,6 +1879,14 @@
The keyword
.Cm all
specifies all columns.
+.It Fl t Ar type Ns Op , Ns Ar ...
+A comma-separated list of types to display, where
+.Ar type
+is one of
+.Sy filesystem , snapshot , volume , No or Sy all .
+For example, specifying
+.Fl t Cm snapshot
+displays only snapshots.
.It Fl s Ar source Ns Op , Ns Ar ...
A comma-separated list of sources to display. Those properties coming from a
source other than those in this list are ignored. Each source must be one of
@@ -2705,13 +2721,12 @@
From now on this file system tree can be managed from within a jail if the
.Sy jailed
property has been set. To use this functionality, the jail needs the
+.Va allow.mount
+and
+.Va allow.mount.zfs
+parameters set to 1 and the
.Va enforce_statfs
-parameter set to
-.Sy 0
-and the
-.Va allow.mount
-parameter set to
-.Sy 1 .
+parameter set to a value lower than 2.
.Pp
See
.Xr jail 8
diff -r 71c478d74e2f -r aeeb5a674d34 head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
--- a/head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Fri Mar 02 16:55:25 2012 +0200
+++ b/head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Fri Mar 02 16:55:36 2012 +0200
@@ -227,7 +227,8 @@
"<snapshot>[%<snapname>][,...]\n"));
case HELP_GET:
return (gettext("\tget [-rHp] [-d max] "
- "[-o \"all\" | field[,...]] [-s source[,...]]\n"
+ "[-o \"all\" | field[,...]] [-t type[,...]] "
+ "[-s source[,...]]\n"
"\t <\"all\" | property[,...]> "
"[filesystem|volume|snapshot] ...\n"));
case HELP_INHERIT:
@@ -590,7 +591,7 @@
zfs_handle_t *zhp = NULL;
boolean_t parents = B_FALSE;
nvlist_t *props;
- int ret;
+ int ret = 0;
int c;
if (nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0)
@@ -1052,7 +1053,7 @@
static int
destroy_print_snapshots(zfs_handle_t *fs_zhp, destroy_cbdata_t *cb)
{
- int err;
+ int err = 0;
assert(cb->cb_firstsnap == NULL);
assert(cb->cb_prevsnap == NULL);
err = zfs_iter_snapshots_sorted(fs_zhp, destroy_print_cb, cb);
@@ -1130,7 +1131,7 @@
ZFS_TYPE_SNAPSHOT);
if (zhp != NULL) {
boolean_t defer = cb->cb_defer_destroy;
- int err;
+ int err = 0;
/*
* We can't defer destroy non-snapshots, so set it to
@@ -1207,7 +1208,7 @@
at = strchr(argv[0], '@');
if (at != NULL) {
- int err;
+ int err = 0;
/* Build the list of snaps to destroy in cb_nvl. */
if (nvlist_alloc(&cb.cb_nvl, NV_UNIQUE_NAME, 0) != 0)
@@ -1473,8 +1474,9 @@
{
zprop_get_cbdata_t cb = { 0 };
int i, c, flags = ZFS_ITER_ARGS_CAN_BE_PATHS;
+ int types = ZFS_TYPE_DATASET;
char *value, *fields;
- int ret;
+ int ret = 0;
int limit = 0;
zprop_list_t fake_name = { 0 };
@@ -1489,7 +1491,7 @@
cb.cb_type = ZFS_TYPE_DATASET;
/* check options */
- while ((c = getopt(argc, argv, ":d:o:s:rHp")) != -1) {
+ while ((c = getopt(argc, argv, ":d:o:s:rt:Hp")) != -1) {
switch (c) {
case 'p':
cb.cb_literal = B_TRUE;
@@ -1607,6 +1609,37 @@
}
break;
+ case 't':
+ types = 0;
+ flags &= ~ZFS_ITER_PROP_LISTSNAPS;
+ while (*optarg != '\0') {
+ static char *type_subopts[] = { "filesystem",
+ "volume", "snapshot", "all", NULL };
+
+ switch (getsubopt(&optarg, type_subopts,
+ &value)) {
+ case 0:
+ types |= ZFS_TYPE_FILESYSTEM;
+ break;
+ case 1:
+ types |= ZFS_TYPE_VOLUME;
+ break;
+ case 2:
+ types |= ZFS_TYPE_SNAPSHOT;
+ break;
+ case 3:
+ types = ZFS_TYPE_DATASET;
+ break;
+
+ default:
+ (void) fprintf(stderr,
+ gettext("invalid type '%s'\n"),
+ value);
+ usage(B_FALSE);
+ }
+ }
+ break;
+
case '?':
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
optopt);
@@ -1650,7 +1683,7 @@
cb.cb_first = B_TRUE;
/* run for each object */
- ret = zfs_for_each(argc, argv, flags, ZFS_TYPE_DATASET, NULL,
+ ret = zfs_for_each(argc, argv, flags, types, NULL,
&cb.cb_proplist, limit, get_callback, &cb);
if (cb.cb_proplist == &fake_name)
@@ -1711,7 +1744,7 @@
zfs_prop_t prop;
inherit_cbdata_t cb = { 0 };
char *propname;
- int ret;
+ int ret = 0;
int flags = 0;
boolean_t received = B_FALSE;
@@ -1917,7 +1950,7 @@
{
boolean_t all = B_FALSE;
boolean_t showversions = B_FALSE;
- int ret;
+ int ret = 0;
upgrade_cbdata_t cb = { 0 };
char c;
int flags = ZFS_ITER_ARGS_CAN_BE_PATHS;
@@ -2206,7 +2239,7 @@
uid_t id;
uint64_t classes;
#ifdef sun
- int err;
+ int err = 0;
directory_error_t e;
#endif
@@ -2562,7 +2595,7 @@
boolean_t prtnum = B_FALSE;
boolean_t parseable = B_FALSE;
boolean_t sid2posix = B_FALSE;
- int error;
+ int error = 0;
int c;
zfs_sort_column_t *default_sortcol = NULL;
zfs_sort_column_t *sortcol = NULL;
@@ -2925,7 +2958,7 @@
list_cbdata_t cb = { 0 };
char *value;
int limit = 0;
- int ret;
+ int ret = 0;
zfs_sort_column_t *sortcol = NULL;
int flags = ZFS_ITER_PROP_LISTSNAPS | ZFS_ITER_ARGS_CAN_BE_PATHS;
@@ -3062,7 +3095,9 @@
{
zfs_handle_t *zhp;
renameflags_t flags = { 0 };
- int c, ret, types;
+ int c;
+ int ret = 0;
+ int types;
boolean_t parents = B_FALSE;
/* check options */
@@ -3155,7 +3190,7 @@
zfs_do_promote(int argc, char **argv)
{
zfs_handle_t *zhp;
- int ret;
+ int ret = 0;
/* check options */
if (argc > 1 && argv[1][0] == '-') {
@@ -3276,7 +3311,7 @@
static int
zfs_do_rollback(int argc, char **argv)
{
- int ret;
+ int ret = 0;
int c;
boolean_t force = B_FALSE;
rollback_cbdata_t cb = { 0 };
@@ -3394,7 +3429,7 @@
zfs_do_set(int argc, char **argv)
{
set_cbdata_t cb;
- int ret;
+ int ret = 0;
/* check for options */
if (argc > 1 && argv[1][0] == '-') {
@@ -3448,7 +3483,7 @@
zfs_do_snapshot(int argc, char **argv)
{
boolean_t recursive = B_FALSE;
- int ret;
+ int ret = 0;
char c;
nvlist_t *props;
@@ -5286,7 +5321,7 @@
holds_cbdata_t cb = { 0 };
int limit = 0;
- int ret;
+ int ret = 0;
int flags = 0;
/* check options */
@@ -5863,7 +5898,7 @@
unshare_unmount_path(int op, char *path, int flags, boolean_t is_manual)
{
zfs_handle_t *zhp;
- int ret;
+ int ret = 0;
struct stat64 statbuf;
struct extmnttab entry;
const char *cmdname = (op == OP_SHARE) ? "unshare" : "unmount";
@@ -6331,7 +6366,7 @@
zfs_handle_t *zhp;
char mountpoint[ZFS_MAXPROPLEN];
char mntopts[MNT_LINE_MAX] = { '\0' };
- int ret;
+ int ret = 0;
int c;
int flags = 0;
char *dataset, *path;
@@ -6481,7 +6516,7 @@
char *tosnap = NULL;
char *fromsnap = NULL;
char *atp, *copy;
- int err;
+ int err = 0;
int c;
while ((c = getopt(argc, argv, "FHt")) != -1) {
@@ -6551,7 +6586,7 @@
int
main(int argc, char **argv)
{
- int ret;
+ int ret = 0;
int i;
char *progname;
char *cmdname;
More information about the Zrouter-src-freebsd
mailing list