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 GPL. | 7 * This file is released under the GPL. |
8 */ | 8 */ |
9 | 9 |
10 #include <asm/atomic.h> | 10 #include <asm/atomic.h> |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 static int dm_bht_compute_hash(struct dm_bht *bht, const void *block, | 98 static int dm_bht_compute_hash(struct dm_bht *bht, const void *block, |
99 u8 *digest) | 99 u8 *digest) |
100 { | 100 { |
101 struct hash_desc *hash_desc = &bht->hash_desc[smp_processor_id()]; | 101 struct hash_desc *hash_desc = &bht->hash_desc[smp_processor_id()]; |
102 struct scatterlist sg; | 102 struct scatterlist sg; |
103 | 103 |
104 /* TODO(msb): Once we supporting block_size < PAGE_SIZE, change this to: | 104 /* TODO(msb): Once we supporting block_size < PAGE_SIZE, change this to: |
105 * offset_into_page + length < page_size | 105 * offset_into_page + length < page_size |
106 * For now just check that block is page-aligned. | 106 * For now just check that block is page-aligned. |
107 */ | 107 */ |
108 » BUG_ON(!IS_ALIGNED((uintptr_t)block, PAGE_SIZE)); | 108 » /* |
| 109 » * TODO(msb): Re-enable once user-space code is modified to use |
| 110 » * aligned buffers. |
| 111 » * BUG_ON(!IS_ALIGNED((uintptr_t)block, PAGE_SIZE)); |
| 112 » */ |
109 | 113 |
110 sg_init_table(&sg, 1); | 114 sg_init_table(&sg, 1); |
111 sg_set_buf(&sg, block, PAGE_SIZE); | 115 sg_set_buf(&sg, block, PAGE_SIZE); |
112 /* Note, this is synchronous. */ | 116 /* Note, this is synchronous. */ |
113 if (crypto_hash_init(hash_desc)) { | 117 if (crypto_hash_init(hash_desc)) { |
114 DMCRIT("failed to reinitialize crypto hash (proc:%d)", | 118 DMCRIT("failed to reinitialize crypto hash (proc:%d)", |
115 smp_processor_id()); | 119 smp_processor_id()); |
116 return -EINVAL; | 120 return -EINVAL; |
117 } | 121 } |
118 if (crypto_hash_digest(hash_desc, &sg, PAGE_SIZE, digest)) { | 122 if (crypto_hash_digest(hash_desc, &sg, PAGE_SIZE, digest)) { |
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 DMERR("no root digest exists to export"); | 1187 DMERR("no root digest exists to export"); |
1184 if (available > 0) | 1188 if (available > 0) |
1185 *hexdigest = 0; | 1189 *hexdigest = 0; |
1186 return -1; | 1190 return -1; |
1187 } | 1191 } |
1188 dm_bht_bin_to_hex(bht->root_digest, hexdigest, bht->digest_size); | 1192 dm_bht_bin_to_hex(bht->root_digest, hexdigest, bht->digest_size); |
1189 return 0; | 1193 return 0; |
1190 } | 1194 } |
1191 EXPORT_SYMBOL(dm_bht_root_hexdigest); | 1195 EXPORT_SYMBOL(dm_bht_root_hexdigest); |
1192 | 1196 |
OLD | NEW |