[hipl-dev] [Merge] lp:~diego-biurrun/hipl/locking into lp:hipl

  • From: Diego Biurrun <diego@xxxxxxxxxx>
  • To: mp+64096@xxxxxxxxxxxxxxxxxx
  • Date: Thu, 09 Jun 2011 22:49:40 -0000

Diego Biurrun has proposed merging lp:~diego-biurrun/hipl/locking into lp:hipl.

Requested reviews:
  HIPL core team (hipl-core)

For more details, see:
https://code.launchpad.net/~diego-biurrun/hipl/locking/+merge/64096

The vestigial locking macro cruft should go.
-- 
https://code.launchpad.net/~diego-biurrun/hipl/locking/+merge/64096
Your team HIPL core team is requested to review the proposed merge of 
lp:~diego-biurrun/hipl/locking into lp:hipl.
=== modified file 'hipd/cookie.c'
--- hipd/cookie.c       2011-05-18 08:47:20 +0000
+++ hipd/cookie.c       2011-06-09 22:49:37 +0000
@@ -200,7 +200,6 @@
     int                   idx, len;
 
     /* Find the proper R1 table and copy the R1 message from the table */
-    HIP_READ_LOCK_DB(HIP_DB_LOCAL_HID);
     HIP_IFEL(!(hid = hip_get_hostid_entry_by_lhi_and_algo(HIP_DB_LOCAL_HID,
                                                           our_hit, 
HIP_ANY_ALGO, -1)),
              NULL, "Unknown HIT\n");
@@ -220,7 +219,6 @@
         free(r1);
     }
 
-    HIP_READ_UNLOCK_DB(HIP_DB_LOCAL_HID);
     return err;
 }
 

=== modified file 'hipd/hidb.c'
--- hipd/hidb.c 2011-05-04 17:38:59 +0000
+++ hipd/hidb.c 2011-06-09 22:49:37 +0000
@@ -233,7 +233,6 @@
 
     id = hip_get_hostid_entry_by_lhi_and_algo(db, &hit, HIP_ANY_ALGO, -1);
     if (id == NULL) {
-        HIP_WRITE_UNLOCK_DB(db);
         HIP_ERROR("hit not found\n");
         err = -ENOENT;
         return err;
@@ -276,8 +275,6 @@
     struct local_host_id *tmp;
     int                   count;
 
-    HIP_WRITE_LOCK_DB(db);
-
     list_for_each_safe(curr, iter, db, count) {
         hip_hit_t hit;
 
@@ -288,8 +285,6 @@
     }
 
     hip_ht_uninit(db);
-
-    HIP_WRITE_UNLOCK_DB(db);
 }
 
 /**
@@ -450,8 +445,6 @@
     struct local_host_id *old_entry;
     int                   (*signature_func)(void *key, struct hip_common *m);
 
-    HIP_WRITE_LOCK_DB(db);
-
     HIP_IFEL(!(id_entry = calloc(1, sizeof(struct local_host_id))),
              -ENOMEM, "No memory available for host id\n");
 
@@ -462,7 +455,6 @@
     old_entry = hip_get_hostid_entry_by_lhi_and_algo(db, &hit,
                                                      HIP_ANY_ALGO, -1);
     if (old_entry != NULL) {
-        HIP_WRITE_UNLOCK_DB(db);
         HIP_ERROR("Trying to add duplicate local host ID\n");
         err = -EEXIST;
         goto out_err;
@@ -524,7 +516,6 @@
         free(id_entry);
     }
 
-    HIP_WRITE_UNLOCK_DB(db);
     return err;
 }
 
@@ -649,8 +640,6 @@
     struct local_host_id *entry;
     int                   err = 0;
 
-    HIP_READ_LOCK_DB(hip_local_hostid_db);
-
     entry = hip_get_hostid_entry_by_lhi_and_algo(hip_local_hostid_db,
                                                  NULL, algo, anon);
     if (!entry) {
@@ -662,7 +651,6 @@
     err = 0;
 
 out:
-    HIP_READ_UNLOCK_DB(hip_local_hostid_db);
     return err;
 }
 
@@ -702,8 +690,6 @@
     struct local_host_id *tmp;
     int                   err = 0, c;
 
-    HIP_READ_LOCK_DB(hip_local_hostid_db);
-
     list_for_each_safe(curr, iter, hip_local_hostid_db, c)
     {
         tmp = list_entry(curr);
@@ -716,8 +702,6 @@
     }
 
 out_err:
-    HIP_READ_UNLOCK_DB(hip_local_hostid_db);
-
     return err;
 }
 
@@ -796,8 +780,6 @@
     int                   err   = 0, host_id_len;
     struct local_host_id *entry = NULL;
 
-    HIP_READ_LOCK_DB(db);
-
     entry = hip_get_hostid_entry_by_lhi_and_algo(db, hit, algo, -1);
     HIP_IFE(!entry, -1);
 
@@ -812,7 +794,6 @@
     HIP_IFE(!*key, -1);
 
 out_err:
-    HIP_READ_UNLOCK_DB(db);
     return err;
 }
 

=== modified file 'hipd/hidb.h'
--- hipd/hidb.h 2011-05-04 16:20:00 +0000
+++ hipd/hidb.h 2011-06-09 22:49:37 +0000
@@ -36,29 +36,6 @@
 #include "cookie.h"
 
 
-#if 0
-#define HIP_READ_LOCK_DB(db) do { \
-        read_lock_irqsave(&(db)->db_lock, lf); \
-} while (0)
-
-#define HIP_WRITE_LOCK_DB(db) do { \
-        write_lock_irqsave(&(db)->db_lock, lf); \
-} while (0)
-
-#define HIP_READ_UNLOCK_DB(db) do { \
-        read_unlock_irqrestore(&(db)->db_lock, lf); \
-} while (0)
-
-#define HIP_WRITE_UNLOCK_DB(db) do { \
-        write_unlock_irqrestore(&(db)->db_lock, lf); \
-} while (0)
-#else
-#define HIP_READ_LOCK_DB(db)
-#define HIP_WRITE_LOCK_DB(db)
-#define HIP_READ_UNLOCK_DB(db)
-#define HIP_WRITE_UNLOCK_DB(db)
-#endif
-
 struct local_host_id {
     hip_hit_t          hit;
     bool               anonymous;         /**< Is this an anonymous HI */

=== modified file 'hipd/init.c'
--- hipd/init.c 2011-05-04 16:20:00 +0000
+++ hipd/init.c 2011-06-09 22:49:37 +0000
@@ -497,8 +497,6 @@
     int                   c;
     uint16_t              algo = 0;
 
-    HIP_READ_LOCK_DB(hip_local_hostid_db);
-
     list_for_each_safe(curr, iter, hip_local_hostid_db, c) {
         tmp = list_entry(curr);
         HIP_DEBUG_HIT("Found HIT", &tmp->hit);
@@ -511,7 +509,6 @@
     }
 
 out_err:
-    HIP_READ_UNLOCK_DB(hip_local_hostid_db);
     if (algo == HIP_HI_RSA) {
         return tmp;
     }

Other related posts: