5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
25 * Copyright (c) 2012 by Delphix. All rights reserved.
26 * Copyright (c) 2012 by Frederik Wessels. All rights reserved.
27 * Copyright (c) 2013 by Prasad Joshi (sTec). All rights reserved.
28 */
29
30 #include <assert.h>
31 #include <ctype.h>
32 #include <dirent.h>
33 #include <errno.h>
34 #include <fcntl.h>
35 #include <libgen.h>
36 #include <libintl.h>
37 #include <libuutil.h>
38 #include <locale.h>
39 #include <stdio.h>
40 #include <stdlib.h>
41 #include <string.h>
42 #include <strings.h>
43 #include <unistd.h>
44 #include <priv.h>
45 #include <pwd.h>
859 ret = 1;
860 if (dryrun) {
861 /*
862 * For a dry run invocation, print out a basic message and run
863 * through all the vdevs in the list and print out in an
864 * appropriate hierarchy.
865 */
866 (void) printf(gettext("would create '%s' with the "
867 "following layout:\n\n"), poolname);
868
869 print_vdev_tree(NULL, poolname, nvroot, 0, B_FALSE);
870 if (num_logs(nvroot) > 0)
871 print_vdev_tree(NULL, "logs", nvroot, 0, B_TRUE);
872
873 ret = 0;
874 } else {
875 /*
876 * Hand off to libzfs.
877 */
878 if (enable_all_pool_feat) {
879 int i;
880 for (i = 0; i < SPA_FEATURES; i++) {
881 char propname[MAXPATHLEN];
882 zfeature_info_t *feat = &spa_feature_table[i];
883
884 (void) snprintf(propname, sizeof (propname),
885 "feature@%s", feat->fi_uname);
886
887 /*
888 * Skip feature if user specified it manually
889 * on the command line.
890 */
891 if (nvlist_exists(props, propname))
892 continue;
893
894 ret = add_prop_list(propname,
895 ZFS_FEATURE_ENABLED, &props, B_TRUE);
896 if (ret != 0)
897 goto errout;
898 }
899 }
|
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
25 * Copyright (c) 2013 by Delphix. All rights reserved.
26 * Copyright (c) 2012 by Frederik Wessels. All rights reserved.
27 * Copyright (c) 2013 by Prasad Joshi (sTec). All rights reserved.
28 */
29
30 #include <assert.h>
31 #include <ctype.h>
32 #include <dirent.h>
33 #include <errno.h>
34 #include <fcntl.h>
35 #include <libgen.h>
36 #include <libintl.h>
37 #include <libuutil.h>
38 #include <locale.h>
39 #include <stdio.h>
40 #include <stdlib.h>
41 #include <string.h>
42 #include <strings.h>
43 #include <unistd.h>
44 #include <priv.h>
45 #include <pwd.h>
859 ret = 1;
860 if (dryrun) {
861 /*
862 * For a dry run invocation, print out a basic message and run
863 * through all the vdevs in the list and print out in an
864 * appropriate hierarchy.
865 */
866 (void) printf(gettext("would create '%s' with the "
867 "following layout:\n\n"), poolname);
868
869 print_vdev_tree(NULL, poolname, nvroot, 0, B_FALSE);
870 if (num_logs(nvroot) > 0)
871 print_vdev_tree(NULL, "logs", nvroot, 0, B_TRUE);
872
873 ret = 0;
874 } else {
875 /*
876 * Hand off to libzfs.
877 */
878 if (enable_all_pool_feat) {
879 spa_feature_t i;
880 for (i = 0; i < SPA_FEATURES; i++) {
881 char propname[MAXPATHLEN];
882 zfeature_info_t *feat = &spa_feature_table[i];
883
884 (void) snprintf(propname, sizeof (propname),
885 "feature@%s", feat->fi_uname);
886
887 /*
888 * Skip feature if user specified it manually
889 * on the command line.
890 */
891 if (nvlist_exists(props, propname))
892 continue;
893
894 ret = add_prop_list(propname,
895 ZFS_FEATURE_ENABLED, &props, B_TRUE);
896 if (ret != 0)
897 goto errout;
898 }
899 }
|