From af4a977a21f04215d2c740e17e9e41fbfc589dc9 Mon Sep 17 00:00:00 2001 From: Vishal Sahay Date: Fri, 19 Mar 2004 16:34:09 +0000 Subject: [PATCH] Change references to keyhash according to the comm/datatype/win object -- append a prefix to keyhash in the respective structure This commit was SVN r938. --- src/attribute/attribute.c | 60 +++++++++++++++++---------------- src/attribute/attribute.h | 3 -- src/communicator/communicator.h | 2 +- src/datatype/datatype.h | 2 +- src/win/win.h | 2 +- 5 files changed, 34 insertions(+), 35 deletions(-) diff --git a/src/attribute/attribute.c b/src/attribute/attribute.c index 1e18f53160..2762fe6446 100644 --- a/src/attribute/attribute.c +++ b/src/attribute/attribute.c @@ -13,13 +13,15 @@ #define ATTR_TABLE_SIZE 10 /* This is done so that I can have a conssitent interface to my macros - here, because Datatype and Type - both are used for Datatype - related stuff */ + here */ #define MPI_DATATYPE_NULL_COPY_FN MPI_TYPE_NULL_COPY_FN -#define lam_Comm_t lam_communicator_t * -#define lam_Type_t lam_datatype_t * -#define lam_Win_t lam_win_t * +#define lam_c_t lam_communicator_t * +#define lam_d_t lam_datatype_t * +#define lam_w_t lam_win_t * +#define MPI_c_delete_attr_function MPI_Comm_delete_attr_function +#define MPI_d_delete_attr_function MPI_Type_delete_attr_function +#define MPI_w_delete_attr_function MPI_Win_delete_attr_function #define CREATE_KEY() lam_bitmap_find_and_set_first_unset_bit(key_bitmap) @@ -39,11 +41,11 @@ #define GET_ATTR(type) \ - lam_hash_table_get_value_uint32(((lam_##type##_t)object)->keyhash, key); + lam_hash_table_get_value_uint32(((lam_##type##_t)object)->type##_keyhash, key); #define SET_ATTR(type, attribute) \ - ret = lam_hash_table_set_value_uint32(((lam_##type##_t)object)->keyhash,\ + ret = lam_hash_table_set_value_uint32(((lam_##type##_t)object)->type##_keyhash,\ key, \ attribute); \ if (ret != LAM_SUCCESS) \ @@ -51,7 +53,7 @@ #define REMOVE_ATTR_ENTRY(type) \ - ret = lam_hash_table_remove_value_uint32(((lam_##type##_t)object)->keyhash,\ + ret = lam_hash_table_remove_value_uint32(((lam_##type##_t)object)->type##_keyhash,\ key);\ if (ret != LAM_SUCCESS) \ return ret; @@ -261,21 +263,21 @@ lam_attr_delete(lam_attribute_type_t type, void *object, int key, switch(type) { case COMM_ATTR: - attr = GET_ATTR(Comm); - DELETE_ATTR_OBJECT(Comm, COMM, attr); - REMOVE_ATTR_ENTRY(Comm); + attr = GET_ATTR(c); + DELETE_ATTR_OBJECT(c, COMM, attr); + REMOVE_ATTR_ENTRY(c); break; case WIN_ATTR: - attr = GET_ATTR(Win); - DELETE_ATTR_OBJECT(Win, WIN, attr); - REMOVE_ATTR_ENTRY(Win); + attr = GET_ATTR(w); + DELETE_ATTR_OBJECT(w, WIN, attr); + REMOVE_ATTR_ENTRY(w); break; case TYPE_ATTR: - attr = GET_ATTR(Type); - DELETE_ATTR_OBJECT(Type, TYPE, attr); - REMOVE_ATTR_ENTRY(Type); + attr = GET_ATTR(d); + DELETE_ATTR_OBJECT(d, TYPE, attr); + REMOVE_ATTR_ENTRY(d); break; default: @@ -320,30 +322,30 @@ lam_attr_set(lam_attribute_type_t type, void *object, int key, void *attribute, switch(type) { case COMM_ATTR: - oldattr = GET_ATTR(Comm); + oldattr = GET_ATTR(c); if (oldattr != NULL) { - DELETE_ATTR_OBJECT(Comm, COMM, oldattr); + DELETE_ATTR_OBJECT(c, COMM, oldattr); had_old = 1; } - SET_ATTR(Comm, attribute); + SET_ATTR(c, attribute); break; case WIN_ATTR: - oldattr = GET_ATTR(Win); + oldattr = GET_ATTR(w); if (oldattr != NULL) { - DELETE_ATTR_OBJECT(Win, WIN, oldattr); + DELETE_ATTR_OBJECT(w, WIN, oldattr); had_old = 1; } - SET_ATTR(Win, attribute); + SET_ATTR(w, attribute); break; case TYPE_ATTR: - oldattr = GET_ATTR(Type); + oldattr = GET_ATTR(d); if (oldattr != NULL) { - DELETE_ATTR_OBJECT(Type, TYPE, oldattr); + DELETE_ATTR_OBJECT(d, TYPE, oldattr); had_old = 1; } - SET_ATTR(Type, attribute); + SET_ATTR(d, attribute); break; default: @@ -376,15 +378,15 @@ lam_attr_get(lam_attribute_type_t type, void *object, int key, void *attribute, switch (type) { case COMM_ATTR: - attr = GET_ATTR(Comm); + attr = GET_ATTR(c); break; case WIN_ATTR: - attr = GET_ATTR(Win); + attr = GET_ATTR(w); break; case TYPE_ATTR: - attr = GET_ATTR(Type); + attr = GET_ATTR(d); break; default: diff --git a/src/attribute/attribute.h b/src/attribute/attribute.h index cf242b73f3..d9ccdff3dd 100644 --- a/src/attribute/attribute.h +++ b/src/attribute/attribute.h @@ -66,9 +66,6 @@ struct lam_attrkey_item_t { void *copy_attr_fn; /**< Copy function for the attribute */ void *delete_attr_fn; /**< Delete function for the attribute */ void *extra_state; /**< Extra state of the attribute */ - int delete_ok; /**< Denotes if its ok to delete this key when - reference count is 0 -- the key can only be - deleted with MPI_*_free_keyval */ int key; /**< Keep a track of which key this item belongs to, so that the key can be deleted when this object is destroyed */ }; diff --git a/src/communicator/communicator.h b/src/communicator/communicator.h index bb2d4e7fed..6fa668f4d9 100644 --- a/src/communicator/communicator.h +++ b/src/communicator/communicator.h @@ -28,7 +28,7 @@ struct lam_communicator_t { lam_group_t *c_remote_group; /* Attributes */ - lam_hash_table_t *keyhash; + lam_hash_table_t *c_keyhash; /* Topology information */ int c_cube_dim; /**< Inscribing cube dimension */ diff --git a/src/datatype/datatype.h b/src/datatype/datatype.h index 7a7c3015aa..b388fde13f 100644 --- a/src/datatype/datatype.h +++ b/src/datatype/datatype.h @@ -106,7 +106,7 @@ typedef struct lam_datatype_t { unsigned int bdt_used; /**< which basic datatypes are used in the data description */ /* Attribute fields */ - lam_hash_table_t *keyhash; + lam_hash_table_t *d_keyhash; char name[MPI_MAX_OBJECT_NAME]; dt_type_desc_t desc; /**< the data description */ diff --git a/src/win/win.h b/src/win/win.h index adcf984a1c..9fddc79b40 100644 --- a/src/win/win.h +++ b/src/win/win.h @@ -18,7 +18,7 @@ struct lam_win_t { /* Attributes */ - lam_hash_table_t *keyhash; + lam_hash_table_t *w_keyhash; /* index in Fortran <-> C translation array */