summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2015-09-27 23:41:49 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2015-09-27 23:41:49 +0200
commit8933895df3b07ae5d8c48c62e7067a55c4d159d1 (patch)
treec1e77ef2458de251c14040d133ff530f0cde0e26 /debian
parent23b448e63c39ab8d068d39850f7a862c122dd920 (diff)
add patch series
Diffstat (limited to 'debian')
-rw-r--r--debian/patches/random-fixes0001-exec-convert-to-trivfs-dynamic-classes-and-buckets.patch134
-rw-r--r--debian/patches/random-fixes0002-pfinet-convert-to-trivfs-dynamic-classes-and-buckets.patch228
-rw-r--r--debian/patches/random-fixes0003-pflocal-convert-to-trivfs-dynamic-classes-and-bucket.patch81
-rw-r--r--debian/patches/random-fixes0004-trans-crash-convert-to-trivfs-dynamic-classes-and-bu.patch151
-rw-r--r--debian/patches/random-fixes0005-trans-ifsock-convert-to-trivfs-dynamic-classes-and-b.patch52
-rw-r--r--debian/patches/random-fixes0006-trans-magic-convert-to-trivfs-dynamic-classes-and-bu.patch78
-rw-r--r--debian/patches/random-fixes0007-trans-new-fifo-convert-to-trivfs-dynamic-classes-and.patch74
-rw-r--r--debian/patches/random-fixes0008-trans-passwd-convert-to-trivfs-dynamic-classes-and-b.patch128
-rw-r--r--debian/patches/random-fixes0009-trans-proxy-defpager-convert-to-trivfs-dynamic-class.patch65
-rw-r--r--debian/patches/random-fixes0010-libtrivfs-optimize-the-object-lookup-code.patch188
-rw-r--r--debian/patches/random-fixes0011-libtrivfs-deprecate-old-api.patch39
-rw-r--r--debian/patches/series11
12 files changed, 1229 insertions, 0 deletions
diff --git a/debian/patches/random-fixes0001-exec-convert-to-trivfs-dynamic-classes-and-buckets.patch b/debian/patches/random-fixes0001-exec-convert-to-trivfs-dynamic-classes-and-buckets.patch
new file mode 100644
index 00000000..3d448a03
--- /dev/null
+++ b/debian/patches/random-fixes0001-exec-convert-to-trivfs-dynamic-classes-and-buckets.patch
@@ -0,0 +1,134 @@
+From a5d384c333dbbe863c1515d6167d956b0c5b4852 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 01/11] 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, 32 insertions(+), 19 deletions(-)
+
+diff --git a/exec/main.c b/exec/main.c
+index 6553c42..beb6f61 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,29 @@ 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);
++ 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");
++
+ execboot_portclass = ports_create_class (deadboot, NULL);
+
+ /* 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);
++
++ /* Reply to our parent. */
++ err = trivfs_startup (bootstrap, 0,
++ trivfs_control_class, port_bucket,
++ trivfs_protid_class, port_bucket,
+ &fsys);
+ mach_port_deallocate (mach_task_self (), bootstrap);
+ if (err)
+@@ -249,11 +262,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 +289,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
+
diff --git a/debian/patches/random-fixes0002-pfinet-convert-to-trivfs-dynamic-classes-and-buckets.patch b/debian/patches/random-fixes0002-pfinet-convert-to-trivfs-dynamic-classes-and-buckets.patch
new file mode 100644
index 00000000..a53fb756
--- /dev/null
+++ b/debian/patches/random-fixes0002-pfinet-convert-to-trivfs-dynamic-classes-and-buckets.patch
@@ -0,0 +1,228 @@
+From f42c29d2172e953887542bf7fb31d2b739563887 Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Sun, 27 Sep 2015 18:50:11 +0200
+Subject: [PATCH hurd 02/11] pfinet: 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.
+
+* pfinet/main.c: Convert to dynamic classes and buckets.
+* pfinet/options.c: Likewise.
+* pfinet/pfinet.h: Likewise.
+* pfinet/socket-ops.c: Likewise.
+---
+ pfinet/main.c | 61 +++++++++++++++++++++++++++++------------------------
+ pfinet/options.c | 8 +++----
+ pfinet/pfinet.h | 7 ++----
+ pfinet/socket-ops.c | 2 +-
+ 4 files changed, 41 insertions(+), 37 deletions(-)
+
+diff --git a/pfinet/main.c b/pfinet/main.c
+index 8716fdb..46457a9 100644
+--- a/pfinet/main.c
++++ b/pfinet/main.c
+@@ -56,11 +56,9 @@ int trivfs_support_write = 1;
+ int trivfs_support_exec = 0;
+ int trivfs_allow_open = O_READ | O_WRITE;
+
+-struct port_class *trivfs_protid_portclasses[2];
+-int trivfs_protid_nportclasses = 2;
+-
+-struct port_class *trivfs_cntl_portclasses[2];
+-int trivfs_cntl_nportclasses = 2;
++/* We have a class each per portclass. */
++struct port_class *pfinet_protid_portclasses[2];
++struct port_class *pfinet_cntl_portclasses[2];
+
+ /* Which portclass to install on the bootstrap port, default to IPv4. */
+ int pfinet_bootstrap_portclass = PORTCLASS_INET;
+@@ -334,7 +332,7 @@ main (int argc,
+
+ if (bootstrap != MACH_PORT_NULL) {
+ /* Create portclass to install on the bootstrap port. */
+- if(trivfs_protid_portclasses[pfinet_bootstrap_portclass]
++ if(pfinet_protid_portclasses[pfinet_bootstrap_portclass]
+ != MACH_PORT_NULL)
+ error(1, 0, "No portclass left to assign to bootstrap port");
+
+@@ -342,17 +340,23 @@ main (int argc,
+ if (pfinet_bootstrap_portclass == PORTCLASS_INET6)
+ pfinet_activate_ipv6 ();
+ #endif
+-
+- trivfs_protid_portclasses[pfinet_bootstrap_portclass] =
+- ports_create_class (trivfs_clean_protid, 0);
+- trivfs_cntl_portclasses[pfinet_bootstrap_portclass] =
+- ports_create_class (trivfs_clean_cntl, 0);
++
++ err = trivfs_add_protid_port_class (
++ &pfinet_protid_portclasses[pfinet_bootstrap_portclass]);
++ if (err)
++ error (1, 0, "error creating control port class");
++
++ err = trivfs_add_control_port_class (
++ &pfinet_cntl_portclasses[pfinet_bootstrap_portclass]);
++ if (err)
++ error (1, 0, "error creating control port class");
+
+ /* Talk to parent and link us in. */
+ err = trivfs_startup (bootstrap, 0,
+- trivfs_cntl_portclasses[pfinet_bootstrap_portclass],
+- pfinet_bucket, trivfs_protid_portclasses
+- [pfinet_bootstrap_portclass], pfinet_bucket,
++ pfinet_cntl_portclasses[pfinet_bootstrap_portclass],
++ pfinet_bucket,
++ pfinet_protid_portclasses[pfinet_bootstrap_portclass],
++ pfinet_bucket,
+ &pfinetctl);
+
+ if (err)
+@@ -371,7 +375,7 @@ main (int argc,
+ /* Check that at least one portclass has been bound,
+ error out otherwise. */
+ for (i = 0; i < trivfs_protid_nportclasses; i ++)
+- if (trivfs_protid_portclasses[i] != MACH_PORT_NULL)
++ if (pfinet_protid_portclasses[i] != MACH_PORT_NULL)
+ break;
+
+ if (i == trivfs_protid_nportclasses)
+@@ -424,22 +428,25 @@ pfinet_bind (int portclass, const char *name)
+ err = errno;
+
+ if (! err) {
+- if (trivfs_protid_portclasses[portclass] != MACH_PORT_NULL)
++ if (pfinet_protid_portclasses[portclass] != MACH_PORT_NULL)
+ error (1, 0, "Cannot bind one protocol to multiple nodes.\n");
+
+ #ifdef CONFIG_IPV6
+ if (portclass == PORTCLASS_INET6)
+ pfinet_activate_ipv6 ();
+ #endif
++ //mark
++ err = trivfs_add_protid_port_class (&pfinet_protid_portclasses[portclass]);
++ if (err)
++ error (1, 0, "error creating control port class");
+
+- trivfs_protid_portclasses[portclass] =
+- ports_create_class (trivfs_clean_protid, 0);
+- trivfs_cntl_portclasses[portclass] =
+- ports_create_class (trivfs_clean_cntl, 0);
++ err = trivfs_add_control_port_class (&pfinet_cntl_portclasses[portclass]);
++ if (err)
++ error (1, 0, "error creating control port class");
+
+- err = trivfs_create_control (file, trivfs_cntl_portclasses[portclass],
+- pfinet_bucket,
+- trivfs_protid_portclasses[portclass],
++ err = trivfs_create_control (file, pfinet_cntl_portclasses[portclass],
++ pfinet_bucket,
++ pfinet_protid_portclasses[portclass],
+ pfinet_bucket, &cntl);
+ }
+
+@@ -473,16 +480,16 @@ trivfs_goaway (struct trivfs_control *cntl, int flags)
+ else
+ {
+ /* Stop new requests. */
+- ports_inhibit_class_rpcs (trivfs_cntl_portclasses[0]);
+- ports_inhibit_class_rpcs (trivfs_protid_portclasses[0]);
++ ports_inhibit_class_rpcs (pfinet_cntl_portclasses[0]);
++ ports_inhibit_class_rpcs (pfinet_protid_portclasses[0]);
+ ports_inhibit_class_rpcs (socketport_class);
+
+ if (ports_count_class (socketport_class) != 0)
+ {
+ /* We won't go away, so start things going again... */
+ ports_enable_class (socketport_class);
+- ports_resume_class_rpcs (trivfs_cntl_portclasses[0]);
+- ports_resume_class_rpcs (trivfs_protid_portclasses[0]);
++ ports_resume_class_rpcs (pfinet_cntl_portclasses[0]);
++ ports_resume_class_rpcs (pfinet_protid_portclasses[0]);
+
+ return EBUSY;
+ }
+diff --git a/pfinet/options.c b/pfinet/options.c
+index daffcd5..ae44759 100644
+--- a/pfinet/options.c
++++ b/pfinet/options.c
+@@ -133,7 +133,7 @@ parse_interface_copy_device(struct device *src,
+ && FIB_RES_GW(res) != INADDR_ANY)
+ dst->gateway = FIB_RES_GW (res);
+ #ifdef CONFIG_IPV6
+- if (trivfs_protid_portclasses[PORTCLASS_INET6] != MACH_PORT_NULL)
++ if (pfinet_protid_portclasses[PORTCLASS_INET6] != MACH_PORT_NULL)
+ idev = ipv6_find_idev(src);
+
+ if (idev)
+@@ -452,7 +452,7 @@ parse_opt (int opt, char *arg, struct argp_state *state)
+ {
+ #ifdef CONFIG_IPV6
+ struct inet6_dev *idev = NULL;
+- if (trivfs_protid_portclasses[PORTCLASS_INET6] != MACH_PORT_NULL
++ if (pfinet_protid_portclasses[PORTCLASS_INET6] != MACH_PORT_NULL
+ && in->device)
+ idev = ipv6_find_idev(in->device);
+ #endif
+@@ -570,7 +570,7 @@ parse_opt (int opt, char *arg, struct argp_state *state)
+
+ /* Set IPv6 default router. */
+ #ifdef CONFIG_IPV6
+- if (trivfs_protid_portclasses[PORTCLASS_INET6] != MACH_PORT_NULL)
++ if (pfinet_protid_portclasses[PORTCLASS_INET6] != MACH_PORT_NULL)
+ {
+ struct rt6_info *rt6i = ipv6_get_dflt_router ();
+
+@@ -710,7 +710,7 @@ trivfs_append_args (struct trivfs_control *fsys, char **argz, size_t *argz_len)
+ #ifdef CONFIG_IPV6
+ struct inet6_dev *idev = NULL;
+
+- if (trivfs_protid_portclasses[PORTCLASS_INET6] != MACH_PORT_NULL)
++ if (pfinet_protid_portclasses[PORTCLASS_INET6] != MACH_PORT_NULL)
+ idev = ipv6_find_idev(dev);
+
+ if (idev)
+diff --git a/pfinet/pfinet.h b/pfinet/pfinet.h
+index 46aa97b..6e59225 100644
+--- a/pfinet/pfinet.h
++++ b/pfinet/pfinet.h
+@@ -92,11 +92,8 @@ enum {
+ PORTCLASS_INET6,
+ };
+
+-extern struct port_class *trivfs_protid_portclasses[];
+-extern int trivfs_protid_nportclasses;
+-
+-extern struct port_class *trivfs_cntl_portclasses[2];
+-extern int trivfs_cntl_nportclasses;
++extern struct port_class *pfinet_protid_portclasses[2];
++extern struct port_class *pfinet_cntl_portclasses[2];
+
+ /* Which portclass to install on the bootstrap port. */
+ extern int pfinet_bootstrap_portclass;
+diff --git a/pfinet/socket-ops.c b/pfinet/socket-ops.c
+index 3f8b7fb..14b3120 100644
+--- a/pfinet/socket-ops.c
++++ b/pfinet/socket-ops.c
+@@ -82,7 +82,7 @@ S_socket_create (struct trivfs_protid *master,
+ isroot = 1;
+ }
+
+- if (master->pi.class == trivfs_protid_portclasses[PORTCLASS_INET])
++ if (master->pi.class == pfinet_protid_portclasses[PORTCLASS_INET])
+ err = - (*net_families[PF_INET]->create) (sock, protocol);
+ else
+ err = - (*net_families[PF_INET6]->create) (sock, protocol);
+--
+2.1.4
+
diff --git a/debian/patches/random-fixes0003-pflocal-convert-to-trivfs-dynamic-classes-and-bucket.patch b/debian/patches/random-fixes0003-pflocal-convert-to-trivfs-dynamic-classes-and-bucket.patch
new file mode 100644
index 00000000..eca540fb
--- /dev/null
+++ b/debian/patches/random-fixes0003-pflocal-convert-to-trivfs-dynamic-classes-and-bucket.patch
@@ -0,0 +1,81 @@
+From 50a7577b022851594fd15f8c934cd3c4a37c01b6 Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Sun, 27 Sep 2015 17:01:37 +0200
+Subject: [PATCH hurd 03/11] pflocal: 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.
+
+* pflocal/pflocal.c: Convert to dynamic classes and buckets.
+---
+ pflocal/pflocal.c | 20 ++++----------------
+ 1 file changed, 4 insertions(+), 16 deletions(-)
+
+diff --git a/pflocal/pflocal.c b/pflocal/pflocal.c
+index fcb62d1..07d1a97 100644
+--- a/pflocal/pflocal.c
++++ b/pflocal/pflocal.c
+@@ -38,12 +38,6 @@ int trivfs_support_read = 0;
+ int trivfs_support_write = 0;
+ int trivfs_support_exec = 0;
+ int trivfs_allow_open = 0;
+-
+-/* Trivfs noise. */
+-struct port_class *trivfs_protid_portclasses[1];
+-struct port_class *trivfs_cntl_portclasses[1];
+-int trivfs_protid_nportclasses = 1;
+-int trivfs_cntl_nportclasses = 1;
+
+ /* ---------------------------------------------------------------- */
+ #include "socket_S.h"
+@@ -70,6 +64,7 @@ main(int argc, char *argv[])
+ {
+ error_t err;
+ mach_port_t bootstrap;
++ struct trivfs_control *fsys;
+
+ if (argc > 1)
+ {
+@@ -81,25 +76,18 @@ main(int argc, char *argv[])
+ if (bootstrap == MACH_PORT_NULL)
+ error(2, 0, "Must be started as a translator");
+
+- pf_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);
+-
+ /* Prepare to create sockets. */
+ err = sock_global_init ();
+ if (err)
+ error(3, err, "Initializing");
+
+ /* Reply to our parent */
+- err =
+- trivfs_startup (bootstrap, 0,
+- trivfs_cntl_portclasses[0], pf_port_bucket,
+- trivfs_protid_portclasses[0], pf_port_bucket,
+- NULL);
++ err = trivfs_startup (bootstrap, 0, 0, 0, 0, 0, &fsys);
+ if (err)
+ error(3, err, "Contacting parent");
+
++ pf_port_bucket = fsys->pi.bucket;
++
+ /* Launch. */
+ do
+ ports_manage_port_operations_multithread (pf_port_bucket,
+--
+2.1.4
+
diff --git a/debian/patches/random-fixes0004-trans-crash-convert-to-trivfs-dynamic-classes-and-bu.patch b/debian/patches/random-fixes0004-trans-crash-convert-to-trivfs-dynamic-classes-and-bu.patch
new file mode 100644
index 00000000..03e54746
--- /dev/null
+++ b/debian/patches/random-fixes0004-trans-crash-convert-to-trivfs-dynamic-classes-and-bu.patch
@@ -0,0 +1,151 @@
+From 2656f79608c8db735514bafe8026211c92d06aa1 Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Sun, 27 Sep 2015 17:07:18 +0200
+Subject: [PATCH hurd 04/11] trans/crash: 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.
+
+* trans/crash.c: Convert to dynamic classes and buckets.
+---
+ trans/crash.c | 50 ++++++++++++++++++++++++++++----------------------
+ 1 file changed, 28 insertions(+), 22 deletions(-)
+
+diff --git a/trans/crash.c b/trans/crash.c
+index c424b16..23f2a2d 100644
+--- a/trans/crash.c
++++ b/trans/crash.c
+@@ -44,6 +44,10 @@ process_t procserver; /* Our proc port, for easy access. */
+ /* Port bucket we service requests on. */
+ struct port_bucket *port_bucket;
+
++/* Our port classes. */
++struct port_class *trivfs_control_class;
++struct port_class *trivfs_protid_class;
++
+ /* Trivfs hooks. */
+ int trivfs_fstype = FSTYPE_MISC;
+ int trivfs_fsid = 0;
+@@ -52,11 +56,6 @@ int trivfs_support_write = 0;
+ int trivfs_support_exec = 0;
+ int trivfs_allow_open = O_READ|O_WRITE|O_EXEC;
+
+-struct port_class *trivfs_protid_portclasses[1];
+-struct port_class *trivfs_cntl_portclasses[1];
+-int trivfs_protid_nportclasses = 1;
+-int trivfs_cntl_nportclasses = 1;
+-
+ struct trivfs_control *fsys;
+
+ enum crash_action
+@@ -156,7 +155,7 @@ S_crash_dump_task (mach_port_t port,
+ mach_port_t user_proc = MACH_PORT_NULL;
+ enum crash_action how;
+
+- cred = ports_lookup_port (port_bucket, port, trivfs_protid_portclasses[0]);
++ cred = ports_lookup_port (port_bucket, port, trivfs_protid_class);
+ if (! cred)
+ return EOPNOTSUPP;
+
+@@ -415,11 +414,11 @@ dead_crasher (void *ptr)
+ /* The port data structures are cleaned up when we return. */
+
+ /* 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. Maybe we have no crashers still
+ around either. */
+@@ -428,9 +427,9 @@ dead_crasher (void *ptr)
+ exit (0);
+ ports_enable_class (crasher_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);
+ }
+
+
+@@ -563,20 +562,27 @@ main (int argc, char **argv)
+ /* Fetch our proc server port for easy use. */
+ 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);
+ crasher_portclass = ports_create_class (dead_crasher, 0);
+
++ 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_cntl_portclasses[0], port_bucket,
+- trivfs_protid_portclasses[0], port_bucket,
+- &fsys);
++ trivfs_control_class, NULL,
++ trivfs_protid_class, NULL, &fsys);
++
+ mach_port_deallocate (mach_task_self (), bootstrap);
+ if (err)
+ error (3, err, "Contacting parent");
+
++ port_bucket = fsys->pi.bucket;
++
+ /* Launch. */
+ do
+ ports_manage_port_operations_multithread (port_bucket, crash_demuxer,
+@@ -602,11 +608,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/crash 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. */
+@@ -629,9 +635,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
+
diff --git a/debian/patches/random-fixes0005-trans-ifsock-convert-to-trivfs-dynamic-classes-and-b.patch b/debian/patches/random-fixes0005-trans-ifsock-convert-to-trivfs-dynamic-classes-and-b.patch
new file mode 100644
index 00000000..e1a60cca
--- /dev/null
+++ b/debian/patches/random-fixes0005-trans-ifsock-convert-to-trivfs-dynamic-classes-and-b.patch
@@ -0,0 +1,52 @@
+From 419a283fa2981c47f2a117fa56f268c0ae5b5989 Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Sun, 27 Sep 2015 23:33:23 +0200
+Subject: [PATCH hurd 05/11] trans/ifsock: 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.
+
+* trans/ifsock.c: Convert to dynamic classes and buckets.
+---
+ trans/ifsock.c | 7 -------
+ 1 file changed, 7 deletions(-)
+
+diff --git a/trans/ifsock.c b/trans/ifsock.c
+index af2376a..13a2133 100644
+--- a/trans/ifsock.c
++++ b/trans/ifsock.c
+@@ -59,11 +59,6 @@ int trivfs_support_exec = 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;
+-
+ int
+ demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp)
+ {
+@@ -85,8 +80,6 @@ main (int argc, char **argv)
+ control_class = ports_create_class (trivfs_clean_cntl, 0);
+ node_class = ports_create_class (trivfs_clean_protid, 0);
+ port_bucket = ports_create_bucket ();
+- trivfs_protid_portclasses[0] = node_class;
+- trivfs_cntl_portclasses[0] = control_class;
+
+ task_get_bootstrap_port (mach_task_self (), &bootstrap);
+ if (bootstrap == MACH_PORT_NULL)
+--
+2.1.4
+
diff --git a/debian/patches/random-fixes0006-trans-magic-convert-to-trivfs-dynamic-classes-and-bu.patch b/debian/patches/random-fixes0006-trans-magic-convert-to-trivfs-dynamic-classes-and-bu.patch
new file mode 100644
index 00000000..31fd99d0
--- /dev/null
+++ b/debian/patches/random-fixes0006-trans-magic-convert-to-trivfs-dynamic-classes-and-bu.patch
@@ -0,0 +1,78 @@
+From 580eeae985138272dc0f8c24d1e7f470e31fbcc3 Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Sun, 27 Sep 2015 23:35:26 +0200
+Subject: [PATCH hurd 06/11] trans/magic: 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 severe bug. As no classes are given to
+`trivfs_startup', they are created and inserted into the dynamic
+vector of classes. The server function `trivfs_S_fsys_forward',
+however, used the first item of the previously used static array,
+which is NULL. This circumvented the typecheck.
+
+* trans/magic.c: Convert to dynamic classes and buckets.
+---
+ trans/magic.c | 16 +++++++++++-----
+ 1 file changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/trans/magic.c b/trans/magic.c
+index 5808483..a033db9 100644
+--- a/trans/magic.c
++++ b/trans/magic.c
+@@ -74,6 +74,9 @@ static struct trivfs_control *all_fsys;
+
+ /* Trivfs hooks */
+
++/* Our port class. */
++struct port_class *trivfs_protid_class;
++
+ int trivfs_fstype = FSTYPE_DEV;
+ int trivfs_fsid = 0;
+
+@@ -480,8 +483,12 @@ main (int argc, char **argv)
+ if (m->directory)
+ trivfs_peropen_destroy_hook = &magic_peropen_destroy;
+
++ 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, 0, 0, 0, 0, &fsys);
++ err = trivfs_startup (bootstrap, 0, 0, 0, trivfs_protid_class, 0, &fsys);
+ mach_port_deallocate (mach_task_self (), bootstrap);
+ if (err)
+ error (3, err, "Contacting parent");
+@@ -521,8 +528,7 @@ trivfs_S_fsys_forward (mach_port_t server,
+ char *argz, size_t argz_len)
+ {
+ struct trivfs_protid *cred
+- = ports_lookup_port (all_fsys->pi.bucket, server,
+- trivfs_protid_portclasses[0]);
++ = ports_lookup_port (all_fsys->pi.bucket, server, trivfs_protid_class);
+ if (!cred)
+ return EOPNOTSUPP;
+ ports_port_deref (cred);
+@@ -547,8 +553,8 @@ trivfs_S_fsys_forward (mach_port_t server,
+ /* Now we are ready to start up the filesystem. Contact the parent. */
+ struct trivfs_control *fsys;
+ err = trivfs_startup (requestor, 0,
+- trivfs_cntl_portclasses[0], all_fsys->pi.bucket,
+- trivfs_protid_portclasses[0], all_fsys->pi.bucket,
++ NULL, all_fsys->pi.bucket,
++ NULL, all_fsys->pi.bucket,
+ &fsys);
+ if (err)
+ {
+--
+2.1.4
+
diff --git a/debian/patches/random-fixes0007-trans-new-fifo-convert-to-trivfs-dynamic-classes-and.patch b/debian/patches/random-fixes0007-trans-new-fifo-convert-to-trivfs-dynamic-classes-and.patch
new file mode 100644
index 00000000..e5ae2186
--- /dev/null
+++ b/debian/patches/random-fixes0007-trans-new-fifo-convert-to-trivfs-dynamic-classes-and.patch
@@ -0,0 +1,74 @@
+From 125f08eea403724713cea1c79913cc7d26406a07 Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Sun, 27 Sep 2015 23:34:20 +0200
+Subject: [PATCH hurd 07/11] trans/new-fifo: 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.
+
+* trans/new-fifo.c: Convert to dynamic classes and buckets.
+---
+ trans/new-fifo.c | 28 ++++++++++++++--------------
+ 1 file changed, 14 insertions(+), 14 deletions(-)
+
+diff --git a/trans/new-fifo.c b/trans/new-fifo.c
+index e71c95c..0ceb842 100644
+--- a/trans/new-fifo.c
++++ b/trans/new-fifo.c
+@@ -176,13 +176,6 @@ fifo_trans_parse_args (struct fifo_trans *trans, int argc, char **argv,
+ return argp_parse (&argp, argc, argv, print_errs ? 0 : ARGP_SILENT, 0, 0);
+ }
+
+-/* ---------------------------------------------------------------- */
+-
+-struct port_class *trivfs_protid_portclasses[2];
+-struct port_class *trivfs_cntl_portclasses[1];
+-int trivfs_protid_nportclasses = 2;
+-int trivfs_cntl_nportclasses = 1;
+-
+ int
+ main (int argc, char **argv)
+ {
+@@ -215,14 +208,21 @@ main (int argc, char **argv)
+ exit (0);
+ }
+
+- port_bucket = ports_create_bucket ();
+- fifo_port_class = ports_create_class (trivfs_clean_protid, 0);
+- server_port_class = ports_create_class (trivfs_clean_protid, 0);
+- fsys_port_class = ports_create_class (clean_fsys, 0);
++ err = trivfs_add_port_bucket (&port_bucket);
++ if (err)
++ error (1, 0, "error creating port bucket");
++
++ err = trivfs_add_control_port_class (&fsys_port_class);
++ if (err)
++ error (1, 0, "error creating control port class");
++
++ err = trivfs_add_protid_port_class (&fifo_port_class);
++ if (err)
++ error (1, 0, "error creating protid port class");
+
+- trivfs_protid_portclasses[0] = fifo_port_class;
+- trivfs_protid_portclasses[1] = server_port_class;
+- trivfs_cntl_portclasses[0] = fsys_port_class;
++ err = trivfs_add_protid_port_class (&server_port_class);
++ if (err)
++ error (1, 0, "error creating protid port class");
+
+ /* Reply to our parent */
+ fifo_trans_start (trans, bootstrap);
+--
+2.1.4
+
diff --git a/debian/patches/random-fixes0008-trans-passwd-convert-to-trivfs-dynamic-classes-and-b.patch b/debian/patches/random-fixes0008-trans-passwd-convert-to-trivfs-dynamic-classes-and-b.patch
new file mode 100644
index 00000000..0006065a
--- /dev/null
+++ b/debian/patches/random-fixes0008-trans-passwd-convert-to-trivfs-dynamic-classes-and-b.patch
@@ -0,0 +1,128 @@
+From 65e63be1f4884a0223fe51ac6ff53ed11605506a Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Sun, 27 Sep 2015 16:26:03 +0200
+Subject: [PATCH hurd 08/11] trans/passwd: 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.
+
+* trans/password.c: Convert to dynamic classes and buckets.
+---
+ trans/password.c | 48 +++++++++++++++++++++++++++---------------------
+ 1 file changed, 27 insertions(+), 21 deletions(-)
+
+diff --git a/trans/password.c b/trans/password.c
+index 344b78b..9ffcaa0 100644
+--- a/trans/password.c
++++ b/trans/password.c
+@@ -39,6 +39,10 @@ const char *argp_program_version = STANDARD_HURD_VERSION (password);
+ /* Port bucket we service requests on. */
+ struct port_bucket *port_bucket;
+
++/* Our port classes. */
++struct port_class *trivfs_control_class;
++struct port_class *trivfs_protid_class;
++
+ /* Trivfs hooks. */
+ int trivfs_fstype = FSTYPE_MISC;
+ int trivfs_fsid = 0;
+@@ -46,12 +50,6 @@ int trivfs_support_read = 0;
+ int trivfs_support_write = 0;
+ int trivfs_support_exec = 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;
+-
+
+ static int
+ password_demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp)
+@@ -75,15 +73,23 @@ main (int argc, char *argv[])
+ if (bootstrap == MACH_PORT_NULL)
+ error (1, 0, "must be started as a translator");
+
+- 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);
+-
++ 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_cntl_portclasses[0], port_bucket,
+- trivfs_protid_portclasses[0], port_bucket,
+- &fsys);
++ trivfs_control_class, port_bucket,
++ trivfs_protid_class, port_bucket,
++ &fsys);
+ mach_port_deallocate (mach_task_self (), bootstrap);
+ if (err)
+ error (3, err, "Contacting parent");
+@@ -114,17 +120,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_control_class);
++ ports_inhibit_class_rpcs (trivfs_protid_class);
+
+ /* Are there any extant user ports for the /servers/password file? */
+- count = ports_count_class (trivfs_protid_portclasses[0]);
++ count = ports_count_class (trivfs_protid_class);
+ if (count > 0 && !(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_control_class);
++ ports_resume_class_rpcs (trivfs_protid_class);
+
+ return EBUSY;
+ }
+@@ -153,7 +159,7 @@ S_password_check_user (struct trivfs_protid *cred, uid_t user, char *pw,
+ return EOPNOTSUPP;
+
+ if (cred->pi.bucket != port_bucket ||
+- cred->pi.class != trivfs_protid_portclasses[0])
++ cred->pi.class != trivfs_protid_class)
+ {
+ ports_port_deref (cred);
+ return EOPNOTSUPP;
+@@ -201,7 +207,7 @@ S_password_check_group (struct trivfs_protid *cred, uid_t group, char *pw,
+ return EOPNOTSUPP;
+
+ if (cred->pi.bucket != port_bucket ||
+- cred->pi.class != trivfs_protid_portclasses[0])
++ cred->pi.class != trivfs_protid_class)
+ {
+ ports_port_deref (cred);
+ return EOPNOTSUPP;
+--
+2.1.4
+
diff --git a/debian/patches/random-fixes0009-trans-proxy-defpager-convert-to-trivfs-dynamic-class.patch b/debian/patches/random-fixes0009-trans-proxy-defpager-convert-to-trivfs-dynamic-class.patch
new file mode 100644
index 00000000..72054805
--- /dev/null
+++ b/debian/patches/random-fixes0009-trans-proxy-defpager-convert-to-trivfs-dynamic-class.patch
@@ -0,0 +1,65 @@
+From fcf89e5bb006f71ecf5c46b7248216c3dee7e4b8 Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Sun, 27 Sep 2015 17:23:13 +0200
+Subject: [PATCH hurd 09/11] trans/proxy-defpager: 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 severe bug. As no classes are given to
+`trivfs_startup', they are created and inserted into the dynamic
+vector of classes. The helper function `allowed', however, used the
+first item of the previously used static array, which is NULL. This
+circumvented the typecheck, allowing the default pager protocol to be
+spoken over control ports, likely resulting in a crash.
+
+* trans/proxy-defpager.c: Convert to dynamic classes and buckets.
+---
+ trans/proxy-defpager.c | 13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/trans/proxy-defpager.c b/trans/proxy-defpager.c
+index 5fe8ffd..662f269 100644
+--- a/trans/proxy-defpager.c
++++ b/trans/proxy-defpager.c
+@@ -30,11 +30,14 @@
+
+ static mach_port_t real_defpager, dev_master;
+
++/* Our port class. */
++struct port_class *trivfs_protid_class;
++
+ static error_t
+ allowed (mach_port_t port, int mode)
+ {
+- struct trivfs_protid *cred = ports_lookup_port
+- (0, port, trivfs_protid_portclasses[0]);
++ struct trivfs_protid *cred
++ = ports_lookup_port (0, port, trivfs_protid_class);
+ if (!cred)
+ return MIG_BAD_ID;
+ error_t result = (cred->po->openmodes & mode) ? 0 : EACCES;
+@@ -266,8 +269,12 @@ main (int argc, char **argv)
+
+ trivfs_fsid = getpid ();
+
++ 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, 0, 0, 0, 0, &fsys);
++ err = trivfs_startup (bootstrap, 0, 0, 0, trivfs_protid_class, 0, &fsys);
+ mach_port_deallocate (mach_task_self (), bootstrap);
+ if (err)
+ error (4, err, "Contacting parent");
+--
+2.1.4
+
diff --git a/debian/patches/random-fixes0010-libtrivfs-optimize-the-object-lookup-code.patch b/debian/patches/random-fixes0010-libtrivfs-optimize-the-object-lookup-code.patch
new file mode 100644
index 00000000..f19746f6
--- /dev/null
+++ b/debian/patches/random-fixes0010-libtrivfs-optimize-the-object-lookup-code.patch
@@ -0,0 +1,188 @@
+From 9fe7adc2907afdd2039a67d27328ba82a884561e Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Sun, 27 Sep 2015 18:55:39 +0200
+Subject: [PATCH hurd 10/11] libtrivfs: optimize the object lookup code
+
+* libtrivfs/mig-decls.h: Remove the specialized cases, they really
+blow up these functions that are supposed to be inlined. Also, look
+into the dynamically allocated vectors first, because this is the
+preferred way of using libtrivfs since 1997.
+---
+ libtrivfs/mig-decls.h | 136 +++++++++++++++++++-------------------------------
+ 1 file changed, 52 insertions(+), 84 deletions(-)
+
+diff --git a/libtrivfs/mig-decls.h b/libtrivfs/mig-decls.h
+index 13a9eb7..1909199 100644
+--- a/libtrivfs/mig-decls.h
++++ b/libtrivfs/mig-decls.h
+@@ -37,57 +37,41 @@ extern size_t trivfs_num_dynamic_port_buckets;
+ static inline struct trivfs_protid * __attribute__ ((unused))
+ trivfs_begin_using_protid (mach_port_t port)
+ {
+- if (trivfs_protid_nportclasses + trivfs_num_dynamic_protid_port_classes > 1)
++ struct port_info *pi = ports_lookup_port (0, port, 0);
++
++ if (pi)
+ {
+- struct port_info *pi = ports_lookup_port (0, port, 0);
+- int i;
+-
+- if (pi)
+- {
+- for (i = 0; i < trivfs_protid_nportclasses; i++)
+- if (pi->class == trivfs_protid_portclasses[i])
+- return (struct trivfs_protid *) pi;
+- for (i = 0; i < trivfs_num_dynamic_protid_port_classes; i++)
+- if (pi->class == trivfs_dynamic_protid_port_classes[i])
+- return (struct trivfs_protid *) pi;
+- ports_port_deref (pi);
+- }
+-
+- return 0;
++ size_t i;
++ for (i = 0; i < trivfs_num_dynamic_protid_port_classes; i++)
++ if (pi->class == trivfs_dynamic_protid_port_classes[i])
++ return (struct trivfs_protid *) pi;
++ for (i = 0; i < trivfs_protid_nportclasses; i++)
++ if (pi->class == trivfs_protid_portclasses[i])
++ return (struct trivfs_protid *) pi;
++ ports_port_deref (pi);
+ }
+- else if (trivfs_protid_nportclasses == 1)
+- return ports_lookup_port (0, port, trivfs_protid_portclasses[0]);
+- else
+- return ports_lookup_port (0, port, trivfs_dynamic_protid_port_classes[0]);
++
++ return NULL;
+ }
+
+ static inline struct trivfs_protid * __attribute__ ((unused))
+ trivfs_begin_using_protid_payload (unsigned long payload)
+ {
+- if (trivfs_protid_nportclasses + trivfs_num_dynamic_protid_port_classes > 1)
++ struct port_info *pi = ports_lookup_payload (NULL, payload, NULL);
++
++ if (pi)
+ {
+- struct port_info *pi = ports_lookup_payload (NULL, payload, NULL);
+- int i;
+-
+- if (pi)
+- {
+- for (i = 0; i < trivfs_protid_nportclasses; i++)
+- if (pi->class == trivfs_protid_portclasses[i])
+- return (struct trivfs_protid *) pi;
+- for (i = 0; i < trivfs_num_dynamic_protid_port_classes; i++)
+- if (pi->class == trivfs_dynamic_protid_port_classes[i])
+- return (struct trivfs_protid *) pi;
+- ports_port_deref (pi);
+- }
+-
+- return NULL;
++ size_t i;
++ for (i = 0; i < trivfs_num_dynamic_protid_port_classes; i++)
++ if (pi->class == trivfs_dynamic_protid_port_classes[i])
++ return (struct trivfs_protid *) pi;
++ for (i = 0; i < trivfs_protid_nportclasses; i++)
++ if (pi->class == trivfs_protid_portclasses[i])
++ return (struct trivfs_protid *) pi;
++ ports_port_deref (pi);
+ }
+- else if (trivfs_protid_nportclasses == 1)
+- return ports_lookup_payload (NULL, payload,
+- trivfs_protid_portclasses[0]);
+- else
+- return ports_lookup_payload (NULL, payload,
+- trivfs_dynamic_protid_port_classes[0]);
++
++ return NULL;
+ }
+
+ static inline void __attribute__ ((unused))
+@@ -100,57 +84,41 @@ trivfs_end_using_protid (struct trivfs_protid *cred)
+ static inline struct trivfs_control * __attribute__ ((unused))
+ trivfs_begin_using_control (mach_port_t port)
+ {
+- if (trivfs_cntl_nportclasses + trivfs_num_dynamic_control_port_classes > 1)
++ struct port_info *pi = ports_lookup_port (0, port, 0);
++
++ if (pi)
+ {
+- struct port_info *pi = ports_lookup_port (0, port, 0);
+- int i;
+-
+- if (pi)
+- {
+- for (i = 0; i < trivfs_cntl_nportclasses; i++)
+- if (pi->class == trivfs_cntl_portclasses[i])
+- return (struct trivfs_control *) pi;
+- for (i = 0; i < trivfs_num_dynamic_control_port_classes; i++)
+- if (pi->class == trivfs_dynamic_control_port_classes[i])
+- return (struct trivfs_control *) pi;
+- ports_port_deref (pi);
+- }
+-
+- return 0;
++ size_t i;
++ for (i = 0; i < trivfs_num_dynamic_control_port_classes; i++)
++ if (pi->class == trivfs_dynamic_control_port_classes[i])
++ return (struct trivfs_control *) pi;
++ for (i = 0; i < trivfs_cntl_nportclasses; i++)
++ if (pi->class == trivfs_cntl_portclasses[i])
++ return (struct trivfs_control *) pi;
++ ports_port_deref (pi);
+ }
+- else if (trivfs_cntl_nportclasses == 1)
+- return ports_lookup_port (0, port, trivfs_cntl_portclasses[0]);
+- else
+- return ports_lookup_port (0, port, trivfs_dynamic_control_port_classes[0]);
++
++ return NULL;
+ }
+
+ static inline struct trivfs_control * __attribute__ ((unused))
+ trivfs_begin_using_control_payload (unsigned long payload)
+ {
+- if (trivfs_cntl_nportclasses + trivfs_num_dynamic_control_port_classes > 1)
++ struct port_info *pi = ports_lookup_payload (NULL, payload, NULL);
++
++ if (pi)
+ {
+- struct port_info *pi = ports_lookup_payload (NULL, payload, NULL);
+- int i;
+-
+- if (pi)
+- {
+- for (i = 0; i < trivfs_cntl_nportclasses; i++)
+- if (pi->class == trivfs_cntl_portclasses[i])
+- return (struct trivfs_control *) pi;
+- for (i = 0; i < trivfs_num_dynamic_control_port_classes; i++)
+- if (pi->class == trivfs_dynamic_control_port_classes[i])
+- return (struct trivfs_control *) pi;
+- ports_port_deref (pi);
+- }
+-
+- return NULL;
++ size_t i;
++ for (i = 0; i < trivfs_num_dynamic_control_port_classes; i++)
++ if (pi->class == trivfs_dynamic_control_port_classes[i])
++ return (struct trivfs_control *) pi;
++ for (i = 0; i < trivfs_cntl_nportclasses; i++)
++ if (pi->class == trivfs_cntl_portclasses[i])
++ return (struct trivfs_control *) pi;
++ ports_port_deref (pi);
+ }
+- else if (trivfs_cntl_nportclasses == 1)
+- return ports_lookup_payload (NULL, payload,
+- trivfs_cntl_portclasses[0]);
+- else
+- return ports_lookup_payload (NULL, payload,
+- trivfs_dynamic_control_port_classes[0]);
++
++ return NULL;
+ }
+
+ static inline void __attribute__ ((unused))
+--
+2.1.4
+
diff --git a/debian/patches/random-fixes0011-libtrivfs-deprecate-old-api.patch b/debian/patches/random-fixes0011-libtrivfs-deprecate-old-api.patch
new file mode 100644
index 00000000..a1c4eaf2
--- /dev/null
+++ b/debian/patches/random-fixes0011-libtrivfs-deprecate-old-api.patch
@@ -0,0 +1,39 @@
+From 379feba88080eb8cd731bbd64b98cc0bbf10931a Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Sun, 27 Sep 2015 23:37:44 +0200
+Subject: [PATCH hurd 11/11] libtrivfs: deprecate old api
+
+* libtrivfs/trivfs.h (trivfs_protid_portclasses): Deprecate, and
+schedule for removal in Hurd 0.8.
+(trivfs_protid_nportclasses): Likewise.
+(trivfs_cntl_portclasses): Likewise.
+(trivfs_cntl_nportclasses): Likewise.
+---
+ libtrivfs/trivfs.h | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/libtrivfs/trivfs.h b/libtrivfs/trivfs.h
+index 8902338..d620a7b 100644
+--- a/libtrivfs/trivfs.h
++++ b/libtrivfs/trivfs.h
+@@ -79,10 +79,13 @@ extern int trivfs_allow_open;
+ pointers for passing to rpcs, in addition to those passed to or created by
+ trivfs_create_control (or trivfs_startup) will automatically be
+ recognized. */
+-extern struct port_class *trivfs_protid_portclasses[];
+-extern int trivfs_protid_nportclasses;
+-extern struct port_class *trivfs_cntl_portclasses[];
+-extern int trivfs_cntl_nportclasses;
++/* Deprecation notice: The use of these vectors is deprecated. Please
++ use the dynamic class support. These vectors will be removed in
++ Hurd 0.8. */
++extern struct port_class *trivfs_protid_portclasses[] __attribute__ ((deprecated));
++extern int trivfs_protid_nportclasses __attribute__ ((deprecated));
++extern struct port_class *trivfs_cntl_portclasses[] __attribute__ ((deprecated));
++extern int trivfs_cntl_nportclasses __attribute__ ((deprecated));
+
+ /* The user must define this function. This should modify a struct
+ stat (as returned from the underlying node) for presentation to
+--
+2.1.4
+
diff --git a/debian/patches/series b/debian/patches/series
index 68dfa6ca..e1d6ed28 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -75,3 +75,14 @@ introspection0009-fixup_libports.patch
introspection0010-fixup_libintrospection.patch
introspection0011-fixup_libintrospection.patch
introspection0012-fixup_libintrospection.patch
+random-fixes0001-exec-convert-to-trivfs-dynamic-classes-and-buckets.patch
+random-fixes0002-pfinet-convert-to-trivfs-dynamic-classes-and-buckets.patch
+random-fixes0003-pflocal-convert-to-trivfs-dynamic-classes-and-bucket.patch
+random-fixes0004-trans-crash-convert-to-trivfs-dynamic-classes-and-bu.patch
+random-fixes0005-trans-ifsock-convert-to-trivfs-dynamic-classes-and-b.patch
+random-fixes0006-trans-magic-convert-to-trivfs-dynamic-classes-and-bu.patch
+random-fixes0007-trans-new-fifo-convert-to-trivfs-dynamic-classes-and.patch
+random-fixes0008-trans-passwd-convert-to-trivfs-dynamic-classes-and-b.patch
+random-fixes0009-trans-proxy-defpager-convert-to-trivfs-dynamic-class.patch
+random-fixes0010-libtrivfs-optimize-the-object-lookup-code.patch
+random-fixes0011-libtrivfs-deprecate-old-api.patch