diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-09-27 19:09:42 +0200 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-09-27 19:09:42 +0200 |
commit | f528223eb6cf63953c8c616aade6ff53c8e18efd (patch) | |
tree | d3cf0a4d471c8c21ef28f5770e180806d7b9a7f3 /debian/patches/random-fixes0003-exec-convert-to-trivfs-dynamic-classes-and-buckets.patch | |
parent | 5cf8db6e5ec9e4edfec1a9b653d02c320c833ec3 (diff) |
add patch series
Diffstat (limited to 'debian/patches/random-fixes0003-exec-convert-to-trivfs-dynamic-classes-and-buckets.patch')
-rw-r--r-- | debian/patches/random-fixes0003-exec-convert-to-trivfs-dynamic-classes-and-buckets.patch | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/debian/patches/random-fixes0003-exec-convert-to-trivfs-dynamic-classes-and-buckets.patch b/debian/patches/random-fixes0003-exec-convert-to-trivfs-dynamic-classes-and-buckets.patch new file mode 100644 index 00000000..e9ad5e94 --- /dev/null +++ b/debian/patches/random-fixes0003-exec-convert-to-trivfs-dynamic-classes-and-buckets.patch @@ -0,0 +1,132 @@ +From 920b5d1a66bb4bdbc072e13480e552d8ba511e85 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sun, 27 Sep 2015 18:54:31 +0200 +Subject: [PATCH hurd 3/9] exec: 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. + +* exec/main.c: Convert to dynamic classes and buckets. +--- + exec/main.c | 51 +++++++++++++++++++++++++++++++-------------------- + 1 file changed, 31 insertions(+), 20 deletions(-) + +diff --git a/exec/main.c b/exec/main.c +index 6553c42..9f8e53c 100644 +--- a/exec/main.c ++++ b/exec/main.c +@@ -38,10 +38,9 @@ int trivfs_support_read = 0; + int trivfs_support_write = 0; + int trivfs_allow_open = 0; + +-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_control_class; + + struct trivfs_control *fsys; + +@@ -88,11 +87,11 @@ deadboot (void *p) + munmap (boot->intarray, boot->nints * sizeof (int)); + + /* See if we are going away and this was the last thing keeping us up. */ +- if (ports_count_class (trivfs_cntl_portclasses[0]) == 0) ++ if (ports_count_class (trivfs_control_class) == 0) + { + /* We have no fsys control port, so we are detached from the + parent filesystem. Maybe we have no users left either. */ +- if (ports_count_class (trivfs_protid_portclasses[0]) == 0) ++ if (ports_count_class (trivfs_protid_class) == 0) + { + /* We have no user ports left. Are we still listening for + exec_startup RPCs from any tasks we already started? */ +@@ -101,9 +100,9 @@ deadboot (void *p) + exit (0); + ports_enable_class (execboot_portclass); + } +- ports_enable_class (trivfs_protid_portclasses[0]); ++ ports_enable_class (trivfs_protid_class); + } +- ports_enable_class (trivfs_cntl_portclasses[0]); ++ ports_enable_class (trivfs_control_class); + } + + #define OPT_DEVICE_MASTER_PORT (-1) +@@ -215,15 +214,27 @@ main (int argc, char **argv) + S_exec_init (below). */ + procserver = getproc (); + +- 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); +- execboot_portclass = ports_create_class (deadboot, NULL); ++ err = trivfs_add_port_bucket (&port_bucket); ++ if (err) ++ error (1, 0, "error creating port bucket"); ++ ++ err = trivfs_add_control_port_class (&trivfs_control_class); ++ if (err) ++ error (1, 0, "error creating control port class"); ++ ++ err = trivfs_add_protid_port_class (&trivfs_protid_class); ++ if (err) ++ error (1, 0, "error creating protid port class"); ++ ++ /* Reply to our parent. */ ++ err = trivfs_startup (bootstrap, 0, ++ trivfs_control_class, port_bucket, ++ trivfs_protid_class, port_bucket, &fsys); + + /* Reply to our parent. */ + err = trivfs_startup (bootstrap, 0, +- trivfs_cntl_portclasses[0], port_bucket, +- trivfs_protid_portclasses[0], port_bucket, ++ trivfs_control_class, port_bucket, ++ trivfs_protid_class, port_bucket, + &fsys); + mach_port_deallocate (mach_task_self (), bootstrap); + if (err) +@@ -249,11 +260,11 @@ 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_control_class); ++ ports_inhibit_class_rpcs (trivfs_protid_class); + + /* Are there any extant user ports for the /servers/exec file? */ +- count = ports_count_class (trivfs_protid_portclasses[0]); ++ count = ports_count_class (trivfs_protid_class); + if (count == 0 || (flags & FSYS_GOAWAY_FORCE)) + { + /* No users. Disconnect from the filesystem. */ +@@ -276,9 +287,9 @@ trivfs_goaway (struct trivfs_control *fsys, int flags) + else + { + /* 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_control_class); ++ ports_resume_class_rpcs (trivfs_protid_class); + + return EBUSY; + } +-- +2.1.4 + |