Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(617)

Side by Side Diff: dm-bht.c

Issue 6705014: verity: remove verify_mode (Closed) Base URL: http://git.chromium.org/git/dm-verity.git@master
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dm-bht.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 } 300 }
301 301
302 /* Setup callback stubs */ 302 /* Setup callback stubs */
303 bht->read_cb = &dm_bht_read_callback_stub; 303 bht->read_cb = &dm_bht_read_callback_stub;
304 bht->write_cb = &dm_bht_write_callback_stub; 304 bht->write_cb = &dm_bht_write_callback_stub;
305 305
306 status = dm_bht_initialize_entries(bht); 306 status = dm_bht_initialize_entries(bht);
307 if (status) 307 if (status)
308 goto bad_entries_alloc; 308 goto bad_entries_alloc;
309 309
310 bht->verify_mode = DM_BHT_REVERIFY_LEAVES;
311 bht->entry_readahead = 0; 310 bht->entry_readahead = 0;
312 return 0; 311 return 0;
313 312
314 bad_entries_alloc: 313 bad_entries_alloc:
315 while (bht->depth-- > 0) 314 while (bht->depth-- > 0)
316 kfree(bht->levels[bht->depth].entries); 315 kfree(bht->levels[bht->depth].entries);
317 bad_node_count: 316 bad_node_count:
318 kfree(bht->levels); 317 kfree(bht->levels);
319 bad_level_alloc: 318 bad_level_alloc:
320 bad_block_count: 319 bad_block_count:
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 node = dm_bht_get_node(bht, parent, depth, block_index); 719 node = dm_bht_get_node(bht, parent, depth, block_index);
721 page = virt_to_page(entry->nodes); 720 page = virt_to_page(entry->nodes);
722 721
723 if (dm_bht_compute_hash(bht, page, digest) || 722 if (dm_bht_compute_hash(bht, page, digest) ||
724 dm_bht_compare_hash(bht, digest, node)) { 723 dm_bht_compare_hash(bht, digest, node)) {
725 DMERR("failed to verify entry's hash against parent " 724 DMERR("failed to verify entry's hash against parent "
726 "(d=%u,bi=%u)", depth, block_index); 725 "(d=%u,bi=%u)", depth, block_index);
727 goto mismatch; 726 goto mismatch;
728 } 727 }
729 728
730 » » if (bht->verify_mode != DM_BHT_FULL_REVERIFY) 729 » » atomic_cmpxchg(&entry->state,
731 » » » atomic_cmpxchg(&entry->state, 730 » » » DM_BHT_ENTRY_READY,
732 » » » » DM_BHT_ENTRY_READY, 731 » » » DM_BHT_ENTRY_VERIFIED);
733 » » » » DM_BHT_ENTRY_VERIFIED);
734 732
735 entry = parent; 733 entry = parent;
736 depth--; 734 depth--;
737 } 735 }
738 736
739 return 0; 737 return 0;
740 738
741 mismatch: 739 mismatch:
742 return DM_BHT_ENTRY_ERROR_MISMATCH; 740 return DM_BHT_ENTRY_ERROR_MISMATCH;
743 } 741 }
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 * @bht: pointer to a dm_bht_create()d bht 1160 * @bht: pointer to a dm_bht_create()d bht
1163 * @write_cb: callback function used for all write requests by @bht 1161 * @write_cb: callback function used for all write requests by @bht
1164 */ 1162 */
1165 void dm_bht_set_write_cb(struct dm_bht *bht, dm_bht_callback write_cb) 1163 void dm_bht_set_write_cb(struct dm_bht *bht, dm_bht_callback write_cb)
1166 { 1164 {
1167 bht->write_cb = write_cb; 1165 bht->write_cb = write_cb;
1168 } 1166 }
1169 EXPORT_SYMBOL(dm_bht_set_write_cb); 1167 EXPORT_SYMBOL(dm_bht_set_write_cb);
1170 1168
1171 /** 1169 /**
1172 * dm_bht_set_verify_mode - set verify mode
1173 * @bht: pointer to a dm_bht_create()d bht
1174 * @verify_mode: indicate verification behavior
1175 */
1176 void dm_bht_set_verify_mode(struct dm_bht *bht, int verify_mode)
1177 {
1178 bht->verify_mode = verify_mode;
1179 }
1180 EXPORT_SYMBOL(dm_bht_set_verify_mode);
1181
1182 /**
1183 * dm_bht_set_entry_readahead - set verify mode 1170 * dm_bht_set_entry_readahead - set verify mode
1184 * @bht: pointer to a dm_bht_create()d bht 1171 * @bht: pointer to a dm_bht_create()d bht
1185 * @readahead_count: number of entries to readahead from a given level 1172 * @readahead_count: number of entries to readahead from a given level
1186 */ 1173 */
1187 void dm_bht_set_entry_readahead(struct dm_bht *bht, 1174 void dm_bht_set_entry_readahead(struct dm_bht *bht,
1188 unsigned int readahead_count) 1175 unsigned int readahead_count)
1189 { 1176 {
1190 bht->entry_readahead = readahead_count; 1177 bht->entry_readahead = readahead_count;
1191 } 1178 }
1192 EXPORT_SYMBOL(dm_bht_set_entry_readahead); 1179 EXPORT_SYMBOL(dm_bht_set_entry_readahead);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 DMERR("no root digest exists to export"); 1226 DMERR("no root digest exists to export");
1240 if (available > 0) 1227 if (available > 0)
1241 *hexdigest = 0; 1228 *hexdigest = 0;
1242 return -1; 1229 return -1;
1243 } 1230 }
1244 dm_bht_bin_to_hex(bht->root_digest, hexdigest, bht->digest_size); 1231 dm_bht_bin_to_hex(bht->root_digest, hexdigest, bht->digest_size);
1245 return 0; 1232 return 0;
1246 } 1233 }
1247 EXPORT_SYMBOL(dm_bht_root_hexdigest); 1234 EXPORT_SYMBOL(dm_bht_root_hexdigest);
1248 1235
OLDNEW
« no previous file with comments | « dm-bht.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698