Print this page
4185 New hash algorithm support

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/sys/spa.h
          +++ new/usr/src/uts/common/fs/zfs/sys/spa.h
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   * Copyright (c) 2012 by Delphix. All rights reserved.
  24   24   * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
       25 + * Copyright 2013 Saso Kiselkov. All rights reserved.
  25   26   */
  26   27  
  27   28  #ifndef _SYS_SPA_H
  28   29  #define _SYS_SPA_H
  29   30  
  30   31  #include <sys/avl.h>
  31   32  #include <sys/zfs_context.h>
  32   33  #include <sys/nvpair.h>
  33   34  #include <sys/sysmacros.h>
  34   35  #include <sys/types.h>
↓ open down ↓ 11 lines elided ↑ open up ↑
  46   47  typedef struct metaslab metaslab_t;
  47   48  typedef struct metaslab_group metaslab_group_t;
  48   49  typedef struct metaslab_class metaslab_class_t;
  49   50  typedef struct zio zio_t;
  50   51  typedef struct zilog zilog_t;
  51   52  typedef struct spa_aux_vdev spa_aux_vdev_t;
  52   53  typedef struct ddt ddt_t;
  53   54  typedef struct ddt_entry ddt_entry_t;
  54   55  struct dsl_pool;
  55   56  struct dsl_dataset;
       57 +struct zfeature_info;
  56   58  
  57   59  /*
  58   60   * General-purpose 32-bit and 64-bit bitfield encodings.
  59   61   */
  60   62  #define BF32_DECODE(x, low, len)        P2PHASE((x) >> (low), 1U << (len))
  61   63  #define BF64_DECODE(x, low, len)        P2PHASE((x) >> (low), 1ULL << (len))
  62   64  #define BF32_ENCODE(x, low, len)        (P2PHASE((x), 1U << (len)) << (low))
  63   65  #define BF64_ENCODE(x, low, len)        (P2PHASE((x), 1ULL << (len)) << (low))
  64   66  
  65   67  #define BF32_GET(x, low, len)           BF32_DECODE(x, low, len)
↓ open down ↓ 51 lines elided ↑ open up ↑
 117  119  } dva_t;
 118  120  
 119  121  /*
 120  122   * Each block has a 256-bit checksum -- strong enough for cryptographic hashes.
 121  123   */
 122  124  typedef struct zio_cksum {
 123  125          uint64_t        zc_word[4];
 124  126  } zio_cksum_t;
 125  127  
 126  128  /*
      129 + * Some checksums/hashes need a 256-bit initialization salt. This salt is kept
      130 + * secret and is suitable for use in MAC algorithms as the key.
      131 + */
      132 +typedef struct zio_cksum_salt {
      133 +        uint8_t         zcs_bytes[32];
      134 +} zio_cksum_salt_t;
      135 +
      136 +/*
 127  137   * Each block is described by its DVAs, time of birth, checksum, etc.
 128  138   * The word-by-word, bit-by-bit layout of the blkptr is as follows:
 129  139   *
 130  140   *      64      56      48      40      32      24      16      8       0
 131  141   *      +-------+-------+-------+-------+-------+-------+-------+-------+
 132  142   * 0    |               vdev1           | GRID  |         ASIZE         |
 133  143   *      +-------+-------+-------+-------+-------+-------+-------+-------+
 134  144   * 1    |G|                      offset1                                |
 135  145   *      +-------+-------+-------+-------+-------+-------+-------+-------+
 136  146   * 2    |               vdev2           | GRID  |         ASIZE         |
↓ open down ↓ 479 lines elided ↑ open up ↑
 616  626  extern vdev_t *spa_lookup_by_guid(spa_t *spa, uint64_t guid,
 617  627      boolean_t l2cache);
 618  628  extern boolean_t spa_has_spare(spa_t *, uint64_t guid);
 619  629  extern uint64_t dva_get_dsize_sync(spa_t *spa, const dva_t *dva);
 620  630  extern uint64_t bp_get_dsize_sync(spa_t *spa, const blkptr_t *bp);
 621  631  extern uint64_t bp_get_dsize(spa_t *spa, const blkptr_t *bp);
 622  632  extern boolean_t spa_has_slogs(spa_t *spa);
 623  633  extern boolean_t spa_is_root(spa_t *spa);
 624  634  extern boolean_t spa_writeable(spa_t *spa);
 625  635  
      636 +/* Salted checksum handling */
      637 +extern int spa_activate_salted_cksum(spa_t *spa, struct zfeature_info *feature);
      638 +
 626  639  extern int spa_mode(spa_t *spa);
 627  640  extern uint64_t strtonum(const char *str, char **nptr);
 628  641  
 629  642  extern char *spa_his_ievent_table[];
 630  643  
 631  644  extern void spa_history_create_obj(spa_t *spa, dmu_tx_t *tx);
 632  645  extern int spa_history_get(spa_t *spa, uint64_t *offset, uint64_t *len_read,
 633  646      char *his_buf);
 634  647  extern int spa_history_log(spa_t *spa, const char *his_buf);
 635  648  extern int spa_history_log_nvl(spa_t *spa, nvlist_t *nvl);
↓ open down ↓ 68 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX