commit-hurd
[Top][All Lists]
Advanced

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

[hurd] 04/06: libmachdev: convert to trivfs dynamic classes and buckets


From: Samuel Thibault
Subject: [hurd] 04/06: libmachdev: convert to trivfs dynamic classes and buckets
Date: Tue, 13 Oct 2015 00:09:53 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch dde
in repository hurd.

commit a960afb9aae5a5160386d80a848c21bda788331a
Author: Justus Winter <address@hidden>
Date:   Mon Sep 28 15:24:00 2015 +0200

    libmachdev: convert to trivfs dynamic classes and buckets
    
    libtrivfs contains two ways of managing more than one port class and
    bucket.  There is the old way of using a statically allocated array
    with explicit length, and the new way with dynamically allocated
    vectors.
    
    Converting all users to the new way of handling multiple classes
    and/or buckets, we can simplify the code in libtrivfs.  In many cases,
    the code will be simpler and more expressive for the user.
    
    This also fixes a mild bug.  The classes and buckets given to
    `trivfs_startup' end up in the dynamic vectors too, making the object
    lookup code use the more complicated code path.
    
    * libmachdev/trivfs_server.c: Convert to dynamic classes and buckets.
---
 libmachdev/trivfs_server.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/libmachdev/trivfs_server.c b/libmachdev/trivfs_server.c
index 7d69a2a..3c0578f 100644
--- a/libmachdev/trivfs_server.c
+++ b/libmachdev/trivfs_server.c
@@ -19,10 +19,9 @@ int trivfs_support_write = 0;
 int trivfs_support_exec = 0;
 int trivfs_allow_open = O_READ | O_WRITE;
 
-struct port_class *trivfs_protid_portclasses[1];
-struct port_class *trivfs_cntl_portclasses[1];
-int trivfs_protid_nportclasses = 1;
-int trivfs_cntl_nportclasses = 1;
+/* Our port classes.  */
+struct port_class *trivfs_protid_class;
+struct port_class *trivfs_cntl_class;
 
 /* Implementation of notify interface */
 kern_return_t
@@ -70,7 +69,7 @@ boolean_t
 is_master_device (mach_port_t port)
 {
   struct port_info *pi = ports_lookup_port (port_bucket, port,
-                                           trivfs_protid_portclasses[0]);
+                                           trivfs_protid_class);
   if (pi == NULL)
     return FALSE;
   
@@ -96,8 +95,8 @@ trivfs_append_args (struct trivfs_control *fsys, char **argz, 
size_t *argz_len)
 int trivfs_init()
 {
   port_bucket = ports_create_bucket ();
-  trivfs_cntl_portclasses[0] = ports_create_class (trivfs_clean_cntl, 0);
-  trivfs_protid_portclasses[0] = ports_create_class (trivfs_clean_protid, 0);
+  trivfs_cntl_class = ports_create_class (trivfs_clean_cntl, 0);
+  trivfs_protid_class = ports_create_class (trivfs_clean_protid, 0);
   return 0;
 }
 
@@ -107,17 +106,17 @@ trivfs_goaway (struct trivfs_control *fsys, int flags)
   int count;
 
   /* Stop new requests.  */
-  ports_inhibit_class_rpcs (trivfs_cntl_portclasses[0]);
-  ports_inhibit_class_rpcs (trivfs_protid_portclasses[0]);
+  ports_inhibit_class_rpcs (trivfs_cntl_class);
+  ports_inhibit_class_rpcs (trivfs_protid_class);
 
-  count = ports_count_class (trivfs_protid_portclasses[0]);
+  count = ports_count_class (trivfs_protid_class);
 
   if (count && !(flags & FSYS_GOAWAY_FORCE))
     {
       /* We won't go away, so start things going again...  */
-      ports_enable_class (trivfs_protid_portclasses[0]);
-      ports_resume_class_rpcs (trivfs_cntl_portclasses[0]);
-      ports_resume_class_rpcs (trivfs_protid_portclasses[0]);
+      ports_enable_class (trivfs_protid_class);
+      ports_resume_class_rpcs (trivfs_cntl_class);
+      ports_resume_class_rpcs (trivfs_protid_class);
       return EBUSY;
     }
 
@@ -158,8 +157,8 @@ void trivfs_server()
 
   /* Reply to our parent.  */
   err = trivfs_startup (bootstrap, 0,
-                       trivfs_cntl_portclasses[0], port_bucket,
-                       trivfs_protid_portclasses[0], port_bucket, &fsys);
+                       trivfs_cntl_class, port_bucket,
+                       trivfs_protid_class, port_bucket, &fsys);
   mach_port_deallocate (mach_task_self (), bootstrap);
   if (err)
     error (1, err, "Contacting parent");

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

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