Commit 018cede93c987273071aed153b6d207e0af5e868

Authored by Mike Snitzer
Committed by Alasdair G Kergon
1 parent e4c938111f

dm persistent data: set some btree fn parms const

Mark some constant parameters constant in some dm-btree functions.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>

Showing 2 changed files with 9 additions and 9 deletions Side-by-side Diff

drivers/md/dm-thin-metadata.c
... ... @@ -280,7 +280,7 @@
280 280 *t = v & ((1 << 24) - 1);
281 281 }
282 282  
283   -static void data_block_inc(void *context, void *value_le)
  283 +static void data_block_inc(void *context, const void *value_le)
284 284 {
285 285 struct dm_space_map *sm = context;
286 286 __le64 v_le;
... ... @@ -292,7 +292,7 @@
292 292 dm_sm_inc_block(sm, b);
293 293 }
294 294  
295   -static void data_block_dec(void *context, void *value_le)
  295 +static void data_block_dec(void *context, const void *value_le)
296 296 {
297 297 struct dm_space_map *sm = context;
298 298 __le64 v_le;
... ... @@ -304,7 +304,7 @@
304 304 dm_sm_dec_block(sm, b);
305 305 }
306 306  
307   -static int data_block_equal(void *context, void *value1_le, void *value2_le)
  307 +static int data_block_equal(void *context, const void *value1_le, const void *value2_le)
308 308 {
309 309 __le64 v1_le, v2_le;
310 310 uint64_t b1, b2;
... ... @@ -318,7 +318,7 @@
318 318 return b1 == b2;
319 319 }
320 320  
321   -static void subtree_inc(void *context, void *value)
  321 +static void subtree_inc(void *context, const void *value)
322 322 {
323 323 struct dm_btree_info *info = context;
324 324 __le64 root_le;
... ... @@ -329,7 +329,7 @@
329 329 dm_tm_inc(info->tm, root);
330 330 }
331 331  
332   -static void subtree_dec(void *context, void *value)
  332 +static void subtree_dec(void *context, const void *value)
333 333 {
334 334 struct dm_btree_info *info = context;
335 335 __le64 root_le;
... ... @@ -341,7 +341,7 @@
341 341 DMERR("btree delete failed\n");
342 342 }
343 343  
344   -static int subtree_equal(void *context, void *value1_le, void *value2_le)
  344 +static int subtree_equal(void *context, const void *value1_le, const void *value2_le)
345 345 {
346 346 __le64 v1_le, v2_le;
347 347 memcpy(&v1_le, value1_le, sizeof(v1_le));
drivers/md/persistent-data/dm-btree.h
... ... @@ -58,21 +58,21 @@
58 58 * somewhere.) This method is _not_ called for insertion of a new
59 59 * value: It is assumed the ref count is already 1.
60 60 */
61   - void (*inc)(void *context, void *value);
  61 + void (*inc)(void *context, const void *value);
62 62  
63 63 /*
64 64 * This value is being deleted. The btree takes care of freeing
65 65 * the memory pointed to by @value. Often the del function just
66 66 * needs to decrement a reference count somewhere.
67 67 */
68   - void (*dec)(void *context, void *value);
  68 + void (*dec)(void *context, const void *value);
69 69  
70 70 /*
71 71 * A test for equality between two values. When a value is
72 72 * overwritten with a new one, the old one has the dec method
73 73 * called _unless_ the new and old value are deemed equal.
74 74 */
75   - int (*equal)(void *context, void *value1, void *value2);
  75 + int (*equal)(void *context, const void *value1, const void *value2);
76 76 };
77 77  
78 78 /*