Print this page
grub patch
   1 /*
   2  *  GRUB  --  GRand Unified Bootloader
   3  *  Copyright (C) 1999,2000,2001,2002,2003,2004,2009  Free Software Foundation, Inc.
   4  *
   5  *  GRUB is free software; you can redistribute it and/or modify
   6  *  it under the terms of the GNU General Public License as published by
   7  *  the Free Software Foundation; either version 3 of the License, or
   8  *  (at your option) any later version.
   9  *
  10  *  GRUB is distributed in the hope that it will be useful,
  11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13  *  GNU General Public License for more details.
  14  *
  15  *  You should have received a copy of the GNU General Public License
  16  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  17  */
  18  /*
  19   * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  20   */



  21 
  22 #ifndef GRUB_ZFS_HEADER
  23 #define GRUB_ZFS_HEADER 1
  24 
  25 #include <grub/err.h>
  26 #include <grub/disk.h>
  27 #include <grub/crypto.h>
  28 
  29 typedef enum grub_zfs_endian
  30   {
  31     GRUB_ZFS_UNKNOWN_ENDIAN = -2,
  32     GRUB_ZFS_LITTLE_ENDIAN = -1,
  33     GRUB_ZFS_BIG_ENDIAN = 0
  34   } grub_zfs_endian_t;
  35 
  36 /*
  37  * On-disk version number.
  38  */
  39 #define SPA_VERSION                     33ULL

  40 
  41 /*
  42  * The following are configuration names used in the nvlist describing a pool's
  43  * configuration.
  44  */
  45 #define ZPOOL_CONFIG_VERSION            "version"
  46 #define ZPOOL_CONFIG_POOL_NAME          "name"
  47 #define ZPOOL_CONFIG_POOL_STATE         "state"
  48 #define ZPOOL_CONFIG_POOL_TXG           "txg"
  49 #define ZPOOL_CONFIG_POOL_GUID          "pool_guid"
  50 #define ZPOOL_CONFIG_CREATE_TXG         "create_txg"
  51 #define ZPOOL_CONFIG_TOP_GUID           "top_guid"
  52 #define ZPOOL_CONFIG_VDEV_TREE          "vdev_tree"
  53 #define ZPOOL_CONFIG_TYPE               "type"
  54 #define ZPOOL_CONFIG_CHILDREN           "children"
  55 #define ZPOOL_CONFIG_ID                 "id"
  56 #define ZPOOL_CONFIG_GUID               "guid"
  57 #define ZPOOL_CONFIG_PATH               "path"
  58 #define ZPOOL_CONFIG_DEVID              "devid"
  59 #define ZPOOL_CONFIG_METASLAB_ARRAY     "metaslab_array"


 117 struct grub_zfs_data;
 118 
 119 grub_err_t grub_zfs_fetch_nvlist (grub_device_t dev, char **nvlist);
 120 grub_err_t grub_zfs_getmdnobj (grub_device_t dev, const char *fsfilename,
 121                                grub_uint64_t *mdnobj);
 122 
 123 char *grub_zfs_nvlist_lookup_string (const char *nvlist, const char *name);
 124 char *grub_zfs_nvlist_lookup_nvlist (const char *nvlist, const char *name);
 125 int grub_zfs_nvlist_lookup_uint64 (const char *nvlist, const char *name,
 126                                    grub_uint64_t *out);
 127 char *grub_zfs_nvlist_lookup_nvlist_array (const char *nvlist,
 128                                            const char *name,
 129                                            grub_size_t index);
 130 int grub_zfs_nvlist_lookup_nvlist_array_get_nelm (const char *nvlist,
 131                                                   const char *name);
 132 grub_err_t
 133 grub_zfs_add_key (grub_uint8_t *key_in,
 134                   grub_size_t keylen,
 135                   int passphrase);
 136 


 137 extern grub_err_t (*grub_zfs_decrypt) (grub_crypto_cipher_handle_t cipher,
 138                                        grub_uint64_t algo,
 139                                        void *nonce,
 140                                        char *buf, grub_size_t size,
 141                                        const grub_uint32_t *expected_mac,
 142                                        grub_zfs_endian_t endian);
 143 
 144 struct grub_zfs_key;
 145 
 146 extern grub_crypto_cipher_handle_t (*grub_zfs_load_key) (const struct grub_zfs_key *key,
 147                                                          grub_size_t keysize,
 148                                                          grub_uint64_t salt,
 149                                                          grub_uint64_t algo);
 150 
 151 
 152 
 153 #endif  /* ! GRUB_ZFS_HEADER */
   1 /*
   2  *  GRUB  --  GRand Unified Bootloader
   3  *  Copyright (C) 1999,2000,2001,2002,2003,2004,2009  Free Software Foundation, Inc.
   4  *
   5  *  GRUB is free software; you can redistribute it and/or modify
   6  *  it under the terms of the GNU General Public License as published by
   7  *  the Free Software Foundation; either version 3 of the License, or
   8  *  (at your option) any later version.
   9  *
  10  *  GRUB is distributed in the hope that it will be useful,
  11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13  *  GNU General Public License for more details.
  14  *
  15  *  You should have received a copy of the GNU General Public License
  16  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  17  */
  18  /*
  19   * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  20   */
  21 /*
  22  *  Copyright 2012, Daniil Lunev
  23  */
  24 
  25 #ifndef GRUB_ZFS_HEADER
  26 #define GRUB_ZFS_HEADER 1
  27 
  28 #include <grub/err.h>
  29 #include <grub/disk.h>
  30 #include <grub/crypto.h>
  31 
  32 typedef enum grub_zfs_endian
  33   {
  34     GRUB_ZFS_UNKNOWN_ENDIAN = -2,
  35     GRUB_ZFS_LITTLE_ENDIAN = -1,
  36     GRUB_ZFS_BIG_ENDIAN = 0
  37   } grub_zfs_endian_t;
  38 
  39 /*
  40  * On-disk version number.
  41  */
  42 #define SPA_VERSION                     33ULL
  43 #define SPA_FEATURE_VERSION             5000ULL
  44 
  45 /*
  46  * The following are configuration names used in the nvlist describing a pool's
  47  * configuration.
  48  */
  49 #define ZPOOL_CONFIG_VERSION            "version"
  50 #define ZPOOL_CONFIG_POOL_NAME          "name"
  51 #define ZPOOL_CONFIG_POOL_STATE         "state"
  52 #define ZPOOL_CONFIG_POOL_TXG           "txg"
  53 #define ZPOOL_CONFIG_POOL_GUID          "pool_guid"
  54 #define ZPOOL_CONFIG_CREATE_TXG         "create_txg"
  55 #define ZPOOL_CONFIG_TOP_GUID           "top_guid"
  56 #define ZPOOL_CONFIG_VDEV_TREE          "vdev_tree"
  57 #define ZPOOL_CONFIG_TYPE               "type"
  58 #define ZPOOL_CONFIG_CHILDREN           "children"
  59 #define ZPOOL_CONFIG_ID                 "id"
  60 #define ZPOOL_CONFIG_GUID               "guid"
  61 #define ZPOOL_CONFIG_PATH               "path"
  62 #define ZPOOL_CONFIG_DEVID              "devid"
  63 #define ZPOOL_CONFIG_METASLAB_ARRAY     "metaslab_array"


 121 struct grub_zfs_data;
 122 
 123 grub_err_t grub_zfs_fetch_nvlist (grub_device_t dev, char **nvlist);
 124 grub_err_t grub_zfs_getmdnobj (grub_device_t dev, const char *fsfilename,
 125                                grub_uint64_t *mdnobj);
 126 
 127 char *grub_zfs_nvlist_lookup_string (const char *nvlist, const char *name);
 128 char *grub_zfs_nvlist_lookup_nvlist (const char *nvlist, const char *name);
 129 int grub_zfs_nvlist_lookup_uint64 (const char *nvlist, const char *name,
 130                                    grub_uint64_t *out);
 131 char *grub_zfs_nvlist_lookup_nvlist_array (const char *nvlist,
 132                                            const char *name,
 133                                            grub_size_t index);
 134 int grub_zfs_nvlist_lookup_nvlist_array_get_nelm (const char *nvlist,
 135                                                   const char *name);
 136 grub_err_t
 137 grub_zfs_add_key (grub_uint8_t *key_in,
 138                   grub_size_t keylen,
 139                   int passphrase);
 140 
 141 grub_err_t
 142 get_default_bootfs_obj(grub_device_t dev, char * path, grub_uint64_t * mdnobj);
 143 extern grub_err_t (*grub_zfs_decrypt) (grub_crypto_cipher_handle_t cipher,
 144                                        grub_uint64_t algo,
 145                                        void *nonce,
 146                                        char *buf, grub_size_t size,
 147                                        const grub_uint32_t *expected_mac,
 148                                        grub_zfs_endian_t endian);
 149 
 150 struct grub_zfs_key;
 151 
 152 extern grub_crypto_cipher_handle_t (*grub_zfs_load_key) (const struct grub_zfs_key *key,
 153                                                          grub_size_t keysize,
 154                                                          grub_uint64_t salt,
 155                                                          grub_uint64_t algo);
 156 
 157 
 158 
 159 #endif  /* ! GRUB_ZFS_HEADER */