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 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 DMCRIT("entry(d=%u,b=%u) is in an error state: %d", | 730 DMCRIT("entry(d=%u,b=%u) is in an error state: %d", |
731 depth, block_index, state); | 731 depth, block_index, state); |
732 DMCRIT("verification is not possible"); | 732 DMCRIT("verification is not possible"); |
733 goto mismatch; | 733 goto mismatch; |
734 } else if (state <= DM_BHT_ENTRY_PENDING) { | 734 } else if (state <= DM_BHT_ENTRY_PENDING) { |
735 DMERR("entry not ready for verify: d=%u,b=%u", | 735 DMERR("entry not ready for verify: d=%u,b=%u", |
736 depth, block_index); | 736 depth, block_index); |
737 goto mismatch; | 737 goto mismatch; |
738 } | 738 } |
739 | 739 |
740 /* At depth 0, we're at the page underneath the root node and | |
741 * leave its validation to a separate path. | |
742 */ | |
743 if (depth == 0) | |
744 break; | |
745 | |
746 /* We need to check that this entry matches the expected | 740 /* We need to check that this entry matches the expected |
747 * hash in the parent->nodes. | 741 * hash in the parent->nodes. |
748 */ | 742 */ |
749 parent = dm_bht_get_entry(bht, depth - 1, block_index); | 743 parent = dm_bht_get_entry(bht, depth - 1, block_index); |
750 /* This call is only safe if all nodes along the path | 744 /* This call is only safe if all nodes along the path |
751 * are already populated (i.e. READY) via dm_bht_populate. | 745 * are already populated (i.e. READY) via dm_bht_populate. |
752 */ | 746 */ |
753 BUG_ON(atomic_read(&parent->state) < DM_BHT_ENTRY_READY); | 747 BUG_ON(atomic_read(&parent->state) < DM_BHT_ENTRY_READY); |
754 node = dm_bht_get_node(bht, parent, depth, block_index); | 748 node = dm_bht_get_node(bht, parent, depth, block_index); |
755 page = virt_to_page(entry->nodes); | 749 page = virt_to_page(entry->nodes); |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1294 DMERR("no root digest exists to export"); | 1288 DMERR("no root digest exists to export"); |
1295 if (available > 0) | 1289 if (available > 0) |
1296 *hexdigest = 0; | 1290 *hexdigest = 0; |
1297 return -1; | 1291 return -1; |
1298 } | 1292 } |
1299 dm_bht_bin_to_hex(bht->root_digest, hexdigest, bht->digest_size); | 1293 dm_bht_bin_to_hex(bht->root_digest, hexdigest, bht->digest_size); |
1300 return 0; | 1294 return 0; |
1301 } | 1295 } |
1302 EXPORT_SYMBOL(dm_bht_root_hexdigest); | 1296 EXPORT_SYMBOL(dm_bht_root_hexdigest); |
1303 | 1297 |
OLD | NEW |