summaryrefslogtreecommitdiff
path: root/debian/patches/random-fixes0009-libtrivfs-optimize-the-object-lookup-code.patch
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2015-09-27 19:09:42 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2015-09-27 19:09:42 +0200
commitf528223eb6cf63953c8c616aade6ff53c8e18efd (patch)
treed3cf0a4d471c8c21ef28f5770e180806d7b9a7f3 /debian/patches/random-fixes0009-libtrivfs-optimize-the-object-lookup-code.patch
parent5cf8db6e5ec9e4edfec1a9b653d02c320c833ec3 (diff)
add patch series
Diffstat (limited to 'debian/patches/random-fixes0009-libtrivfs-optimize-the-object-lookup-code.patch')
-rw-r--r--debian/patches/random-fixes0009-libtrivfs-optimize-the-object-lookup-code.patch188
1 files changed, 188 insertions, 0 deletions
diff --git a/debian/patches/random-fixes0009-libtrivfs-optimize-the-object-lookup-code.patch b/debian/patches/random-fixes0009-libtrivfs-optimize-the-object-lookup-code.patch
new file mode 100644
index 00000000..a2985511
--- /dev/null
+++ b/debian/patches/random-fixes0009-libtrivfs-optimize-the-object-lookup-code.patch
@@ -0,0 +1,188 @@
+From 03093ef7b417e59e5decc96212f5aef322ec6036 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 9/9] 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
+