Print this page
%B


   4  * The contents of this file are subject to the terms of the
   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  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2011 by Delphix. All rights reserved.

  24  */
  25 
  26 /* Portions Copyright 2010 Robert Milkowski */
  27 
  28 #include <sys/zio.h>
  29 #include <sys/spa.h>
  30 #include <sys/u8_textprep.h>
  31 #include <sys/zfs_acl.h>
  32 #include <sys/zfs_ioctl.h>
  33 #include <sys/zfs_znode.h>
  34 
  35 #include "zfs_prop.h"
  36 #include "zfs_deleg.h"
  37 
  38 #if defined(_KERNEL)
  39 #include <sys/systm.h>
  40 #else
  41 #include <stdlib.h>
  42 #include <string.h>
  43 #include <ctype.h>


  79                 { "sha256,verify",
  80                                 ZIO_CHECKSUM_SHA256 | ZIO_CHECKSUM_VERIFY },
  81                 { NULL }
  82         };
  83 
  84         static zprop_index_t compress_table[] = {
  85                 { "on",         ZIO_COMPRESS_ON },
  86                 { "off",        ZIO_COMPRESS_OFF },
  87                 { "lzjb",       ZIO_COMPRESS_LZJB },
  88                 { "gzip",       ZIO_COMPRESS_GZIP_6 },  /* gzip default */
  89                 { "gzip-1",     ZIO_COMPRESS_GZIP_1 },
  90                 { "gzip-2",     ZIO_COMPRESS_GZIP_2 },
  91                 { "gzip-3",     ZIO_COMPRESS_GZIP_3 },
  92                 { "gzip-4",     ZIO_COMPRESS_GZIP_4 },
  93                 { "gzip-5",     ZIO_COMPRESS_GZIP_5 },
  94                 { "gzip-6",     ZIO_COMPRESS_GZIP_6 },
  95                 { "gzip-7",     ZIO_COMPRESS_GZIP_7 },
  96                 { "gzip-8",     ZIO_COMPRESS_GZIP_8 },
  97                 { "gzip-9",     ZIO_COMPRESS_GZIP_9 },
  98                 { "zle",        ZIO_COMPRESS_ZLE },


  99                 { NULL }
 100         };
 101 
 102         static zprop_index_t snapdir_table[] = {
 103                 { "hidden",     ZFS_SNAPDIR_HIDDEN },
 104                 { "visible",    ZFS_SNAPDIR_VISIBLE },
 105                 { NULL }
 106         };
 107 
 108         static zprop_index_t acl_mode_table[] = {
 109                 { "discard",    ZFS_ACL_DISCARD },
 110                 { "groupmask",  ZFS_ACL_GROUPMASK },
 111                 { "passthrough", ZFS_ACL_PASSTHROUGH },
 112                 { "restricted", ZFS_ACL_RESTRICTED },
 113                 { NULL }
 114         };
 115 
 116         static zprop_index_t acl_inherit_table[] = {
 117                 { "discard",    ZFS_ACL_DISCARD },
 118                 { "noallow",    ZFS_ACL_NOALLOW },


 194                 { NULL }
 195         };
 196 
 197         /* inherit index properties */
 198         zprop_register_index(ZFS_PROP_SYNC, "sync", ZFS_SYNC_STANDARD,
 199             PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
 200             "standard | always | disabled", "SYNC",
 201             sync_table);
 202         zprop_register_index(ZFS_PROP_CHECKSUM, "checksum",
 203             ZIO_CHECKSUM_DEFAULT, PROP_INHERIT, ZFS_TYPE_FILESYSTEM |
 204             ZFS_TYPE_VOLUME,
 205             "on | off | fletcher2 | fletcher4 | sha256", "CHECKSUM",
 206             checksum_table);
 207         zprop_register_index(ZFS_PROP_DEDUP, "dedup", ZIO_CHECKSUM_OFF,
 208             PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
 209             "on | off | verify | sha256[,verify]", "DEDUP",
 210             dedup_table);
 211         zprop_register_index(ZFS_PROP_COMPRESSION, "compression",
 212             ZIO_COMPRESS_DEFAULT, PROP_INHERIT,
 213             ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
 214             "on | off | lzjb | gzip | gzip-[1-9] | zle", "COMPRESS",
 215             compress_table);
 216         zprop_register_index(ZFS_PROP_SNAPDIR, "snapdir", ZFS_SNAPDIR_HIDDEN,
 217             PROP_INHERIT, ZFS_TYPE_FILESYSTEM,
 218             "hidden | visible", "SNAPDIR", snapdir_table);
 219         zprop_register_index(ZFS_PROP_ACLMODE, "aclmode", ZFS_ACL_DISCARD,
 220             PROP_INHERIT, ZFS_TYPE_FILESYSTEM,
 221             "discard | groupmask | passthrough | restricted", "ACLMODE",
 222             acl_mode_table);
 223         zprop_register_index(ZFS_PROP_ACLINHERIT, "aclinherit",
 224             ZFS_ACL_RESTRICTED, PROP_INHERIT, ZFS_TYPE_FILESYSTEM,
 225             "discard | noallow | restricted | passthrough | passthrough-x",
 226             "ACLINHERIT", acl_inherit_table);
 227         zprop_register_index(ZFS_PROP_COPIES, "copies", 1, PROP_INHERIT,
 228             ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
 229             "1 | 2 | 3", "COPIES", copies_table);
 230         zprop_register_index(ZFS_PROP_PRIMARYCACHE, "primarycache",
 231             ZFS_CACHE_ALL, PROP_INHERIT,
 232             ZFS_TYPE_FILESYSTEM | ZFS_TYPE_SNAPSHOT | ZFS_TYPE_VOLUME,
 233             "all | none | metadata", "PRIMARYCACHE", cache_table);
 234         zprop_register_index(ZFS_PROP_SECONDARYCACHE, "secondarycache",
 235             ZFS_CACHE_ALL, PROP_INHERIT,




   4  * The contents of this file are subject to the terms of the
   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  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2011 by Delphix. All rights reserved.
  24  * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
  25  */
  26 
  27 /* Portions Copyright 2010 Robert Milkowski */
  28 
  29 #include <sys/zio.h>
  30 #include <sys/spa.h>
  31 #include <sys/u8_textprep.h>
  32 #include <sys/zfs_acl.h>
  33 #include <sys/zfs_ioctl.h>
  34 #include <sys/zfs_znode.h>
  35 
  36 #include "zfs_prop.h"
  37 #include "zfs_deleg.h"
  38 
  39 #if defined(_KERNEL)
  40 #include <sys/systm.h>
  41 #else
  42 #include <stdlib.h>
  43 #include <string.h>
  44 #include <ctype.h>


  80                 { "sha256,verify",
  81                                 ZIO_CHECKSUM_SHA256 | ZIO_CHECKSUM_VERIFY },
  82                 { NULL }
  83         };
  84 
  85         static zprop_index_t compress_table[] = {
  86                 { "on",         ZIO_COMPRESS_ON },
  87                 { "off",        ZIO_COMPRESS_OFF },
  88                 { "lzjb",       ZIO_COMPRESS_LZJB },
  89                 { "gzip",       ZIO_COMPRESS_GZIP_6 },  /* gzip default */
  90                 { "gzip-1",     ZIO_COMPRESS_GZIP_1 },
  91                 { "gzip-2",     ZIO_COMPRESS_GZIP_2 },
  92                 { "gzip-3",     ZIO_COMPRESS_GZIP_3 },
  93                 { "gzip-4",     ZIO_COMPRESS_GZIP_4 },
  94                 { "gzip-5",     ZIO_COMPRESS_GZIP_5 },
  95                 { "gzip-6",     ZIO_COMPRESS_GZIP_6 },
  96                 { "gzip-7",     ZIO_COMPRESS_GZIP_7 },
  97                 { "gzip-8",     ZIO_COMPRESS_GZIP_8 },
  98                 { "gzip-9",     ZIO_COMPRESS_GZIP_9 },
  99                 { "zle",        ZIO_COMPRESS_ZLE },
 100                 { "lz4",        ZIO_COMPRESS_LZ4 },
 101                 { "lz4hc",      ZIO_COMPRESS_LZ4HC },
 102                 { NULL }
 103         };
 104 
 105         static zprop_index_t snapdir_table[] = {
 106                 { "hidden",     ZFS_SNAPDIR_HIDDEN },
 107                 { "visible",    ZFS_SNAPDIR_VISIBLE },
 108                 { NULL }
 109         };
 110 
 111         static zprop_index_t acl_mode_table[] = {
 112                 { "discard",    ZFS_ACL_DISCARD },
 113                 { "groupmask",  ZFS_ACL_GROUPMASK },
 114                 { "passthrough", ZFS_ACL_PASSTHROUGH },
 115                 { "restricted", ZFS_ACL_RESTRICTED },
 116                 { NULL }
 117         };
 118 
 119         static zprop_index_t acl_inherit_table[] = {
 120                 { "discard",    ZFS_ACL_DISCARD },
 121                 { "noallow",    ZFS_ACL_NOALLOW },


 197                 { NULL }
 198         };
 199 
 200         /* inherit index properties */
 201         zprop_register_index(ZFS_PROP_SYNC, "sync", ZFS_SYNC_STANDARD,
 202             PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
 203             "standard | always | disabled", "SYNC",
 204             sync_table);
 205         zprop_register_index(ZFS_PROP_CHECKSUM, "checksum",
 206             ZIO_CHECKSUM_DEFAULT, PROP_INHERIT, ZFS_TYPE_FILESYSTEM |
 207             ZFS_TYPE_VOLUME,
 208             "on | off | fletcher2 | fletcher4 | sha256", "CHECKSUM",
 209             checksum_table);
 210         zprop_register_index(ZFS_PROP_DEDUP, "dedup", ZIO_CHECKSUM_OFF,
 211             PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
 212             "on | off | verify | sha256[,verify]", "DEDUP",
 213             dedup_table);
 214         zprop_register_index(ZFS_PROP_COMPRESSION, "compression",
 215             ZIO_COMPRESS_DEFAULT, PROP_INHERIT,
 216             ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
 217             "on | off | lzjb | gzip | gzip-[1-9] | zle | lz4 | lz4hc",
 218             "COMPRESS", compress_table);
 219         zprop_register_index(ZFS_PROP_SNAPDIR, "snapdir", ZFS_SNAPDIR_HIDDEN,
 220             PROP_INHERIT, ZFS_TYPE_FILESYSTEM,
 221             "hidden | visible", "SNAPDIR", snapdir_table);
 222         zprop_register_index(ZFS_PROP_ACLMODE, "aclmode", ZFS_ACL_DISCARD,
 223             PROP_INHERIT, ZFS_TYPE_FILESYSTEM,
 224             "discard | groupmask | passthrough | restricted", "ACLMODE",
 225             acl_mode_table);
 226         zprop_register_index(ZFS_PROP_ACLINHERIT, "aclinherit",
 227             ZFS_ACL_RESTRICTED, PROP_INHERIT, ZFS_TYPE_FILESYSTEM,
 228             "discard | noallow | restricted | passthrough | passthrough-x",
 229             "ACLINHERIT", acl_inherit_table);
 230         zprop_register_index(ZFS_PROP_COPIES, "copies", 1, PROP_INHERIT,
 231             ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
 232             "1 | 2 | 3", "COPIES", copies_table);
 233         zprop_register_index(ZFS_PROP_PRIMARYCACHE, "primarycache",
 234             ZFS_CACHE_ALL, PROP_INHERIT,
 235             ZFS_TYPE_FILESYSTEM | ZFS_TYPE_SNAPSHOT | ZFS_TYPE_VOLUME,
 236             "all | none | metadata", "PRIMARYCACHE", cache_table);
 237         zprop_register_index(ZFS_PROP_SECONDARYCACHE, "secondarycache",
 238             ZFS_CACHE_ALL, PROP_INHERIT,