Re: [PATCH 04/11] libports: lock-less reference counting for port_info objects

2014-05-13 Thread Justus Winter
Quoting Samuel Thibault (2014-05-13 00:28:38) > Justus Winter, le Mon 12 May 2014 12:05:42 +0200, a écrit : > > - pthread_mutex_lock (&_ports_lock); > >pthread_mutex_lock (&_ports_htable_lock); > > > >if (_ports_htable.nr_items == 0) > > @@ -60

Re: [PATCH 03/11] include: add lock-less reference counting primitives

2014-05-13 Thread Justus Winter
Quoting Samuel Thibault (2014-05-13 12:55:29) > Justus Winter, le Tue 13 May 2014 12:52:03 +0200, a écrit : > > Quoting Neal H. Walfield (2014-05-13 09:44:21) > > > At Mon, 12 May 2014 12:05:41 +0200, > > > Justus Winter wrote: > > > > +/* Decrement REF. Re

[PATCH 3/7] libihash: use linear probing and fast modulo operation

2014-05-13 Thread Justus Winter
libihash uses open addressing. Previously, quadratic probing in both directions was used to resolve collisions. Quadratic probing might result in a less efficient use of caches. Also, prime numbers of the form 4 * i + 3 were used as array sizes. This was used in combination with the integer modu

[PATCH 2/7] libihash: use an integer hash function on the keys

2014-05-13 Thread Justus Winter
Use an integer hash function to derive the index from the key. This should reduce the number of collisions. * libihash/ihash.c (hash_int32): New function. (find_index): Use hash_int32 on the key to derive the index. (add_one): Likewise. --- libihash/ihash.c | 17 +++-- 1 file changed

[PATCH 1/7] libihash: fix type of max_load

2014-05-13 Thread Justus Winter
Previously, int was used for the field max_load of struct hurd_ihash. There is no reason for this as far as I can tell. Furthermore, hurd_ihash_set_max_load takes an unsigned int max_load. * libihash/ihash.h (struct hurd_ihash): Use unsigned int for field max_load. --- libihash/ihash.h | 2 +- 1

[PATCH 7/7] libtrivfs: lock-less reference counting for trivfs_peropen objects

2014-05-13 Thread Justus Winter
* libtrivfs/trivfs.h (struct trivfs_peropen): Use refcount_t for field refcnt. (struct trivfs_control): Remove unused field lock. * libtrivfs/cntl-create.c (trivfs_create_control): Drop the mutex initialization. * libtrivfs/io-reauthenticate.c (trivfs_S_io_reauthenticate): Adjust accordingly. * lib

[PATCH 6/7] libdiskfs: lock-less reference counting for peropen objects

2014-05-13 Thread Justus Winter
* libdiskfs/diskfs.h (struct peropen): Use refcount_t for field refcnt. * libdiskfs/peropen-make.c (diskfs_make_peropen): Initialize refcnt. * libdiskfs/peropen-rele.c (diskfs_release_peropen): Adjust accordingly. * libdiskfs/protid-make.c (diskfs_start_protid): Likewise. Also, the node must no lo

[PATCH 5/7] include: add lock-less reference counting primitives

2014-05-13 Thread Justus Winter
/null +++ b/include/refcount.h @@ -0,0 +1,193 @@ +/* Lock-less reference counting primitives + + Copyright (C) 2014 Free Software Foundation, Inc. + + Written by Justus Winter <4win...@informatik.uni-hamburg.de> + + This file is part of the GNU Hurd. + + The GNU Hurd is free software; y

[PATCH 4/7] libihash: use fast binary scaling to determine the load

2014-05-13 Thread Justus Winter
Expressing the maximum load in binary percent (where 128b% corresponds to 100%) allows us to use fast binary scaling to determine if the maximum load has been reached without losing precision. Furthermore, the previously used expression 'ht->nr_items * 100' overflows int at 2^25 (unsigned int at 2

Re: [PATCH 2/3] i386: add io_map_cached

2014-05-15 Thread Justus Winter
Quoting Samuel Thibault (2014-05-15 02:13:13) > Hello, > > Justus Winter, le Fri 02 May 2014 21:33:01 +0200, a écrit : > > io_map_cached is like io_map, but reuses the old mapping if it is > > applicable. > > But AIUI, if it is not applicable, it does not unmap the pre

[PATCH 5/5] include: add lock-less reference counting primitives

2014-05-15 Thread Justus Winter
/null +++ b/include/refcount.h @@ -0,0 +1,263 @@ +/* Lock-less reference counting primitives + + Copyright (C) 2014 Free Software Foundation, Inc. + + Written by Justus Winter <4win...@informatik.uni-hamburg.de> + + This file is part of the GNU Hurd. + + The GNU Hurd is free software; y

[PATCH 3/5] libihash: add hurd_ihash_value_valid

2014-05-15 Thread Justus Winter
* libihash/ihash.h (hurd_ihash_value_valid): New function. * libihash/ihash.c (index_empty): Use hurd_ihash_value_valid. --- libihash/ihash.c | 3 +-- libihash/ihash.h | 7 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libihash/ihash.c b/libihash/ihash.c index 4d9cc18..5b7

next round of patches

2014-05-15 Thread Justus Winter
Hi :) [PATCH 1/5] libihash: fix typo [PATCH 2/5] libihash: add hurd_ihash_get_load This also makes the description of binary percent more prominent. [PATCH 3/5] libihash: add hurd_ihash_value_valid [PATCH 4/5] libihash: optimize lookup-or-insert operations I'm replacing the node caches in {ext2

[PATCH 2/5] libihash: add hurd_ihash_get_load

2014-05-15 Thread Justus Winter
* libihash/ihash.c (hurd_ihash_add): Move the code computing the load factor of the hash table... * libihash/ihash.h (hurd_ihash_get_load): ... here, together with the comment describing the method and the rationale for chosing binary percent. --- libihash/ihash.c | 20 ++-- libiha

[PATCH 1/5] libihash: fix typo

2014-05-15 Thread Justus Winter
* libihash/ihash.c (hurd_ihash_add): Fix typo. --- libihash/ihash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libihash/ihash.c b/libihash/ihash.c index 151c1a7..f20ba61 100644 --- a/libihash/ihash.c +++ b/libihash/ihash.c @@ -302,7 +302,7 @@ hurd_ihash_add (hurd_ihash_t h

[PATCH 4/5] libihash: optimize lookup-or-insert operations

2014-05-15 Thread Justus Winter
If libihash is used to implement a cache, a insertion is always preceeded by a lookup. hurd_ihash_add has to do the lookup again. Provide a new pair of functions, hurd_ihash_locp_add and hurd_ihash_locp_find, that can be used in combination to avoid the second lookup. * libihash/ihash.c (hurd_ih

[PATCH 3/4] trans/fakeroot: use C99-style struct initialization

2014-05-16 Thread Justus Winter
* trans/fakeroot.c (main): Use C99-style struct initialization to initialize argp. This avoids a warning about missing field initializers. --- trans/fakeroot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trans/fakeroot.c b/trans/fakeroot.c index 3107e29..c4b95de 100644 ---

[PATCH 1/4] trans/fakeroot: remove spurious semicolon

2014-05-16 Thread Justus Winter
A spurious semicolon caused a control flow bug in check_openmodes, leading to a port leak. * trans/fakeroot.c (check_openmodes): Remove spurious semicolon. --- trans/fakeroot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trans/fakeroot.c b/trans/fakeroot.c index 987af24..0

[PATCH 4/4] proc: move translation functions to mig-decls.h

2014-05-16 Thread Justus Winter
* proc/hash.c (reqport_find): Move this function... * proc/proc.h (process_drop): ... and this... * proc/mig-decls.h: ... here and rename them. * proc/mig-mutate.h: Update accordingly. --- proc/hash.c | 11 --- proc/mig-decls.h | 18 ++ proc/mig-mutate.h | 6 +++---

[PATCH 2/4] trans/fakeroot: fix comparison between signed and unsigned

2014-05-16 Thread Justus Winter
* trans/fakeroot.c (netfs_attempt_chown): Fix comparison between signed and unsigned integer expressions. --- trans/fakeroot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trans/fakeroot.c b/trans/fakeroot.c index 0ea3cbf..3107e29 100644 --- a/trans/fakeroot.c +++ b/tran

[PATCH 3/4] trans/fakeroot: use fat nodes to simplify the node cache

2014-05-18 Thread Justus Winter
Previously, fakeroot stored netnodes in the hash table. But we are not interested in a cache for netnodes, we need a node cache. So fakeroot kept pointers to the associated node object in each netnode object. Use fat netfs nodes, which combine node and netnode objects. * trans/fakeroot.c (struc

[PATCH 2/4] libnetfs: add netfs_make_node_alloc to allocate fat nodes

2014-05-18 Thread Justus Winter
libnetfs has two kind of nodes, struct node and struct netnode. struct node is used to store libnetfs specific data, while struct netnode contains user supplied data. Previously, both objects were allocated separatly, and a pointer from the node to the netnode provided a mapping from the former to

[PATCH 4/4] trans/fakeroot: use netfs_node_netnode instead of np->nn

2014-05-18 Thread Justus Winter
When using fat nodes, expressions of the form E->nn can be rewritten as netfs_node_netnode (E). This is much faster as it only involves a offset calculation. For reference, I used the following semantic patch to create the patch: @@ expression E; @@ - E->nn + netfs_node_netnode (E) * trans/fak

[PATCH 1/4] libdiskfs: add diskfs_make_node_alloc to allocate fat nodes

2014-05-18 Thread Justus Winter
libdiskfs has two kind of nodes, struct node and struct netnode. struct node is used to store libdiskfs specific data, while struct netnode contains user supplied data. Previously, both objects were allocated separatly, and a pointer from the node to the netnode provided a mapping from the former

[PATCH] trans/fakeroot: override fshelp_isowner

2014-05-20 Thread Justus Winter
As of recently, fakeroot would fail to create symlinks: % fakeroot-hurd ln -s foo a ln: failed to create symbolic link ‘a’: Operation not permitted Fix this by overriding fshelp_isowner. Various netfs functions will call fshelp_isowner to check whether USER is allowed to do some operation. As f

Re: [PATCH 1/4] libdiskfs: add diskfs_make_node_alloc to allocate fat nodes

2014-05-21 Thread Justus Winter
Quoting Samuel Thibault (2014-05-20 21:25:10) > Hello, > > Justus Winter, le Sun 18 May 2014 15:24:52 +0200, a écrit : > > - ino64_t cache_id; > > - > >int author_tracks_uid; > > + > > + /* This is the last field. We do this so that if the node is &

[PATCH 07/11] Avoid compiler warning about empty bodies

2014-05-22 Thread Justus Winter
Make empty bodies of control flow statements more explicit. Doing so will allow us to use stricter compiler settings. This would have cought 4ece292c. * console-client/xkb/xkb.c: Make empty bodies more explicit * libpipe/pipe.c: Likewise. * mach-defpager/default_pager.c: Likewise. * pfinet/linux

[PATCH 09/11] libnetfs: add netfs_make_node_alloc to allocate fat nodes

2014-05-22 Thread Justus Winter
libnetfs has two kind of nodes, struct node and struct netnode. struct node is used to store libnetfs specific data, while struct netnode contains user supplied data. Previously, both objects were allocated separatly, and a pointer from the node to the netnode provided a mapping from the former to

[PATCH 01/11] include: install refcount.h

2014-05-22 Thread Justus Winter
* include/Makefile (installhdrs): Add refcount.h. --- include/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/Makefile b/include/Makefile index b8773fe..4de165d 100644 --- a/include/Makefile +++ b/include/Makefile @@ -22,7 +22,7 @@ dir := include makemode :=

[PATCH 02/11] exec: add missing includes

2014-05-22 Thread Justus Winter
* exec/exec.c: Include mach/gnumach.h. * exec/main.c: Include device/device.h. --- exec/exec.c | 1 + exec/main.c | 1 + 2 files changed, 2 insertions(+) diff --git a/exec/exec.c b/exec/exec.c index b068f5e..2fc1e44 100644 --- a/exec/exec.c +++ b/exec/exec.c @@ -24,6 +24,7 @@ the Free Software Fo

[PATCH 03/11] pfinet: add missing include

2014-05-22 Thread Justus Winter
* pfinet/linux-src/include/net/addrconf.h: Include ipv6.h. --- pfinet/linux-src/include/net/addrconf.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pfinet/linux-src/include/net/addrconf.h b/pfinet/linux-src/include/net/addrconf.h index d711d0d..4b27077 100644 --- a/pfinet/linux-src/incl

[PATCH 05/11] libdiskfs: fix type of dir_cache_id, node_cache_id

2014-05-22 Thread Justus Winter
* libdiskfs/name-cache.c (struct lookup_cache): Fix type of dir_cache_id, node_cache_id. --- libdiskfs/name-cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdiskfs/name-cache.c b/libdiskfs/name-cache.c index 8424ffe..c113692 100644 --- a/libdiskfs/name-cache.c +++ b/l

[PATCH 08/11] libdiskfs: add diskfs_make_node_alloc to allocate fat nodes

2014-05-22 Thread Justus Winter
libdiskfs has two kind of nodes, struct node and struct netnode. struct node is used to store libdiskfs specific data, while struct netnode contains user supplied data. Previously, both objects were allocated separatly, and a pointer from the node to the netnode provided a mapping from the former

[PATCH 10/11] trans/fakeroot: use fat nodes to simplify the node cache

2014-05-22 Thread Justus Winter
Previously, fakeroot stored netnodes in the hash table. But we are not interested in a cache for netnodes, we need a node cache. So fakeroot kept pointers to the associated node object in each netnode object. Use fat netfs nodes, which combine node and netnode objects. * trans/fakeroot.c (struc

[PATCH 06/11] libstore: provide function declaration until available upstream

2014-05-22 Thread Justus Winter
Until the Hurd specific header is available, provide a local declaration of ped_device_new_from_store. * libstore/part.c (ped_device_new_from_store): New declaration. --- libstore/part.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/libstore/part.c b/libstore/part.c index 56e904

[PATCH 04/11] term: fix memory leak

2014-05-22 Thread Justus Winter
I hope someone fixed that bug. * term/users.c (pi_destroy_hook): Fix memory leak. --- term/users.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/term/users.c b/term/users.c index 97bc22c..9bd51d0 100644 --- a/term/users.c +++ b/term/users.c @@ -259,9 +259,7 @@ pi_destroy_

[PATCH 11/11] trans/fakeroot: use netfs_node_netnode instead of np->nn

2014-05-22 Thread Justus Winter
When using fat nodes, expressions of the form E->nn can be rewritten as netfs_node_netnode (E). This is much faster as it only involves a offset calculation. For reference, I used the following semantic patch to create the patch: @@ expression E; @@ - E->nn + netfs_node_netnode (E) * trans/fak

Re: [PATCH 06/11] libstore: provide function declaration until available upstream

2014-05-22 Thread Justus Winter
Quoting Samuel Thibault (2014-05-23 00:22:14) > Justus Winter, le Thu 22 May 2014 22:13:28 +0200, a écrit : > > Until the Hurd specific header is available, provide a local > > declaration of ped_device_new_from_store. > > Mmm, does it really fix something? I'd

[PATCH] Implement /proc/slabinfo

2014-05-22 Thread Justus Winter
Add a node 'slabinfo' to the root directory that contains information about the slab allocator used in GNU Mach. The formatting code has been taken from Richard Braun's standalone client available here: git://darnassus.sceen.net/rbraun/slabinfo.git * rootdir.c (rootdir_gc_slabinfo): New function

Re: [PATCH 7/7] libtrivfs: lock-less reference counting for trivfs_peropen objects

2014-05-23 Thread Justus Winter
Quoting Samuel Thibault (2014-05-23 01:40:19) > Justus Winter, le Tue 13 May 2014 21:02:56 +0200, a écrit : > > diff --git a/libtrivfs/protid-clean.c b/libtrivfs/protid-clean.c > > index f98da6a..cce736d 100644 > > --- a/libtrivfs/protid-clean.c > > +++ b/libtrivfs/p

Re: [PATCH] Implement /proc/slabinfo

2014-05-24 Thread Justus Winter
Quoting Pino Toscano (2014-05-24 11:03:48) > Il 23.05.2014 08:54 Justus Winter ha scritto: > > Add a node 'slabinfo' to the root directory that contains information > > about the slab allocator used in GNU Mach. > > > > The formatting code has been taken from

[PATCH] Implement /proc/slabinfo

2014-05-24 Thread Justus Winter
Add a node 'slabinfo' to the root directory that contains information about the slab allocator used in GNU Mach. The formatting code has been taken from Richard Braun's standalone client available here: git://darnassus.sceen.net/rbraun/slabinfo.git * rootdir.c (rootdir_gc_slabinfo): New function

[PATCH 1/2] include: fix the embedded type definitions in memory_object.defs

2014-05-25 Thread Justus Winter
In order to use MIG translation functions to lookup memory objects, preprocessor macros have been introduced into the definition of memory_object_t in 50cc5152. The procedure definitions contain inlined type definitions in order to change the type of the argument in question (i.e. to make it polym

[PATCH 2/2] Rewrite old-style #endif FOO directives

2014-05-25 Thread Justus Winter
* i386/include/mach/i386/cthreads.h: Rewrite old-style #endif FOO directives. * include/device/tape_status.h: Likewise. * include/mach/alert.h: Likewise. * include/mach/boot.h: Likewise. * include/mach/default_pager_types.defs: Likewise. * include/mach/default_pager_types.h: Likewise. * include/mac

[PATCH 2/7] libpager: drop unused fields from struct pager

2014-05-26 Thread Justus Winter
* libpager/priv.h (struct pager): Drop fields next, pprev. --- libpager/priv.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/libpager/priv.h b/libpager/priv.h index d49cbb9..1f8405a 100644 --- a/libpager/priv.h +++ b/libpager/priv.h @@ -59,8 +59,6 @@ struct pager int noterm;

[PATCH 1/7] term: fix memory leak

2014-05-26 Thread Justus Winter
I tested this change for some days and have not experienced any problems with it. * term/users.c (pi_destroy_hook): Fix memory leak. --- term/users.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/term/users.c b/term/users.c index 97bc22c..9bd51d0 100644 --- a/term/users.c

[PATCH 5/7] libdiskfs: fix node leak in the name cache

2014-05-26 Thread Justus Winter
* libdiskfs/name-cache.c (diskfs_check_lookup_cache): Release node reference in a special case of lookup failure. --- libdiskfs/name-cache.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libdiskfs/name-cache.c b/libdiskfs/name-cache.c index c113692..a212a6d 100644 --- a/libdiskfs/name-cache.

[PATCH 7/7] libtrivfs: lock-less reference counting for trivfs_peropen objects

2014-05-26 Thread Justus Winter
* libtrivfs/trivfs.h (struct trivfs_peropen): Use refcount_t for field refcnt. (struct trivfs_control): Remove unused field lock. * libtrivfs/cntl-create.c (trivfs_create_control): Drop the mutex initialization. * libtrivfs/io-reauthenticate.c (trivfs_S_io_reauthenticate): Adjust accordingly. * lib

[PATCH 4/7] trans/mtab: fix initialization

2014-05-26 Thread Justus Winter
* trans/mtab.c (main): Fix initialization of mtab in one-shot mode. --- trans/mtab.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trans/mtab.c b/trans/mtab.c index 8c9f8d3..df03b1d 100644 --- a/trans/mtab.c +++ b/trans/mtab.c @@ -255,7 +255,7 @@ main (int argc, char *argv[])

[PATCH 6/7] libihash: do not use an integer hash function by default

2014-05-26 Thread Justus Winter
Recently libihash was changed to use an integer hash function on the keys in an attempt to reduce the rate of collisions (2d898893), which has long been assumed to be high. Richard Braun was kind enough to run some benchmarks. He observed: "1/ Using an extremely simple microbenchmark [1] that me

[PATCH 3/7] ext2fs: fix diskfs_pager_users

2014-05-26 Thread Justus Winter
This fixes a bug introduced in 86122789. * ext2fs/pager.c (diskfs_pager_users): We count file_pager_bucket, which does not include the disk pagers. Fix condition accordingly. --- ext2fs/pager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext2fs/pager.c b/ext2fs/pager.c in

[PATCH 1/6] libdiskfs: add diskfs_make_node_alloc to allocate fat nodes

2014-05-29 Thread Justus Winter
libdiskfs has two kind of nodes, struct node and struct netnode. struct node is used to store libdiskfs specific data, while struct netnode contains user supplied data. Previously, both objects were allocated separatly, and a pointer from the node to the netnode provided a mapping from the former

[PATCH 3/6] trans/fakeroot: use fat nodes to simplify the node cache

2014-05-29 Thread Justus Winter
Previously, fakeroot stored netnodes in the hash table. But we are not interested in a cache for netnodes, we need a node cache. So fakeroot kept pointers to the associated node object in each netnode object. Use fat netfs nodes, which combine node and netnode objects. * trans/fakeroot.c (struc

[PATCH 2/6] libnetfs: add netfs_make_node_alloc to allocate fat nodes

2014-05-29 Thread Justus Winter
libnetfs has two kind of nodes, struct node and struct netnode. struct node is used to store libnetfs specific data, while struct netnode contains user supplied data. Previously, both objects were allocated separatly, and a pointer from the node to the netnode provided a mapping from the former to

[PATCH 5/6] libdiskfs: remove the statistics code from the name cache

2014-05-29 Thread Justus Winter
The current name cache lookup operation completes in O(n) time. This means that making the cache too large would decrease the performance. Therefore it was required to tune the size, hence the need for statistics. We will use a data structure with worst case constant lookup times in the future, r

[PATCH 4/6] trans/fakeroot: use netfs_node_netnode instead of np->nn

2014-05-29 Thread Justus Winter
When using fat nodes, expressions of the form E->nn can be rewritten as netfs_node_netnode (E). This is much faster as it only involves a offset calculation. For reference, I used the following semantic patch to create the patch: @@ expression E; @@ - E->nn + netfs_node_netnode (E) * trans/fak

[PATCH 6/6] libdiskfs: use a hash table for the name cache

2014-05-29 Thread Justus Winter
Previously, name cache lookup operation completed in O(n) time. This means that making the cache too large would decrease the performance. Therefore it was required to tune the size. Implement the name cache using a hash table. We use buckets of a fixed size. We approximate the least-frequently

Re: let's make libpager single-threaded

2014-05-30 Thread Justus Winter
Quoting Richard Braun (2014-05-29 19:12:13) > On Thu, May 29, 2014 at 07:04:48PM +0200, Samuel Thibault wrote: > > But precisely: once the only thread gets a data_request, it'll call > > pager_read_page, which will typically call store_read, which will wait > > on the eventual I/O, and no other req

[PATCH 4/6] fatfs: use a seperate lock to protect nodehash

2014-06-01 Thread Justus Winter
Previously, fatfs used diskfs_node_refcnt_lock to serialize access to the nodehash. Use a separate lock to protect nodehash. Adjust the reference counting accordingly. Every node in the nodehash carries a light reference. When we are asked to give up that light reference, we reacquire our lock

[PATCH 1/6] tmpfs: use a thread timeout

2014-06-01 Thread Justus Winter
There is no need to keep all the threads around, just the master thread. * tmpfs/tmpfs (diskfs_thread_function): Use a thread timeout. --- tmpfs/tmpfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tmpfs/tmpfs.c b/tmpfs/tmpfs.c index a45d343..718c6d8 100644 --- a/tmpfs/tm

[PATCH 3/6] ext2fs: use a seperate lock to protect nodehash

2014-06-01 Thread Justus Winter
Previously, ext2fs used diskfs_node_refcnt_lock to serialize access to the nodehash. Use a separate lock to protect nodehash. Adjust the reference counting accordingly. Every node in the nodehash carries a light reference. When we are asked to give up that light reference, we reacquire our lock

[PATCH 5/6] isofs: use a seperate lock to protect node_cache

2014-06-01 Thread Justus Winter
Previously, isofs used diskfs_node_refcnt_lock to serialize access to the node_cache. Use a separate lock to protect node_cache. Adjust the reference counting accordingly. Every node in the node_cache carries a light reference. When we are asked to give up that light reference, we reacquire our

[PATCH 6/6] tmpfs: use a seperate lock to protect all_nodes

2014-06-01 Thread Justus Winter
Previously, tmpfs used diskfs_node_refcnt_lock to serialize access to the all_nodes and some other related global state related to memory consumption. Use a separate lock to protect all_nodes, and atomic operations to access the state related to memory consumption. Adjust the reference counting ac

[PATCH 2/6] libnetfs: fix memory leak

2014-06-01 Thread Justus Winter
* libnetfs/trans-callback.c (_netfs_translator_callback2_fn): Free user if creating the protid failed. --- libnetfs/trans-callback.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libnetfs/trans-callback.c b/libnetfs/trans-callback.c index 4dec162..f4f0c62 100644 --- a/lib

Re: [PATCH 3/6] ext2fs: use a seperate lock to protect nodehash

2014-06-01 Thread Justus Winter
Quoting Samuel Thibault (2014-06-02 03:41:55) > Justus Winter, le Sun 01 Jun 2014 22:03:01 +0200, a écrit : > > @@ -46,8 +46,18 @@ > > #define INOHASH(ino)(((unsigned)(ino))%INOHSZ) > > #endif > > > > +/* The nodehash is a cache of nodes. >

Re: C developper offer

2014-06-02 Thread Justus Winter
Hey :) Quoting Julian Alcolea (2014-05-28 23:28:31) > Dear all > > I am looking for a GNU project where i could help in the development proccess. Cool! Start by installing Debian/Hurd, and familiarize yourself with the system. Remember, the Hurd is not Linux (it would be boring otherwise). St

[PATCH 8/9] ext2fs: fix type of blockaddr

2014-06-06 Thread Justus Winter
* ext2fs/dir.c (diskfs_lookup_hard): Use vm_address_t for blockaddr. --- ext2fs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext2fs/dir.c b/ext2fs/dir.c index 1f7c7ed..ad55681 100644 --- a/ext2fs/dir.c +++ b/ext2fs/dir.c @@ -146,7 +146,7 @@ diskfs_lookup_hard (struct n

[PATCH 2/9] hurd: fix type of optimal_transfer_size

2014-06-06 Thread Justus Winter
* hurd/shared.h (struct shared_io): Use blksize_t for optimal_transfer_size. --- hurd/shared.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hurd/shared.h b/hurd/shared.h index 6f13637..25747eb 100644 --- a/hurd/shared.h +++ b/hurd/shared.h @@ -66,7 +66,7 @@ struct shared_io

[PATCH 4/9] libdiskfs: avoid implicit integer conversion

2014-06-06 Thread Justus Winter
* libdiskfs/boot-start.c (diskfs_boot_start): Avoid implicit integer conversion. --- libdiskfs/boot-start.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libdiskfs/boot-start.c b/libdiskfs/boot-start.c index a60a1d0..4cc7bb8 100644 --- a/libdiskfs/boot-start.c +++ b/libd

[PATCH 5/9] ext2fs: fix compiler warning

2014-06-06 Thread Justus Winter
* ext2fs/pager.c (disk_cache_block_ref): block cannot be negative. --- ext2fs/pager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext2fs/pager.c b/ext2fs/pager.c index ce5bc6d..39cf1c7 100644 --- a/ext2fs/pager.c +++ b/ext2fs/pager.c @@ -957,7 +957,7 @@ disk_cache_block_ref

[PATCH 6/9] ext2fs: use correct type for disk offsets

2014-06-06 Thread Justus Winter
* ext2fs/dir.c (count_dirents): Use off_t for nb. (diskfs_get_directs): Likewise for blkno, nblks. --- ext2fs/dir.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext2fs/dir.c b/ext2fs/dir.c index a7eeaaa..0597500 100644 --- a/ext2fs/dir.c +++ b/ext2fs/dir.c @@ -823,7 +8

[PATCH 1/9] include: use unsigned literal in combination with binary not

2014-06-06 Thread Justus Winter
* include/refcount.h (refcounts_promote): Use ~0U. (refcounts_demote): Likewise. --- include/refcount.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/refcount.h b/include/refcount.h index 5c3302d..785b052 100644 --- a/include/refcount.h +++ b/include/refcount.h @@

[PATCH 7/9] ext2fs: use size_t where appropriate

2014-06-06 Thread Justus Winter
* extfs/dir.c: Use size_t where appropriate. --- ext2fs/dir.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ext2fs/dir.c b/ext2fs/dir.c index 0597500..1f7c7ed 100644 --- a/ext2fs/dir.c +++ b/ext2fs/dir.c @@ -99,7 +99,7 @@ diskfs_null_dirstat (struct d

[PATCH 9/9] ext2fs: fix type of retry_dotdot

2014-06-06 Thread Justus Winter
* ext2fs/dir.c (diskfs_lookup_hard): Use ino_t for retry_dotdot. --- ext2fs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext2fs/dir.c b/ext2fs/dir.c index ad55681..46a22a1 100644 --- a/ext2fs/dir.c +++ b/ext2fs/dir.c @@ -140,7 +140,7 @@ diskfs_lookup_hard (struct node

[PATCH 3/9] libdiskfs: use correct type for disk offsets

2014-06-06 Thread Justus Winter
* libdiskfs/diskfs.h (struct peropen): Use off_t for filepointer. --- libdiskfs/diskfs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdiskfs/diskfs.h b/libdiskfs/diskfs.h index 2c68aa3..e328527 100644 --- a/libdiskfs/diskfs.h +++ b/libdiskfs/diskfs.h @@ -56,7 +56,7 @@ str

[PATCH] device: fix net_rcv_messages

2014-06-08 Thread Justus Winter
Previously, all net_rcv_messages sent by net_deliver were malformed. It never was a problem in practice, since the messages are not complex and thus the kernel does not try to parse the message. struct net_rcv_messages contains an additional field of type boolean_t. This field has no associated t

Re: Please merge the random translator into the Hurd repository

2014-06-09 Thread Justus Winter
Hello Samuel :) Quoting Justus Winter (2014-04-07 13:05:43) > please merge the random translator (found in [0]) into the main Hurd > repository. I read up on various repository merging options. I believe that for our needs, the following very simple approach works well: 1. In the reposit

[PATCH 4/6] i386: reformat the key map

2014-06-09 Thread Justus Winter
* i386/i386at/kd.c (key_map): Remove superfluous newlines so that every entry fits into one line. This way line numbers can be used as an index into the map. --- i386/i386at/kd.c | 27 +-- 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/i386/i386at/kd.c b/i3

[PATCH 1/6] kern: set the name of the kernel task to 'gnumach'

2014-06-09 Thread Justus Winter
* kern/taks.c (task_init): Set the name of the kernel task to 'gnumach'. --- kern/task.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kern/task.c b/kern/task.c index 66eb25c..20acc6a 100644 --- a/kern/task.c +++ b/kern/task.c @@ -70,6 +70,7 @@ void task_init(void) * for other initi

[PATCH 2/6] ddb: print task names if available

2014-06-09 Thread Justus Winter
* ddb/db_print.c (db_print_task): Print task name if available. * i386/i386/db_interface.c (db_task_name): Likewise. --- ddb/db_print.c | 7 ++- i386/i386/db_interface.c | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ddb/db_print.c b/ddb/db_print.c index c01

[PATCH 5/6] i386: remap some keys

2014-06-09 Thread Justus Winter
As a convenience for the nice people using our debugger, remap some keys to the readline-like shortcuts supported by dde. * i386/i386at/kd.c (kdcnmaygetc): Remap some keys. --- i386/i386at/kd.c | 33 + 1 file changed, 33 insertions(+) diff --git a/i386/i386at/kd.c

[PATCH 3/6] ddb: use db_thread_stat to format the flags

2014-06-09 Thread Justus Winter
* ddb/db_print.c (db_print_thread): Use db_thread_stat to format the flags. --- ddb/db_print.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ddb/db_print.c b/ddb/db_print.c index 1cbff64..e711ab6 100644 --- a/ddb/db_print.c +++ b/ddb/db_print.c @@ -194,12 +194,8 @@ db

[PATCH 6/6] doc: explain the floating point flag in kdb output

2014-06-09 Thread Justus Winter
* doc/mach.texi (Kernel Debugger Commands): Explain the floating point flag. --- doc/mach.texi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/mach.texi b/doc/mach.texi index 49c0d67..2da670f 100644 --- a/doc/mach.texi +++ b/doc/mach.texi @@ -7029,8 +7029,9 @@ session.

[PATCH] libmachdev: fix net_rcv_msg-messages

2014-06-10 Thread Justus Winter
Previously, all net_rcv_msg-messages sent by netif_rx_handle were malformed. It never was a problem in practice, since the messages are not complex and thus the kernel does not try to parse the message. struct net_rcv_msg contains an additional field of type boolean_t. This field has no associat

Same fix for netdde

2014-06-10 Thread Justus Winter
Hi :) here is the same fix for netdde. Justus

[PATCH 2/4] hurd: fix receiver lookup in termctty_open_terminal

2014-06-11 Thread Justus Winter
m/mig-decls.h @@ -0,0 +1,42 @@ +/* + Copyright (C) 2014 Free Software Foundation, Inc. + Written by Justus Winter. + + This file is part of the GNU Hurd. + + The GNU Hurd is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public Licen

[PATCH 1/4] term: improve the demuxer

2014-06-11 Thread Justus Winter
Handle multiple request types as recommended by the Mach Server Writer's Guide section 4, subsection "Handling Multiple Request Types". This avoids initializing the reply message in every X_server function. * term/main.c (demuxer): Improve the demuxer function. --- term/main.c | 24 +

[PATCH 4/4] utils/settrans: implement settrans --start

2014-06-11 Thread Justus Winter
Start the translator specified by the NODE's passive translator record and set it as NODE's active translator. This is the equivalent of doing: % settrans --active /node $(showtrans /node) * utils/settrans.c (argp_option): Add --start. (parse_opt): Handle --start. (main): Retrieve the passive tr

[PATCH 3/4] libdiskfs: add permission check to file_chflags

2014-06-11 Thread Justus Winter
Only root is allowed to change the high 16 bits. The TODO entry says otherwise, but that must be a mistake. For reference, see the glibc sources, sysdeps/mach/hurd/bits/stat.h. * libdiskfs/file-chflags.c (diskfs_S_file_chflags): Add permission check. * TODO (libdiskfs): Remove entry. --- TODO

Re: Please merge the random translator into the Hurd repository

2014-06-12 Thread Justus Winter
Quoting Ivan Shmakov (2014-06-11 18:13:22) > >>>>> Thomas Schwinge writes: > >>>>> On Mon, 09 Jun 2014 12:17:31 +0200, Justus Winter wrote: > > […] > > >> I prepared this for your consideration here: > > >> > http://d

Re: [PATCH] libmachdev: fix net_rcv_msg-messages

2014-06-12 Thread Justus Winter
Quoting Ivan Shmakov (2014-06-11 18:23:02) > >>>>> Justus Winter <4win...@informatik.uni-hamburg.de> writes: > > […] > > > @@ -243,8 +243,10 @@ netif_rx_handle (char *data, int len, struct > net_device *dev) > > >pack_size = len - sizeof

Re: [PATCH 4/4] utils/settrans: implement settrans --start

2014-06-14 Thread Justus Winter
Quoting Samuel Thibault (2014-06-14 21:48:09) > Hello, > > Justus Winter, le Wed 11 Jun 2014 13:41:10 +0200, a écrit : > > Start the translator specified by the NODE's passive translator record > > and set it as NODE's active translator. This is the equivalent of

Re: [PATCH] utils/mount: canonicalize mountpoints

2014-06-15 Thread Justus Winter
Quoting Gabriele Giacone (2014-06-15 12:56:13) > >> Such hunks are workarounds at the moment because hurd mounts paths by > >> keeping superfluous '/' and '.' in pathnames if specified at mount > >> time, which need to be specified at umount time as well to umount > >> successfully. > > > > But the

Re: [PATCH] utils/mount: canonicalize mountpoints

2014-06-16 Thread Justus Winter
Quoting Gabriele Giacone (2014-06-16 00:25:53) > On Sun, Jun 15, 2014 at 5:41 PM, Justus Winter > <4win...@informatik.uni-hamburg.de> wrote: > > Quoting Gabriele Giacone (2014-06-15 12:56:13) > >> >> Such hunks are workarounds at the moment because hurd mounts pat

[PATCH 2/5] libshouldbeinlibc: fix dead initialization in fmt_named_interval

2014-06-16 Thread Justus Winter
Found using the Clang Static Analyzer. * libshouldbeinlibc/timefmt.c (fmt_named_interval): Fix dead initialization. --- libshouldbeinlibc/timefmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libshouldbeinlibc/timefmt.c b/libshouldbeinlibc/timefmt.c index a28f58b..cef72e0

[PATCH 1/5] ftpfs: fix error handling in refresh_dir

2014-06-16 Thread Justus Winter
Found using the Clang Static Analyzer. * ftpfs/dir.c (refresh_dir): Fix error handling. --- ftpfs/dir.c | 20 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/ftpfs/dir.c b/ftpfs/dir.c index da5ddbe..a9fea22 100644 --- a/ftpfs/dir.c +++ b/ftpfs/dir.c @@ -384,14

[PATCH 3/5] trans/fakeroot: fix error handling

2014-06-16 Thread Justus Winter
Found using the Clang Static Analyzer. * trans/fakeroot.c (new_node): Do not leak a pointer to freed memory. Store NULL at *np instead. This fixes a node use-after-free in netfs_S_dir_lookup. --- trans/fakeroot.c | 1 + 1 file changed, 1 insertion(+) diff --git a/trans/fakeroot.c b/trans/fakero

[PATCH 4/5] libports: avoid realloc(3) corner case

2014-06-16 Thread Justus Winter
If the size argument is 0, realloc may either return NULL, or return a pointer that is only valid for use with free(3). In either case, the memory is freed. So if realloc would return NULL (it does not on GNU), the current code would double free p. Found using the Clang Static Analyzer. * libpo

[PATCH 5/5] libdiskfs: add permission check to file_chflags

2014-06-16 Thread Justus Winter
Only root is allowed to change the high 16 bits. The TODO entry says otherwise, but that must be a mistake. For reference, see the glibc sources, sysdeps/mach/hurd/bits/stat.h. * libdiskfs/file-chflags.c (diskfs_S_file_chflags): Add permission check. * TODO (libdiskfs): Remove entry. --- TODO

Re: [PATCH] sutils: add random device targets to MAKEDEV

2014-06-17 Thread Justus Winter
Quoting David Michael (2014-06-16 21:08:19) > * sutils/MAKEDEV.sh (random,urandom): New targets. > (std): Add random and urandom to the standard devices list. > --- > > Hi, > > With the random merge, can /dev/(u)random devices now be added to > MAKEDEV? Yes. > (I'm not married to the seed file

<    4   5   6   7   8   9   10   11   12   13   >