From eae82693bf1ed63dd63e5c2d78522bab37ab4ac5 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Tue, 24 Nov 2015 01:34:02 +0100 Subject: drop old patch series --- debian/patches/series | 4 - ...shelp-acquire-references-to-control-ports.patch | 59 --------- ...bihash-add-general-purpose-hash-functions.patch | 143 --------------------- ...ist0003-libfshelp-improve-translator-list.patch | 127 ------------------ .../translators-list0004-add-iteration.patch | 28 ---- 5 files changed, 361 deletions(-) delete mode 100644 debian/patches/translators-list0001-libfshelp-acquire-references-to-control-ports.patch delete mode 100644 debian/patches/translators-list0002-libihash-add-general-purpose-hash-functions.patch delete mode 100644 debian/patches/translators-list0003-libfshelp-improve-translator-list.patch delete mode 100644 debian/patches/translators-list0004-add-iteration.patch (limited to 'debian/patches') diff --git a/debian/patches/series b/debian/patches/series index 91acd278..04e8bde9 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -62,7 +62,3 @@ nodeihash0002-xxx-fix-node-iteration.patch ext2fs-optimize-bcache0001-ext2fs-improve-the-block-cache.patch ext2fs-optimize-bcache0002-ext2fs-disable-block-cache-debugging-by-default.patch ext2fs-optimize-bcache0003-ext2fs-keep-list-of-reusable-disk-cache-entries.patch -translators-list0001-libfshelp-acquire-references-to-control-ports.patch -translators-list0002-libihash-add-general-purpose-hash-functions.patch -translators-list0003-libfshelp-improve-translator-list.patch -translators-list0004-add-iteration.patch diff --git a/debian/patches/translators-list0001-libfshelp-acquire-references-to-control-ports.patch b/debian/patches/translators-list0001-libfshelp-acquire-references-to-control-ports.patch deleted file mode 100644 index b9981cb8..00000000 --- a/debian/patches/translators-list0001-libfshelp-acquire-references-to-control-ports.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 7bf9bb0eb7f9c0340044754023c62633f69369c0 Mon Sep 17 00:00:00 2001 -From: Justus Winter <4winter@informatik.uni-hamburg.de> -Date: Fri, 20 Nov 2015 12:46:56 +0100 -Subject: [PATCH hurd 1/4] libfshelp: acquire references to control ports - -* libfshelp/translator-list.c (translator_ihash_cleanup): Release reference. -(fshelp_set_active_translator): Acquire reference ---- - libfshelp/translator-list.c | 16 ++++++++++++---- - 1 file changed, 12 insertions(+), 4 deletions(-) - -diff --git a/libfshelp/translator-list.c b/libfshelp/translator-list.c -index c87bbaa..87d7f6a 100644 ---- a/libfshelp/translator-list.c -+++ b/libfshelp/translator-list.c -@@ -49,12 +49,13 @@ static pthread_mutex_t translator_ihash_lock = PTHREAD_MUTEX_INITIALIZER; - static void - translator_ihash_cleanup (void *element, void *arg) - { -+ error_t err; - struct translator *translator = element; - - if (translator->pi) - ports_port_deref (translator->pi); -- /* No need to deallocate translator->active, we only keep the name of -- the port, not a reference. */ -+ err = mach_port_deallocate (mach_task_self (), translator->active); -+ assert_perror (err); - free (translator->name); - free (translator); - } -@@ -124,8 +125,14 @@ fshelp_set_active_translator (struct port_info *pi, - t->pi = pi; - } - -- /* No need to increment the reference count, we only keep the -- name, not a reference. */ -+ if (MACH_PORT_VALID (t->active)) -+ { -+ err = mach_port_deallocate (mach_task_self (), t->active); -+ assert_perror (err); -+ } -+ err = mach_port_mod_refs (mach_task_self (), active, -+ MACH_PORT_RIGHT_SEND, +1); -+ assert_perror (err); - t->active = active; - } - else -@@ -143,6 +150,7 @@ error_t - fshelp_remove_active_translator (mach_port_t active) - { - error_t err = 0; -+ - pthread_mutex_lock (&translator_ihash_lock); - - struct translator *t = NULL; --- -2.1.4 - diff --git a/debian/patches/translators-list0002-libihash-add-general-purpose-hash-functions.patch b/debian/patches/translators-list0002-libihash-add-general-purpose-hash-functions.patch deleted file mode 100644 index 182768ea..00000000 --- a/debian/patches/translators-list0002-libihash-add-general-purpose-hash-functions.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 4cc5cec01a0fa4b22ec7d4084b0bfb9b70e5cbf1 Mon Sep 17 00:00:00 2001 -From: Justus Winter <4winter@informatik.uni-hamburg.de> -Date: Tue, 24 Nov 2015 01:07:32 +0100 -Subject: [PATCH hurd 2/4] libihash: add general purpose hash functions - -* libihash/Makefile (SRCS): Add new file. -* libihash/fasthash.c: New file. -* libihash/ihash.h (hurd_ihash_fasthash{32,64}): New prototypes. ---- - libihash/Makefile | 2 +- - libihash/fasthash.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++ - libihash/ihash.h | 14 ++++++++++ - 3 files changed, 90 insertions(+), 1 deletion(-) - create mode 100644 libihash/fasthash.c - -diff --git a/libihash/Makefile b/libihash/Makefile -index 09bb136..eb5d87e 100644 ---- a/libihash/Makefile -+++ b/libihash/Makefile -@@ -20,7 +20,7 @@ dir := libihash - makemode := library - - libname := libihash --SRCS = ihash.c -+SRCS = ihash.c fasthash.c - installhdrs = ihash.h - - OBJS = $(SRCS:.c=.o) -diff --git a/libihash/fasthash.c b/libihash/fasthash.c -new file mode 100644 -index 0000000..d13629c ---- /dev/null -+++ b/libihash/fasthash.c -@@ -0,0 +1,75 @@ -+/* The MIT License -+ -+ Copyright (C) 2012 Zilong Tan (eric.zltan@gmail.com) -+ -+ Permission is hereby granted, free of charge, to any person -+ obtaining a copy of this software and associated documentation -+ files (the "Software"), to deal in the Software without -+ restriction, including without limitation the rights to use, copy, -+ modify, merge, publish, distribute, sublicense, and/or sell copies -+ of the Software, and to permit persons to whom the Software is -+ furnished to do so, subject to the following conditions: -+ -+ The above copyright notice and this permission notice shall be -+ included in all copies or substantial portions of the Software. -+ -+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -+ SOFTWARE. -+*/ -+ -+#include "fasthash.h" -+ -+// Compression function for Merkle-Damgard construction. -+// This function is generated using the framework provided. -+#define mix(h) ({ \ -+ (h) ^= (h) >> 23; \ -+ (h) *= 0x2127599bf4325c37ULL; \ -+ (h) ^= (h) >> 47; }) -+ -+uint64_t hurd_ihash_fasthash64(const void *buf, size_t len, uint64_t seed) -+{ -+ const uint64_t m = 0x880355f21e6d1965ULL; -+ const uint64_t *pos = (const uint64_t *)buf; -+ const uint64_t *end = pos + (len / 8); -+ const unsigned char *pos2; -+ uint64_t h = seed ^ (len * m); -+ uint64_t v; -+ -+ while (pos != end) { -+ v = *pos++; -+ h ^= mix(v); -+ h *= m; -+ } -+ -+ pos2 = (const unsigned char*)pos; -+ v = 0; -+ -+ switch (len & 7) { -+ case 7: v ^= (uint64_t)pos2[6] << 48; -+ case 6: v ^= (uint64_t)pos2[5] << 40; -+ case 5: v ^= (uint64_t)pos2[4] << 32; -+ case 4: v ^= (uint64_t)pos2[3] << 24; -+ case 3: v ^= (uint64_t)pos2[2] << 16; -+ case 2: v ^= (uint64_t)pos2[1] << 8; -+ case 1: v ^= (uint64_t)pos2[0]; -+ h ^= mix(v); -+ h *= m; -+ } -+ -+ return mix(h); -+} -+ -+uint32_t hurd_ihash_fasthash32(const void *buf, size_t len, uint32_t seed) -+{ -+ // the following trick converts the 64-bit hashcode to Fermat -+ // residue, which shall retain information from both the higher -+ // and lower parts of hashcode. -+ uint64_t h = hurd_ihash_fasthash64(buf, len, seed); -+ return h - (h >> 32); -+} -diff --git a/libihash/ihash.h b/libihash/ihash.h -index 986291b..50676a6 100644 ---- a/libihash/ihash.h -+++ b/libihash/ihash.h -@@ -136,6 +136,13 @@ typedef struct hurd_ihash *hurd_ihash_t; - .max_load = HURD_IHASH_MAX_LOAD_DEFAULT, \ - .locp_offset = (locp_offs)} - -+#define HURD_IHASH_INITIALIZER_GKI(locp_offs, cleanup, hash, compare) \ -+ { .nr_items = 0, .size = 0, .cleanup = (cleanup), \ -+ .max_load = HURD_IHASH_MAX_LOAD_DEFAULT, \ -+ .locp_offset = (locp_offs), \ -+ .fct_hash = (hash), \ -+ .fct_cmp = (compare)} \ -+ - /* Initialize the hash table at address HT. If LOCP_OFFSET is not - HURD_IHASH_NO_LOCP, then this is an offset (in bytes) from the - address of a hash value where a location pointer can be found. The -@@ -339,5 +346,12 @@ int hurd_ihash_remove (hurd_ihash_t ht, hurd_ihash_key_t key); - was provided to hurd_ihash_add(). This call is faster than - hurd_ihash_remove(). */ - void hurd_ihash_locp_remove (hurd_ihash_t ht, hurd_ihash_locp_t locp); -+ -+/* General purpose hash functions. */ -+ -+/* Zilong Tans fast-hash. Based on 'Marsaglia, George. "Xorshift -+ rngs." Journal of Statistical Software 8.14 (2003): 1-6.' */ -+uint32_t hurd_ihash_fasthash32 (const void *buf, size_t len, uint32_t seed); -+uint64_t hurd_ihash_fasthash64 (const void *buf, size_t len, uint64_t seed); - - #endif /* _HURD_IHASH_H */ --- -2.1.4 - diff --git a/debian/patches/translators-list0003-libfshelp-improve-translator-list.patch b/debian/patches/translators-list0003-libfshelp-improve-translator-list.patch deleted file mode 100644 index 203a2f96..00000000 --- a/debian/patches/translators-list0003-libfshelp-improve-translator-list.patch +++ /dev/null @@ -1,127 +0,0 @@ -From f2b791571de10efefd4357e4bb6bdfa4e2d0c218 Mon Sep 17 00:00:00 2001 -From: Justus Winter <4winter@informatik.uni-hamburg.de> -Date: Tue, 24 Nov 2015 01:20:57 +0100 -Subject: [PATCH hurd 3/4] libfshelp: improve translator list - -Use the path names of active translators as keys in the hash table. - -* libfshelp/translator-list.c (hash, compare): New functions. -(translator_ihash): Use generalized key interface. -(fshelp_set_active_translator): Update accordingly. -(fshelp_remove_active_translator): Likewise. ---- - libfshelp/translator-list.c | 59 +++++++++++++++++++++++++++------------------ - 1 file changed, 35 insertions(+), 24 deletions(-) - -diff --git a/libfshelp/translator-list.c b/libfshelp/translator-list.c -index 87d7f6a..fa754ae 100644 ---- a/libfshelp/translator-list.c -+++ b/libfshelp/translator-list.c -@@ -1,6 +1,6 @@ - /* A list of active translators. - -- Copyright (C) 2013,14 Free Software Foundation, Inc. -+ Copyright (C) 2013,14,15 Free Software Foundation, Inc. - - Written by Justus Winter <4winter@informatik.uni-hamburg.de> - -@@ -39,18 +39,12 @@ struct translator - mach_port_t active; - }; - --/* The list of active translators. */ --static struct hurd_ihash translator_ihash -- = HURD_IHASH_INITIALIZER (HURD_IHASH_NO_LOCP); -- --/* The lock protecting the translator_ihash. */ --static pthread_mutex_t translator_ihash_lock = PTHREAD_MUTEX_INITIALIZER; -- -+/* The hash table requires some callback functions. */ - static void --translator_ihash_cleanup (void *element, void *arg) -+cleanup (void *value, void *arg) - { - error_t err; -- struct translator *translator = element; -+ struct translator *translator = value; - - if (translator->pi) - ports_port_deref (translator->pi); -@@ -60,6 +54,26 @@ translator_ihash_cleanup (void *element, void *arg) - free (translator); - } - -+static hurd_ihash_key_t -+hash (void *key) -+{ -+ const char *path = key; -+ return (hurd_ihash_key_t) hurd_ihash_fasthash32 (path, strlen (path), 0); -+} -+ -+static int -+compare (void *a, void *b) -+{ -+ return strcmp ((const char *) a, (const char *) b) == 0; -+} -+ -+/* The list of active translators. */ -+static struct hurd_ihash translator_ihash -+ = HURD_IHASH_INITIALIZER_GKI (HURD_IHASH_NO_LOCP, cleanup, hash, compare); -+ -+/* The lock protecting the translator_ihash. */ -+static pthread_mutex_t translator_ihash_lock = PTHREAD_MUTEX_INITIALIZER; -+ - /* Record an active translator being bound to the given file name - NAME. ACTIVE is the control port of the translator. */ - error_t -@@ -68,20 +82,16 @@ fshelp_set_active_translator (struct port_info *pi, - mach_port_t active) - { - error_t err = 0; -- pthread_mutex_lock (&translator_ihash_lock); -- -- if (! translator_ihash.cleanup) -- hurd_ihash_set_cleanup (&translator_ihash, translator_ihash_cleanup, NULL); -+ struct translator *t; -+ hurd_ihash_locp_t slot; - -- struct translator *t = NULL; -- HURD_IHASH_ITERATE (&translator_ihash, value) -- { -- t = value; -- if (strcmp (name, t->name) == 0) -- goto update; /* Entry exists. */ -- } -+ pthread_mutex_lock (&translator_ihash_lock); -+ t = hurd_ihash_locp_find (&translator_ihash, (hurd_ihash_key_t) name, -+ &slot); -+ if (t) -+ goto update; /* Entry exists. */ - -- t = malloc (sizeof (struct translator)); -+ t = malloc (sizeof *t); - if (! t) - { - err = errno; -@@ -98,7 +108,8 @@ fshelp_set_active_translator (struct port_info *pi, - goto out; - } - -- err = hurd_ihash_add (&translator_ihash, (hurd_ihash_key_t) t, t); -+ err = hurd_ihash_locp_add (&translator_ihash, slot, -+ (hurd_ihash_key_t) t->name, t); - if (err) - goto out; - -@@ -165,7 +176,7 @@ fshelp_remove_active_translator (mach_port_t active) - } - - if (t) -- hurd_ihash_remove (&translator_ihash, (hurd_ihash_key_t) t); -+ hurd_ihash_remove (&translator_ihash, (hurd_ihash_key_t) t->name); - - pthread_mutex_unlock (&translator_ihash_lock); - return err; --- -2.1.4 - diff --git a/debian/patches/translators-list0004-add-iteration.patch b/debian/patches/translators-list0004-add-iteration.patch deleted file mode 100644 index 9a7b1270..00000000 --- a/debian/patches/translators-list0004-add-iteration.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 20e4d911a985f033653b76589f8b7b4fb26c63b3 Mon Sep 17 00:00:00 2001 -From: Justus Winter <4winter@informatik.uni-hamburg.de> -Date: Fri, 20 Nov 2015 12:47:06 +0100 -Subject: [PATCH hurd 4/4] add iteration - ---- - libfshelp/translator-list.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/libfshelp/translator-list.c b/libfshelp/translator-list.c -index fa754ae..5c137d7 100644 ---- a/libfshelp/translator-list.c -+++ b/libfshelp/translator-list.c -@@ -235,3 +235,11 @@ fshelp_get_active_translators (char **translators, - pthread_mutex_unlock (&translator_ihash_lock); - return err; - } -+ -+/* For each active node, call FUN. The node is to be locked around the call -+ to FUN. If FUN returns non-zero for any node, then immediately stop, and -+ return that value. */ -+error_t __attribute__ ((weak)) -+fshelp_iterate_active_translators (error_t (*fun)(struct node *)) -+{ -+} --- -2.1.4 - -- cgit v1.2.3