summaryrefslogtreecommitdiffstats
path: root/test/cache_common.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2017-01-28 07:18:47 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2017-01-28 07:18:47 (GMT)
commit5a776edb8156c36d3a7e2f9e23c6fb349eaa90e0 (patch)
treeedac722d8967c46baf1c503369e9cf5db3605283 /test/cache_common.c
parent349f41d9740d1e4a1e86704b3c8a30c700d1de78 (diff)
downloadhdf5-5a776edb8156c36d3a7e2f9e23c6fb349eaa90e0.zip
hdf5-5a776edb8156c36d3a7e2f9e23c6fb349eaa90e0.tar.gz
hdf5-5a776edb8156c36d3a7e2f9e23c6fb349eaa90e0.tar.bz2
Bring change to use array of metadata cache entry classes for H5C_create
instead of array of class names from cache image branch.
Diffstat (limited to 'test/cache_common.c')
-rw-r--r--test/cache_common.c121
1 files changed, 64 insertions, 57 deletions
diff --git a/test/cache_common.c b/test/cache_common.c
index 1321968..59328f7 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -288,27 +288,9 @@ const haddr_t alt_base_addrs[NUMBER_OF_ENTRY_TYPES] =
NOTIFY_ALT_BASE_ADDR
};
-const char *entry_type_names[NUMBER_OF_ENTRY_TYPES] =
-{
- "pico entries -- 1 B",
- "nano entries -- 4 B",
- "micro entries -- 16 B",
- "tiny entries -- 64 B",
- "small entries -- 256 B",
- "medium entries -- 1 KB",
- "large entries -- 4 KB",
- "huge entries -- 16 KB",
- "monster entries -- 64 KB",
- "variable entries -- 1B - 10KB",
- "notify entries -- 1B"
-};
-
-/* callback table declaration */
-
-const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
-{
- {
+/* Callback classes */
+static const H5C_class_t pico_class[1] = {{
PICO_ENTRY_TYPE,
"pico_entry",
H5FD_MEM_DEFAULT,
@@ -323,8 +305,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
NULL,
pico_free_icr,
NULL,
- },
- {
+}};
+
+static const H5C_class_t nano_class[1] = {{
NANO_ENTRY_TYPE,
"nano_entry",
H5FD_MEM_DEFAULT,
@@ -339,8 +322,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
NULL,
nano_free_icr,
NULL,
- },
- {
+}};
+
+static const H5C_class_t micro_class[1] = {{
MICRO_ENTRY_TYPE,
"micro_entry",
H5FD_MEM_DEFAULT,
@@ -355,8 +339,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
NULL,
micro_free_icr,
NULL,
- },
- {
+}};
+
+static const H5C_class_t tiny_class[1] = {{
TINY_ENTRY_TYPE,
"tiny_entry",
H5FD_MEM_DEFAULT,
@@ -371,8 +356,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
NULL,
tiny_free_icr,
NULL,
- },
- {
+}};
+
+static const H5C_class_t small_class[1] = {{
SMALL_ENTRY_TYPE,
"small_entry",
H5FD_MEM_DEFAULT,
@@ -387,8 +373,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
NULL,
small_free_icr,
NULL,
- },
- {
+}};
+
+static const H5C_class_t medium_class[1] = {{
MEDIUM_ENTRY_TYPE,
"medium_entry",
H5FD_MEM_DEFAULT,
@@ -403,8 +390,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
NULL,
medium_free_icr,
NULL,
- },
- {
+}};
+
+static const H5C_class_t large_class[1] = {{
LARGE_ENTRY_TYPE,
"large_entry",
H5FD_MEM_DEFAULT,
@@ -419,8 +407,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
NULL,
large_free_icr,
NULL,
- },
- {
+}};
+
+static const H5C_class_t huge_class[1] = {{
HUGE_ENTRY_TYPE,
"huge_entry",
H5FD_MEM_DEFAULT,
@@ -435,8 +424,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
NULL,
huge_free_icr,
NULL,
- },
- {
+}};
+
+static const H5C_class_t monster_class[1] = {{
MONSTER_ENTRY_TYPE,
"monster_entry",
H5FD_MEM_DEFAULT,
@@ -451,8 +441,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
NULL,
monster_free_icr,
NULL,
- },
- {
+}};
+
+static const H5C_class_t variable_class[1] = {{
VARIABLE_ENTRY_TYPE,
"variable_entry",
H5FD_MEM_DEFAULT,
@@ -467,8 +458,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
NULL,
variable_free_icr,
NULL,
- },
- {
+}};
+
+static const H5C_class_t notify_class[1] = {{
NOTIFY_ENTRY_TYPE,
"notify_entry",
H5FD_MEM_DEFAULT,
@@ -483,7 +475,22 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
notify_notify,
notify_free_icr,
NULL,
- }
+}};
+
+/* callback table declaration */
+
+const H5C_class_t *types[NUMBER_OF_ENTRY_TYPES] = {
+ pico_class,
+ nano_class,
+ micro_class,
+ tiny_class,
+ small_class,
+ medium_class,
+ large_class,
+ huge_class,
+ monster_class,
+ variable_class,
+ notify_class
};
/* address translation functions: */
@@ -3300,7 +3307,7 @@ setup_cache(size_t max_cache_size,
cache_ptr = H5C_create(max_cache_size,
min_clean_size,
(NUMBER_OF_ENTRY_TYPES - 1),
- (const char **)entry_type_names,
+ types,
check_write_permitted,
TRUE,
NULL,
@@ -3533,7 +3540,7 @@ expunge_entry(H5F_t * file_ptr,
HDassert( ! ( entry_ptr->is_pinned ) );
result = H5C_expunge_entry(file_ptr, H5AC_ind_read_dxpl_id,
- &(types[type]), entry_ptr->addr, H5C__NO_FLAGS_SET);
+ types[type], entry_ptr->addr, H5C__NO_FLAGS_SET);
if ( result < 0 ) {
@@ -3754,11 +3761,11 @@ insert_entry(H5F_t * file_ptr,
}
result = H5C_insert_entry(file_ptr, xfer,
- &(types[type]), entry_ptr->addr, (void *)entry_ptr, flags);
+ types[type], entry_ptr->addr, (void *)entry_ptr, flags);
if ( ( result < 0 ) ||
( entry_ptr->header.is_protected ) ||
- ( entry_ptr->header.type != &(types[type]) ) ||
+ ( entry_ptr->header.type != types[type] ) ||
( entry_ptr->size != entry_ptr->header.size ) ||
( entry_ptr->addr != entry_ptr->header.addr ) ) {
@@ -3771,8 +3778,8 @@ insert_entry(H5F_t * file_ptr,
HDfprintf(stdout, "entry_ptr->header.is_protected = %d\n",
(int)(entry_ptr->header.is_protected));
HDfprintf(stdout,
- "entry_ptr->header.type != &(types[type]) = %d\n",
- (int)(entry_ptr->header.type != &(types[type])));
+ "entry_ptr->header.type != types[type] = %d\n",
+ (int)(entry_ptr->header.type != types[type]));
HDfprintf(stdout,
"entry_ptr->size != entry_ptr->header.size = %d\n",
(int)(entry_ptr->size != entry_ptr->header.size));
@@ -3855,7 +3862,7 @@ mark_entry_dirty(int32_t type,
( !entry_ptr->header.is_protected && !entry_ptr->header.is_pinned ) ||
( entry_ptr->header.is_protected && !entry_ptr->header.dirtied ) ||
( !entry_ptr->header.is_protected && !entry_ptr->header.is_dirty ) ||
- ( entry_ptr->header.type != &(types[type]) ) ||
+ ( entry_ptr->header.type != types[type] ) ||
( entry_ptr->size != entry_ptr->header.size ) ||
( entry_ptr->addr != entry_ptr->header.addr ) ) {
@@ -3948,7 +3955,7 @@ move_entry(H5C_t * cache_ptr,
mark_flush_dep_dirty(entry_ptr);
entry_ptr->action = TEST_ENTRY_ACTION_MOVE;
- result = H5C_move_entry(cache_ptr, &(types[type]), old_addr, new_addr);
+ result = H5C_move_entry(cache_ptr, types[type], old_addr, new_addr);
entry_ptr->action = TEST_ENTRY_ACTION_NUL;
}
@@ -4027,12 +4034,12 @@ protect_entry(H5F_t * file_ptr, int32_t type, int32_t idx)
} /* end if */
cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, xfer,
- &(types[type]), entry_ptr->addr, &entry_ptr->addr,
+ types[type], entry_ptr->addr, &entry_ptr->addr,
H5C__NO_FLAGS_SET);
if ( ( cache_entry_ptr != (void *)entry_ptr ) ||
( !(entry_ptr->header.is_protected) ) ||
- ( entry_ptr->header.type != &(types[type]) ) ||
+ ( entry_ptr->header.type != types[type] ) ||
( entry_ptr->size != entry_ptr->header.size ) ||
( entry_ptr->addr != entry_ptr->header.addr ) ) {
@@ -4049,8 +4056,8 @@ protect_entry(H5F_t * file_ptr, int32_t type, int32_t idx)
HDfprintf(stdout, "entry_ptr->header.is_protected = %d\n",
(int)(entry_ptr->header.is_protected));
HDfprintf(stdout,
- "( entry_ptr->header.type != &(types[type]) ) = %d\n",
- (int)( entry_ptr->header.type != &(types[type]) ));
+ "( entry_ptr->header.type != types[type] ) = %d\n",
+ (int)( entry_ptr->header.type != types[type] ));
HDfprintf(stdout,
"entry_ptr->size = %d, entry_ptr->header.size = %d\n",
(int)(entry_ptr->size), (int)(entry_ptr->header.size));
@@ -4131,13 +4138,13 @@ protect_entry_ro(H5F_t * file_ptr,
( entry_ptr->ro_ref_count > 0 ) ) );
cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5AC_ind_read_dxpl_id,
- &(types[type]), entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG);
+ types[type], entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG);
if ( ( cache_entry_ptr != (void *)entry_ptr ) ||
( !(entry_ptr->header.is_protected) ) ||
( !(entry_ptr->header.is_read_only) ) ||
( entry_ptr->header.ro_ref_count <= 0 ) ||
- ( entry_ptr->header.type != &(types[type]) ) ||
+ ( entry_ptr->header.type != types[type] ) ||
( entry_ptr->size != entry_ptr->header.size ) ||
( entry_ptr->addr != entry_ptr->header.addr ) ) {
@@ -4268,7 +4275,7 @@ unpin_entry(int32_t type,
if ( ( result < 0 ) ||
( entry_ptr->header.pinned_from_client ) ||
( entry_ptr->header.is_pinned && !entry_ptr->header.pinned_from_cache ) ||
- ( entry_ptr->header.type != &(types[type]) ) ||
+ ( entry_ptr->header.type != types[type] ) ||
( entry_ptr->size != entry_ptr->header.size ) ||
( entry_ptr->addr != entry_ptr->header.addr ) ) {
@@ -4353,7 +4360,7 @@ unprotect_entry(H5F_t * file_ptr,
( ( entry_ptr->header.is_protected ) &&
( ( ! ( entry_ptr->is_read_only ) ) ||
( entry_ptr->ro_ref_count <= 0 ) ) ) ||
- ( entry_ptr->header.type != &(types[type]) ) ||
+ ( entry_ptr->header.type != types[type] ) ||
( entry_ptr->size != entry_ptr->header.size ) ||
( entry_ptr->addr != entry_ptr->header.addr ) ) {