| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 The Chromium OS Authors <chromium-os-dev@chromium.org> | 2 * Copyright (C) 2010 The Chromium OS Authors <chromium-os-dev@chromium.org> |
| 3 * | 3 * |
| 4 * Device-Mapper block hash tree interface. | 4 * Device-Mapper block hash tree interface. |
| 5 * See Documentation/device-mapper/dm-bht.txt for details. | 5 * See Documentation/device-mapper/dm-bht.txt for details. |
| 6 * | 6 * |
| 7 * This file is released under the GPLv2. | 7 * This file is released under the GPLv2. |
| 8 */ | 8 */ |
| 9 #ifndef __LINUX_DM_BHT_H | 9 #ifndef __LINUX_DM_BHT_H |
| 10 #define __LINUX_DM_BHT_H | 10 #define __LINUX_DM_BHT_H |
| 11 | 11 |
| 12 #include <linux/compiler.h> | 12 #include <linux/compiler.h> |
| 13 #include <linux/crypto.h> | 13 #include <linux/crypto.h> |
| 14 #include <linux/mempool.h> | 14 #include <linux/mempool.h> |
| 15 #include <linux/types.h> | 15 #include <linux/types.h> |
| 16 | 16 |
| 17 /* To avoid allocating memory for digest tests, we just setup a | 17 /* To avoid allocating memory for digest tests, we just setup a |
| 18 * max to use for now. | 18 * max to use for now. |
| 19 */ | 19 */ |
| 20 #define DM_BHT_MAX_DIGEST_SIZE 128 /* 1k hashes are unlikely for now */ | 20 #define DM_BHT_MAX_DIGEST_SIZE 128 /* 1k hashes are unlikely for now */ |
| 21 | 21 |
| 22 /* UNALLOCATED, PENDING, READY, and VERIFIED are valid states. All other | 22 /* UNALLOCATED, PENDING, READY, and VERIFIED are valid states. All other |
| 23 * values are entry-related return codes. | 23 * values are entry-related return codes. |
| 24 */ | 24 */ |
| 25 #define DM_BHT_ENTRY_VERIFIED 8 /* 'nodes' has been checked against parent */ | 25 #define DM_BHT_ENTRY_VERIFIED 8 /* 'nodes' has been checked against parent */ |
| 26 #define DM_BHT_ENTRY_READY 4 /* 'nodes' is loaded and available */ | 26 #define DM_BHT_ENTRY_READY 4 /* 'nodes' is loaded and available */ |
| 27 #define DM_BHT_ENTRY_PENDING 2 /* 'nodes' is being loaded */ | 27 #define DM_BHT_ENTRY_PENDING 2 /* 'nodes' is being loaded */ |
| 28 #define DM_BHT_ENTRY_REQUESTED 1 /* non-state response indicating entry is | |
| 29 * pending because of the current call | |
| 30 */ | |
| 31 #define DM_BHT_ENTRY_UNALLOCATED 0 /* untouched */ | 28 #define DM_BHT_ENTRY_UNALLOCATED 0 /* untouched */ |
| 32 #define DM_BHT_ENTRY_ERROR -1 /* entry is unsuitable for use */ | 29 #define DM_BHT_ENTRY_ERROR -1 /* entry is unsuitable for use */ |
| 33 #define DM_BHT_ENTRY_ERROR_IO -2 /* I/O error on load */ | 30 #define DM_BHT_ENTRY_ERROR_IO -2 /* I/O error on load */ |
| 34 | 31 |
| 35 /* Additional possible return codes */ | 32 /* Additional possible return codes */ |
| 36 #define DM_BHT_ENTRY_ERROR_MISMATCH -3 /* Digest mismatch */ | 33 #define DM_BHT_ENTRY_ERROR_MISMATCH -3 /* Digest mismatch */ |
| 37 | 34 |
| 38 /* dm_bht_entry | 35 /* dm_bht_entry |
| 39 * Contains dm_bht->node_count tree nodes at a given tree depth. | 36 * Contains dm_bht->node_count tree nodes at a given tree depth. |
| 40 * state is used to transactionally assure that data is paged in | 37 * state is used to transactionally assure that data is paged in |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 */ | 131 */ |
| 135 int dm_bht_compute(struct dm_bht *bht, void *read_cb_ctx); | 132 int dm_bht_compute(struct dm_bht *bht, void *read_cb_ctx); |
| 136 int dm_bht_sync(struct dm_bht *bht, void *write_cb_ctx); | 133 int dm_bht_sync(struct dm_bht *bht, void *write_cb_ctx); |
| 137 int dm_bht_store_block(struct dm_bht *bht, unsigned int block_index, | 134 int dm_bht_store_block(struct dm_bht *bht, unsigned int block_index, |
| 138 u8 *block_data); | 135 u8 *block_data); |
| 139 int dm_bht_zeroread_callback(void *ctx, sector_t start, u8 *dst, sector_t count, | 136 int dm_bht_zeroread_callback(void *ctx, sector_t start, u8 *dst, sector_t count, |
| 140 struct dm_bht_entry *entry); | 137 struct dm_bht_entry *entry); |
| 141 void dm_bht_read_completed(struct dm_bht_entry *entry, int status); | 138 void dm_bht_read_completed(struct dm_bht_entry *entry, int status); |
| 142 void dm_bht_write_completed(struct dm_bht_entry *entry, int status); | 139 void dm_bht_write_completed(struct dm_bht_entry *entry, int status); |
| 143 #endif /* __LINUX_DM_BHT_H */ | 140 #endif /* __LINUX_DM_BHT_H */ |
| OLD | NEW |