commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

hurd-l4/libhurd-cap cap-user.c cap.h


From: Marcus Brinkmann
Subject: hurd-l4/libhurd-cap cap-user.c cap.h
Date: Sun, 17 Aug 2003 01:48:22 -0400

CVSROOT:        /cvsroot/hurd
Module name:    hurd-l4
Branch:         
Changes by:     Marcus Brinkmann <address@hidden>       03/08/17 01:48:22

Modified files:
        libhurd-cap    : cap-user.c cap.h 

Log message:
        Be a bit more authentic about ihash usage.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/libhurd-cap/cap-user.c.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/libhurd-cap/cap.h.diff?tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: hurd-l4/libhurd-cap/cap-user.c
diff -u hurd-l4/libhurd-cap/cap-user.c:1.3 hurd-l4/libhurd-cap/cap-user.c:1.4
--- hurd-l4/libhurd-cap/cap-user.c:1.3  Sat Aug 16 17:11:00 2003
+++ hurd-l4/libhurd-cap/cap-user.c      Sun Aug 17 01:48:22 2003
@@ -28,7 +28,7 @@
 #include "cap-intern.h"
 
 
-static hurd_ihash_t server_to_sconn;
+static struct hurd_ihash server_to_sconn = HURD_IHASH_INITIALIZER;
 static pthread_mutex_t server_to_sconn_lock = PTHREAD_MUTEX_INITIALIZER;
 
 
@@ -63,13 +63,13 @@
     }
 
   /* Now we can remove the object.  */
-  hurd_ihash_remove (server_to_sconn, sconn->server_thread);
+  hurd_ihash_remove (&server_to_sconn, sconn->server_thread);
   pthread_mutex_unlock (&server_to_sconn_lock);
 
   /* Finally, we can destroy it.  */
   pthread_mutex_unlock (&sconn->lock);
   pthread_mutex_destroy (&sconn->lock);
-  hurd_ihash_destroy (sconn->id_to_cap);
+  hurd_ihash_destroy (&sconn->id_to_cap);
   hurd_cap_deallocate (sconn->server_task_id);
   free (sconn);
 }
@@ -82,7 +82,7 @@
 _hurd_cap_sconn_remove (sconn, scid)
 {
   /* Remove the capability object pointer, which is now invalid.  */
-  hurd_ihash_remove (sconn->id_to_cap, scid);
+  hurd_ihash_remove (&sconn->id_to_cap, scid);
   /* FIXME: The following should be some low level RPC to deallocate
      the capability on the server side.  If it fails, then what can we
      do at this point?  */
@@ -106,7 +106,7 @@
   int sconn_created = 0;
 
   pthread_mutex_lock (&server_to_sconn_lock);
-  sconn = hurd_ihash_lookup (server_to_sconn, server_thread);
+  sconn = hurd_ihash_find (&server_to_sconn, server_thread);
   if (!sconn)
     {
       error_t err;
@@ -117,31 +117,25 @@
          pthread_mutex_unlock (&server_to_sconn_lock);
          return errno;
        }
-      err = hurd_ihash_create (&sconn->id_to_cap);
-      if (err)
-       {
-         free (sconn);
-         pthread_mutex_unlock (&server_to_sconn_lock);
-         return errno;
-       }
       err = pthread_mutex_init (&sconn->lock, NULL);
       if (err)
        {
-         hurd_ihash_destroy (sconn->id_to_cap);
          free (sconn);
          pthread_mutex_unlock (&server_to_sconn_lock);
          return errno;
        }
+      hurd_ihash_init (&sconn->id_to_cap);
+
       sconn->server_thread = server_thread;
       sconn->server_task_id = server_task_id;
       sconn->refs = 0;
 
       /* Enter the new server connection object.  */
-      err = hurd_ihash_enter (server_to_sconn, server_thread, sconn);
+      err = hurd_ihash_add (&server_to_sconn, server_thread, sconn, NULL);
       if (err)
        {
          pthread_mutex_destroy (&sconn->lock);
-         hurd_ihash_destroy (sconn->id_to_cap);
+         hurd_ihash_destroy (&sconn->id_to_cap);
          free (sconn);
          pthread_mutex_unlock (&server_to_sconn_lock);
          return errno;
@@ -154,7 +148,7 @@
   sconn->refs++;
   pthread_mutex_unlock (&server_to_sconn_lock);
 
-  cap = hurd_ihash_lookup (sconn->id_to_cap, scid);
+  cap = hurd_ihash_find (&sconn->id_to_cap, scid);
   if (!cap)
     {
       error_t err = hurd_slab_alloc (cap_space, &cap);
@@ -168,7 +162,7 @@
       cap->scid = scid;
       cap->dead_cb = NULL;
 
-      err = hurd_ihash_enter (sconn->id_to_cap, scid, cap);
+      err = hurd_ihash_add (&sconn->id_to_cap, scid, cap, 0);
       if (err)
        {
          _hurd_cap_sconn_dealloc (sconn);
Index: hurd-l4/libhurd-cap/cap.h
diff -u hurd-l4/libhurd-cap/cap.h:1.3 hurd-l4/libhurd-cap/cap.h:1.4
--- hurd-l4/libhurd-cap/cap.h:1.3       Sat Aug 16 17:11:00 2003
+++ hurd-l4/libhurd-cap/cap.h   Sun Aug 17 01:48:22 2003
@@ -47,7 +47,7 @@
   unsigned int refs;
 
   /* A hash mapping the capability IDs to capability objects.  */
-  hurd_ihash_t id_to_cap;
+  struct hurd_ihash id_to_cap;
 };
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]