------------------------------------------------------------ revno: 5508 committer: Diego Biurrun <diego@xxxxxxxxxx> branch nick: hipl timestamp: Wed 2011-01-12 14:06:31 +0100 message: Remove empty HIP_LOCK_* and HIP_UNLOCK_* macros. Since no real locking was implemented, these macros just obfuscate the code for no gain. modified: firewall/cache.c hipd/hadb.c hipd/hadb.h hipd/input.c hipd/oppdb.c hipd/oppipdb.c hipd/output.c lib/core/hashchain.c lib/core/hashtable.h -- lp:hipl https://code.launchpad.net/~hipl-core/hipl/trunk Your team HIPL core team is subscribed to branch lp:hipl. To unsubscribe from this branch go to https://code.launchpad.net/~hipl-core/hipl/trunk/+edit-subscription
=== modified file 'firewall/cache.c' --- firewall/cache.c 2011-01-11 13:59:46 +0000 +++ firewall/cache.c 2011-01-12 13:06:31 +0000 @@ -193,8 +193,6 @@ HIP_DEBUG("Check firewall cache db\n"); - HIP_LOCK_HT(&firewall_cache_db); - list_for_each_safe(item, tmp, firewall_cache_db, i) { this = list_entry(item); @@ -215,7 +213,6 @@ break; } } - HIP_UNLOCK_HT(&firewall_cache_db); if (!ha_match && query_daemon) { HIP_DEBUG("No cache found, querying daemon\n"); @@ -309,7 +306,6 @@ LHASH_NODE *item = NULL, *tmp = NULL; HIP_DEBUG("Start hldb delete\n"); - HIP_LOCK_HT(&firewall_cache_db); list_for_each_safe(item, tmp, firewall_cache_db, i) { @@ -322,7 +318,6 @@ * so we don't want to uninitialize hash table here. Instead, * we handle it in firewall_exit(). */ - HIP_UNLOCK_HT(&firewall_cache_db); if (exiting) { hip_ht_uninit(firewall_cache_db); } === modified file 'hipd/hadb.c' --- hipd/hadb.c 2011-01-12 14:03:38 +0000 +++ hipd/hadb.c 2011-01-12 13:06:31 +0000 @@ -913,8 +913,6 @@ struct hip_opp_blocking_request *opp_entry = NULL; #endif - HIP_LOCK_HA(ha); - /* by now, if everything is according to plans, the refcnt * should be 1 */ HIP_DEBUG_HIT("our HIT", &ha->hit_our); @@ -934,8 +932,6 @@ } #endif - HIP_UNLOCK_HA(ha); - return 0; } @@ -1215,7 +1211,6 @@ return -EINVAL; } - HIP_LOCK_HT(&hadb_hit); list_for_each_safe(item, tmp, hadb_hit, i) { this = list_entry(item); @@ -1228,7 +1223,6 @@ } out_err: - HIP_UNLOCK_HT(&hadb_hit); return fail; } @@ -1342,7 +1336,6 @@ struct hip_hadb_state *this = NULL, *result = NULL; LHASH_NODE *item = NULL, *tmp = NULL; // - HIP_LOCK_HT(&hadb_hit); list_for_each_safe(item, tmp, hadb_hit, i) { this = list_entry(item); @@ -1354,7 +1347,6 @@ } /* @todo: unlock ha when we have threads */ } - HIP_UNLOCK_HT(&hadb_hit); return result; } === modified file 'hipd/hadb.h' --- hipd/hadb.h 2011-01-11 13:59:46 +0000 +++ hipd/hadb.h 2011-01-12 13:06:31 +0000 @@ -33,10 +33,6 @@ #include "lib/core/state.h" -#define HIP_LOCK_INIT(ha) -#define HIP_LOCK_HA(ha) -#define HIP_UNLOCK_HA(ha) - /* For switch userspace / kernel IPsec */ extern int hip_use_userspace_ipsec; === modified file 'hipd/input.c' --- hipd/input.c 2011-01-11 13:59:46 +0000 +++ hipd/input.c 2011-01-12 13:06:31 +0000 @@ -844,12 +844,9 @@ * the peer is behind NAT. We set NAT mode "on" and set the send function to * "hip_send_udp". The client UDP port is not stored until the handling * of R2 packet. Don't know if the entry is already locked... */ - if (ctx->msg_ports.dst_port != 0) { - HIP_LOCK_HA(ctx->hadb_entry); - if (ctx->hadb_entry->nat_mode == HIP_NAT_MODE_NONE) { - ctx->hadb_entry->nat_mode = HIP_NAT_MODE_PLAIN_UDP; - } - HIP_UNLOCK_HA(ctx->hadb_entry); + if (ctx->msg_ports.dst_port != 0 && + ctx->hadb_entry->nat_mode == HIP_NAT_MODE_NONE) { + ctx->hadb_entry->nat_mode = HIP_NAT_MODE_PLAIN_UDP; } /***** LOCATOR PARAMETER ******/ @@ -871,10 +868,8 @@ /* We must store the R1 generation counter, _IF_ it exists. */ if (r1cntr) { - HIP_LOCK_HA(ctx->hadb_entry); HIP_DEBUG("Storing R1 generation counter %d\n", r1cntr->generation); ctx->hadb_entry->birthday = ntoh64(r1cntr->generation); - HIP_UNLOCK_HA(ctx->hadb_entry); } /* Solve puzzle: if this is a retransmission, we have to preserve === modified file 'hipd/oppdb.c' --- hipd/oppdb.c 2011-01-10 12:15:34 +0000 +++ hipd/oppdb.c 2011-01-12 13:06:31 +0000 @@ -84,11 +84,6 @@ #include "oppdb.h" -#define HIP_LOCK_OPP_INIT(entry) -#define HIP_UNLOCK_OPP_INIT(entry) -#define HIP_LOCK_OPP(entry) -#define HIP_UNLOCK_OPP(entry) - struct hip_opp_info { hip_hit_t local_hit; hip_hit_t real_peer_hit; @@ -146,9 +141,7 @@ { struct hip_opp_blocking_request *deleted; - HIP_LOCK_OPP(entry); deleted = hip_ht_delete(oppdb, entry); - HIP_UNLOCK_OPP(entry); free(deleted); } @@ -191,7 +184,6 @@ return -EINVAL; } - HIP_LOCK_HT(&opp_db); list_for_each_safe(item, tmp, oppdb, i) { this = list_entry(item); @@ -201,7 +193,6 @@ } } out_err: - HIP_UNLOCK_HT(&opp_db); return fail; } @@ -336,9 +327,7 @@ return NULL; } - HIP_LOCK_OPP_INIT(entry); time(&entry->creation_time); - HIP_UNLOCK_OPP_INIT(entry); return entry; } @@ -353,8 +342,6 @@ LHASH_NODE *item, *tmp; HIP_DEBUG("start oppdb dump\n"); - HIP_LOCK_HT(&oppdb); - list_for_each_safe(item, tmp, oppdb, i) { this = list_entry(item); @@ -364,8 +351,6 @@ HIP_DEBUG_HIT("this->our_real_hit", &this->our_real_hit); } - - HIP_UNLOCK_HT(&oppdb); HIP_DEBUG("end oppdb dump\n"); } @@ -652,7 +637,6 @@ return NULL; } - HIP_LOCK_HT(&opp_db); list_for_each_safe(item, tmp, oppdb, i) { this = list_entry(item); @@ -663,7 +647,6 @@ } } - HIP_UNLOCK_HT(&opp_db); return ret; } === modified file 'hipd/oppipdb.c' --- hipd/oppipdb.c 2011-01-11 13:59:46 +0000 +++ hipd/oppipdb.c 2011-01-12 13:06:31 +0000 @@ -47,9 +47,6 @@ #include "lib/core/prefix.h" #include "oppipdb.h" -#define HIP_LOCK_OPPIP(entry) -#define HIP_UNLOCK_OPPIP(entry) - HIP_HASHTABLE *oppipdb; /** @@ -108,14 +105,12 @@ return -EINVAL; } - HIP_LOCK_HT(&oppipdb); list_for_each_safe(item, tmp, oppipdb, i) { this = list_entry(item); func(this, opaque); } - HIP_UNLOCK_HT(&oppipdb); return 0; } @@ -127,9 +122,7 @@ */ void hip_oppipdb_del_entry_by_entry(hip_oppip_t *entry, UNUSED void *arg) { - HIP_LOCK_OPPIP(entry); hip_ht_delete(oppipdb, entry); - HIP_UNLOCK_OPPIP(entry); free(entry); } === modified file 'hipd/output.c' --- hipd/output.c 2011-01-10 13:28:10 +0000 +++ hipd/output.c 2011-01-12 13:06:31 +0000 @@ -134,9 +134,7 @@ HIP_DEBUG("err after sending: %d.\n", err); if (!err) { - HIP_LOCK_HA(entry); entry->state = HIP_STATE_I1_SENT; - HIP_UNLOCK_HA(entry); } else if (err == 1) { err = 0; } @@ -398,11 +396,7 @@ /* we build this, if we have recorded some value (from previous R1s) */ { uint64_t rtmp; - - HIP_LOCK_HA(ctx->hadb_entry); rtmp = ctx->hadb_entry->birthday; - HIP_UNLOCK_HA(ctx->hadb_entry); - HIP_IFEL(rtmp && hip_build_param_r1_counter(ctx->output_msg, rtmp), -1, "Could not build R1 GENERATION parameter\n"); } === modified file 'lib/core/hashchain.c' --- lib/core/hashchain.c 2011-01-11 13:59:46 +0000 +++ lib/core/hashchain.c 2011-01-12 13:06:31 +0000 @@ -44,11 +44,6 @@ #include "ife.h" #include "hashchain.h" -/* these are not needed and therefore not implemented - * right now but they should be used where necessary */ -#define HCHAIN_LOCK(lock_id) -#define HCHAIN_UNLOCK(lock_id) - /** checks if a hash is verifiable by a hash chain * * @param current_hash the hash value to be verified @@ -279,10 +274,8 @@ HIP_ASSERT(hash_chain); - HCHAIN_LOCK(&hash_chain); element = hchain_next(hash_chain); hash_chain->current_index--; - HCHAIN_UNLOCK(&hash_chain); return element; } === modified file 'lib/core/hashtable.h' --- lib/core/hashtable.h 2011-01-10 12:14:37 +0000 +++ lib/core/hashtable.h 2011-01-12 13:06:31 +0000 @@ -37,9 +37,6 @@ #define HIPL_OPENSSL_100 #endif /* LHASH_OF */ -#define HIP_LOCK_HT(hash) -#define HIP_UNLOCK_HT(hash) - #define STATIC_IMPLEMENT_LHASH_COMP_FN static IMPLEMENT_LHASH_COMP_FN #define STATIC_IMPLEMENT_LHASH_DOALL_FN static IMPLEMENT_LHASH_DOALL_FN #define STATIC_IMPLEMENT_LHASH_DOALL_ARG_FN static IMPLEMENT_LHASH_DOALL_ARG_FN