Re: [PATCH 05/29] device/blkio.c (block_io): check if io_count is larger or equal to zero

2013-12-09 Thread Samuel Thibault
Marin Ramesa, le Tue 10 Dec 2013 01:25:58 +0100, a écrit : > On 10.12.2013 00:48:26, Samuel Thibault wrote: > > Marin Ramesa, le Mon 09 Dec 2013 23:57:20 +0100, a écrit : > > > Check if member io_count is non-negative. > > > > Can it really be negative? I don't see existing functions test for > >

Re: [PATCH 05/29] device/blkio.c (block_io): check if io_count is larger or equal to zero

2013-12-09 Thread Marin Ramesa
On 10.12.2013 00:48:26, Samuel Thibault wrote: > Marin Ramesa, le Mon 09 Dec 2013 23:57:20 +0100, a écrit : > > Check if member io_count is non-negative. > > Can it really be negative? I don't see existing functions test for > that, so maybe it should be an unsigned long actually, and it's > crea

Re: [PATCH 13/13] console-client: remove spurious pthread_spin_unlocks

2013-12-09 Thread Samuel Thibault
Justus Winter, le Mon 09 Dec 2013 15:16:41 +0100, a écrit : > * console-client/trans.c (netfs_attempt_mkfile): Remove spurious > pthread_spin_unlock. > (netfs_node_norefs): Likewise. It seems completely spurious indeed. > --- > console-client/trans.c |2 -- > 1 file changed, 2 deletions(-)

Re: [PATCH 12/13] trans: unlock nodes with faked attributes in fakeroot

2013-12-09 Thread Samuel Thibault
Justus Winter, le Mon 09 Dec 2013 15:16:40 +0100, a écrit : > When a node has faked attributes, we cannot drop our node. > Reinitialize the lock box as if the node was dropped. This fixes the > following bug: > > % fakeroot-hurd /bin/sh -c 'touch /tmp/$$.lock > chown 0

Re: [PATCH 11/13] trans: improve the error handling in fakeauth

2013-12-09 Thread Samuel Thibault
Justus Winter, le Mon 09 Dec 2013 15:16:39 +0100, a écrit : > Previously the node was not correctly torn down if adding the newly > created netnode to the hash table failed. Fix this by rearranging the > code, doing the hash table modification first because it is easier to > undo. Ack > * trans/

Re: [PATCH 10/13] trans: fix reference counting bug in fakeroot

2013-12-09 Thread Samuel Thibault
Justus Winter, le Mon 09 Dec 2013 15:16:38 +0100, a écrit : > The function new_node creates virtual nodes using netfs_make_node. > Nodes created with netfs_make_node already have a reference count of > one. Currently another reference is added in new_node. This prevents > the destruction of the n

Re: [PATCH 09/13] trans: fix locking in fakeroot's netfs_S_dir_lookup

2013-12-09 Thread Samuel Thibault
Justus Winter, le Mon 09 Dec 2013 15:16:37 +0100, a écrit : > * trans/fakeroot.c (netfs_S_dir_lookup): Fix locking. Ack, and then > --- > trans/fakeroot.c | 45 - > 1 file changed, 28 insertions(+), 17 deletions(-) > > diff --git a/trans/fakeroot.c

Re: [PATCH 08/13] trans: fix reference counting and destruction of fake nodes

2013-12-09 Thread Samuel Thibault
Justus Winter, le Mon 09 Dec 2013 15:16:36 +0100, a écrit : > Previously, fakeroot tried to do too much in netfs_node_norefs. This > function is meant to deallocate nodes. Fakeroot however also tries to > remove the node from the hash table and to prolong the lifetime of the > node object by re-r

Re: [PATCH 07/13] trans: return nodes locked when creating fake nodes in fakeroot

2013-12-09 Thread Samuel Thibault
Justus Winter, le Mon 09 Dec 2013 15:16:35 +0100, a écrit : > + { > + pthread_mutex_lock (&(*np)->lock); > + netfs_nref (*np); /* Return a reference to the caller. */ > + } >pthread_mutex_unlock (&idport_ihash_lock); Did you check the lock ordering between these tw

Re: [PATCH 06/13] trans: fix locking issue in fakeroot

2013-12-09 Thread Samuel Thibault
Justus Winter, le Mon 09 Dec 2013 15:16:34 +0100, a écrit : > * trans/fakeroot.c (netfs_attempt_mkfile): Keep dir locked until the > new node is created. Ack. > --- > trans/fakeroot.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/trans/fakeroot.c b/trans/fakeroot

Re: [PATCH 05/13] trans: handle invalid responses to dir_lookup requests in fakeroot

2013-12-09 Thread Samuel Thibault
Justus Winter, le Mon 09 Dec 2013 15:16:33 +0100, a écrit : > * trans/fakeroot.c (netfs_S_dir_lookup): Handle invalid responses to > dir_lookup requests. Ack. > --- > trans/fakeroot.c | 11 +-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/trans/fakeroot.c b/tra

Re: [PATCH 04/13] trans: improve the performance of dir_lookup in fakeroot

2013-12-09 Thread Samuel Thibault
Justus Winter, le Mon 09 Dec 2013 15:16:32 +0100, a écrit : > Previously any FS_RETRY_NORMAL requests were handed back to the > client. Redo the lookup ourself instead. This saves us the burden to > create a fake node for the intermediate step, hand it back to the > client and handle another requ

Re: [PATCH 03/13] trans: fix the use of the hash table in fakeroot.c

2013-12-09 Thread Samuel Thibault
Justus Winter, le Mon 09 Dec 2013 15:16:31 +0100, a écrit : > Previously a pointer to the node was stored in the hash table. This > writes the locp pointer into the node object overwriting the next > pointer there. Store the pointer to the netnode instead. Ack! > * trans/fakeroot.c (struct netnod

Re: [PATCH 02/13] libihash: remove dead code

2013-12-09 Thread Samuel Thibault
Justus Winter, le Mon 09 Dec 2013 15:16:30 +0100, a écrit : > * libihash/ihash.c (hurd_ihash_add): Remove dead code. Ack! > --- > libihash/ihash.c |3 --- > 1 file changed, 3 deletions(-) > > diff --git a/libihash/ihash.c b/libihash/ihash.c > index be1c580..d670fee 100644 > --- a/libihash/i

Re: More fixes for fakeroot-hurd

2013-12-09 Thread Samuel Thibault
Justus Winter, le Mon 09 Dec 2013 15:16:28 +0100, a écrit : > with this in, fakeroot-hurd builds the gnumach package just fine. Yay! Samuel

Re: [PATCH 01/13] libfshelp: use a hash table in get-identity.c

2013-12-09 Thread Samuel Thibault
Justus Winter, le Mon 09 Dec 2013 15:16:29 +0100, a écrit : > Currently fshelp_get_identity uses ports_class_iterate to de-duplicate > the identity ports. Use a hash table instead. Ack. > * libfshelp/get-identity.c (struct idspec): Remove field fileno. > (struct idspec): Add field id_hashloc. > (

Re: [PATCH 27/29] device/net_io.c (net_getstat): cast arguments to memcpy()

2013-12-09 Thread Samuel Thibault
Marin Ramesa, le Mon 09 Dec 2013 23:57:42 +0100, a écrit : > * device/net_io.c (net_getstat) (memcpy) (status): Cast to (void *). > (net_getstat) (memcpy) (if_address): Likewise. > (net_getstat) (memcpy) (addr_byte_count): Cast to size_t. Ditto. > --- > device/net_io.c | 2 +- > 1 file changed,

Re: [PATCH 26/29] device/net_io.c (net_getstat): check if addr_byte_count is negative

2013-12-09 Thread Samuel Thibault
Marin Ramesa, le Mon 09 Dec 2013 23:57:41 +0100, a écrit : > Check if addr_byte_count is negative. If it is negative the call to > memcpy() will fail. In that case return KERN_INVALID_ARGUMENT. Ditto. > * device/net_io.c (net_getstat): Check if addr_byte_count is negative. > > --- > device/net_

Re: [PATCH 23/29] device/kmsg.c (kmsgread, kmsg_read_done): cast arguments to memcpy()

2013-12-09 Thread Samuel Thibault
Marin Ramesa, le Mon 09 Dec 2013 23:57:38 +0100, a écrit : > * device/kmsg.c (kmsgread, kmsg_read_done) (memcpy) (io_data): Cast to (void > *). Mmm, why? These are already pointers, so memcpy will be fine with them. Samuel

Re: [PATCH 20/29] device/ds_routines.c: remove forward declaration

2013-12-09 Thread Samuel Thibault
Marin Ramesa, le Mon 09 Dec 2013 23:57:35 +0100, a écrit : > * device/ds_routines.c (free_skbuffs): Remove forward declaration. > * device/ds_routines.h [LINUX_DEV] [CONFIG_INET] (free_skbuffs): Add > prototype. Mmm, I'd rather keep this hack along the other linux_*_emulation_ops hacks. > --- >

Re: [PATCH 16/29] device/dev_pager.c (device_pager_data_request_done): check if io_residual is larger or equal to zero and cast it to size_t

2013-12-09 Thread Samuel Thibault
Marin Ramesa, le Mon 09 Dec 2013 23:57:31 +0100, a écrit : > Check if member io_residual is non-negative. If it is negative, the call to > memset() will fail. In that case return FALSE. Same for io_residual. -- Samuel

Re: [PATCH 05/29] device/blkio.c (block_io): check if io_count is larger or equal to zero

2013-12-09 Thread Samuel Thibault
Marin Ramesa, le Mon 09 Dec 2013 23:57:20 +0100, a écrit : > Check if member io_count is non-negative. Can it really be negative? I don't see existing functions test for that, so maybe it should be an unsigned long actually, and it's creators of ior structures which should make sure they don't st

Re: [PATCH 09/29] device/cirbuf.c (getc): use char instead of an unsigned char

2013-12-09 Thread Samuel Thibault
Marin Ramesa, le Mon 09 Dec 2013 23:57:24 +0100, a écrit : > I don't understand why nr is a pointer to unsigned char. Because of this: > c = *nr; We want c to really be a value between 0 and 255, not between -128 and 127. Samuel

Re: [PATCH 04/29] i386/i386/db_trace.c: use long instead of an int

2013-12-09 Thread Samuel Thibault
Marin Ramesa, le Mon 09 Dec 2013 23:57:19 +0100, a écrit : > - return (long *)((long)kregp + kp->offset); > + return (kregp + kp->offset); Take care, this is not the same at all: kregp + 1 advances by sizeof(*kregp) bytes, not by 1 byte. These casts really are needed. Samu

Re: [PATCH 03/29] i386/i386/db_interface.c: use vm_offset_t instead of an unsigned int

2013-12-09 Thread Samuel Thibault
Marin Ramesa, le Mon 09 Dec 2013 23:57:18 +0100, a écrit : > This is more in line with how the function db_user_to_kernel_address() is > called. In this way there is one cast less and several GCC warnings are > silenced. This actually also fixes 64bit support there :) Samuel

[PATCH 24/29] device/kmsg.c (kmsg_read_done): check if amt is negative

2013-12-09 Thread Marin Ramesa
Check if amt is negative. If it is negative the call to memcpy() will fail. In that case return FALSE. * device/kmsg.c (kmsg_read_done): Check if amt is negative. --- device/kmsg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/device/kmsg.c b/device/kmsg.c index f6a21da.

[PATCH 29/29] device/subrs.c: use io_req_t instead of struct buf

2013-12-09 Thread Marin Ramesa
Struct buf is not defined. Use io_req_t instead of it. * device/subrs.c (harderr) (bp): Change name to ior and use io_req_t as type instead of (struct buf *). (harderr) (minor): Use io_unit instead of b_dev. (harderr): Use io_recnum instead of b_blkno. (gateblk): Use io_req_t as return value inst

[PATCH 16/29] device/dev_pager.c (device_pager_data_request_done): check if io_residual is larger or equal to zero and cast it to size_t

2013-12-09 Thread Marin Ramesa
Check if member io_residual is non-negative. If it is negative, the call to memset() will fail. In that case return FALSE. * device/dev_pager.c (device_pager_data_request_done): Check if member io_residual is non-negative. ((device_pager_data_request_done) (memset) (io_residual): Cast to size_t.

[PATCH 19/29] device/dev_pager.c: remove forward declarations

2013-12-09 Thread Marin Ramesa
* device/dev_pager.c (device_pager_data_request_done, device_pager_data_write_done): Remove forward declarations. * device/dev_pager.h (device_pager_data_request_done, device_pager_data_write_done): Add prototypes. --- device/dev_pager.c | 4 device/dev_pager.h | 4 2 files changed,

[PATCH 21/29] device/ds_routines.c (device_write_get): check if io_count is larger or equal to zero and cast it to size_t

2013-12-09 Thread Marin Ramesa
Check if member io_count is non-negative. If it is negative the call to memcpy() will fail. Return KERN_INVALID_ARGUMENT in that case. * device/ds_routines.c (device_write_get): Check if member io_count is non-negative. (device_write_get) (memcpy) (io_data): Cast to (void *). (device_write_get) (

[PATCH 26/29] device/net_io.c (net_getstat): check if addr_byte_count is negative

2013-12-09 Thread Marin Ramesa
Check if addr_byte_count is negative. If it is negative the call to memcpy() will fail. In that case return KERN_INVALID_ARGUMENT. * device/net_io.c (net_getstat): Check if addr_byte_count is negative. --- device/net_io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/devi

[PATCH 17/29] device/dev_pager.c (device_pager_data_request_done): remove unnecessary cast

2013-12-09 Thread Marin Ramesa
The argument to trunc_page() is already cast to vm_offset_t in the macro itself. * device/dev_pager.c (device_pager_data_request_done) (trunc_page) (io_data): Don't cast to vm_offset_t. --- device/dev_pager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/dev_pager.

[PATCH 13/29] device/dev_pager.c (device_pager_data_request): remove forward declaration

2013-12-09 Thread Marin Ramesa
* Makefrag.am: Include device/dev_pager.h. * device/dev_pager.c: Likewise. (device_map_page): Remove forward declaration. * device/dev_pager.h: New file. Add copyright. [_DEVICE_DEV_PAGER_H_]: Add ifndef. (device_map_page): Add prototype. --- Makefrag.am| 1 + device/dev_pager.c | 2 +-

[PATCH 27/29] device/net_io.c (net_getstat): cast arguments to memcpy()

2013-12-09 Thread Marin Ramesa
* device/net_io.c (net_getstat) (memcpy) (status): Cast to (void *). (net_getstat) (memcpy) (if_address): Likewise. (net_getstat) (memcpy) (addr_byte_count): Cast to size_t. --- device/net_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/net_io.c b/device/net_io.c i

[PATCH 25/29] device/net_io.c: remove forward declarations

2013-12-09 Thread Marin Ramesa
* device/net_io.c (bpf_hash, net_do_filter, bpf_do_filter, hash_ent_remove, net_free_dead_infp, net_free_dead_entp, bpf_validate, bpf_eq, net_add_q_info, bpf_match): Remove forward declarations. * device/net_io.h (net_rcv_port, net_hash_entry, net_hash_header): Declare forward. (bpf_hash, net_do

[PATCH 22/29] device/kmsg.c (kmsgread): check if io_count is larger or equal to zero and cast it to vm_size_t

2013-12-09 Thread Marin Ramesa
Check if member io_count is non-negative. If it is negative the call to device_read_alloc() will fail. Return KERN_INVALID_ARGUMENT in that case. * device/kmsg.c (kmsgread): Check if member io_count is non-negative. (kmsgread) (device_read_alloc) (io_count): Cast to vm_size_t. --- device/kmsg.c

[PATCH 28/29] device/net_io.c (net_getstat): cast arguments to memset()

2013-12-09 Thread Marin Ramesa
* device/net_io.c (net_getstat) (memset) ((char *)status + addr_byte_count): Cast to (void *). (net_getstat) (memset) (addr_int_count * sizeof(int) - addr_byte_count): Cast to size_t. --- device/net_io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/device/net_io.c b/d

[PATCH 23/29] device/kmsg.c (kmsgread, kmsg_read_done): cast arguments to memcpy()

2013-12-09 Thread Marin Ramesa
* device/kmsg.c (kmsgread, kmsg_read_done) (memcpy) (io_data): Cast to (void *). (kmsgread, kmsg_read_done) (memcpy) (kmsg_buffer + kmsg_read_offset): Likewise. (kmsgread, kmsg_read_done) (memcpy) (amt): Cast to size_t. (kmsgread, kmsg_read_done) (memcpy) (cnt): Likewise. (kmsgread, kmsg_read_done)

[PATCH 18/29] device/dev_pager.c: remove forward declaration

2013-12-09 Thread Marin Ramesa
* Makefrag.am: Include device/blkio.h. * device/blkio.h: New file. Add copyright. [_DEVICE_BLKIO_H_]: Add ifndef. (block_io_mmap): Add prototype. * device/dev_pager.c: Include device/blkio.h. (block_io_mmap): Remove forward declaration. --- Makefrag.am| 1 + device/blkio.h | 24

[PATCH 20/29] device/ds_routines.c: remove forward declaration

2013-12-09 Thread Marin Ramesa
* device/ds_routines.c (free_skbuffs): Remove forward declaration. * device/ds_routines.h [LINUX_DEV] [CONFIG_INET] (free_skbuffs): Add prototype. --- device/ds_routines.c | 1 - device/ds_routines.h | 5 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/device/ds_routines.c b/d

[PATCH 12/29] device/cons.c: fix argument list

2013-12-09 Thread Marin Ramesa
* device/cons.c (romgetc, romputc): Fix argument list. --- device/cons.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/device/cons.c b/device/cons.c index b35e79f..285fb99 100644 --- a/device/cons.c +++ b/device/cons.c @@ -42,8 +42,8 @@ staticstruct consdev *cn_t

[PATCH 15/29] device/dev_pager.c (device_pager_data_request_done): check if io_count is larger or equal to zero and cast it to vm_size_t

2013-12-09 Thread Marin Ramesa
Check if member io_count is non-negative. If it is negative the cast to vm_size_t will fail. In that case return FALSE. * device/dev_pager.c (device_pager_data_request_done): Check if member io_count is non-negative. (device_pager_data_request_done) (io_count): Cast to vm_size_t. --- device/dev

[PATCH 09/29] device/cirbuf.c (getc): use char instead of an unsigned char

2013-12-09 Thread Marin Ramesa
I don't understand why nr is a pointer to unsigned char. If it is a pointer to char, the code is much cleaner. * device/cirbuf.c (getc) (nr): Use char instead of unsigned char. (getc) (c_cf, c_cl): Don't cast to (unsigned char *). (getc) (c_end, c_start): Likewise. (getc) (nr): Don't cast to (cha

[PATCH 11/29] device/cirbuf.c (cb_free): use vm_size_t instead of an int

2013-12-09 Thread Marin Ramesa
This is more in line with the call to kfree() in cb_free(). * device/cirbuf.c (cb_free) (size): Use vm_size_t instead of an int. --- device/cirbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/cirbuf.c b/device/cirbuf.c index 374af34..e43c6e1 100644 --- a/device/ci

[PATCH 10/29] device/cirbuf.c (cb_alloc): use vm_size_t instead of an int

2013-12-09 Thread Marin Ramesa
This is more in line with the call to kalloc() in cb_alloc(). * device/chario.c (tty_inq_size, tty_outq_size): Use unsigned int instead if an int. * device/cirbuf.c (cb_alloc) (buf_size): Use vm_size_t instead of an int. * device/cirbuf.h (cb_alloc) (buf_size): Likewise. --- device/chario.c | 6

[PATCH 08/29] device/chario.c: trivial stylistic fix for consistency

2013-12-09 Thread Marin Ramesa
* device/chario.c: Trivial stylistic fix for consistency. --- device/chario.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/device/chario.c b/device/chario.c index f912924..2e38248 100644 --- a/device/chario.c +++ b/device/chario.c @@ -915,7 +915,7 @@ void ttypush(

[PATCH 07/29] device/chario.c (char_read): check if io_count is larger or equal to zero

2013-12-09 Thread Marin Ramesa
Check if member io_count is non-negative. If it is negative the call to device_read_alloc() will fail. Return KERN_INVALID_ARGUMENT in that case. * device/chario.c (char_read): Check if member io_count is non-negative. --- device/chario.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-

[PATCH 01/29] i386: move prototypes to fix implicit declaration of function

2013-12-09 Thread Marin Ramesa
This fixes the implicit declarations in kern/machine.c and kern/debug.c. * i386/i386/model_dep.h (halt_cpu, halt_all_cpus): Add prototypes. * i386/i386at/model_dep.h (halt_cpu, halt_all_cpus): Remove prototypes. --- i386/i386/model_dep.h | 10 ++ i386/i386at/model_dep.h | 10 --

[PATCH 06/29] device/chario.c (char_write): check if io_count is larger or equal to zero and cast it to vm_size_t

2013-12-09 Thread Marin Ramesa
Check if member io_count is non-negative. If it is negative, the call to vm_deallocate() will fail. Return KERN_INVALID_ARGUMENT in that case. * device/chario.c (char_write): Check if member io_count is non-negative. (char_write) (vm_deallocate) (io_count): Cast to vm_size_t. --- device/chario.

[PATCH 14/29] device/dev_pager.c (device_pager_data_request): cast to (void *) instead to (char *)

2013-12-09 Thread Marin Ramesa
* device/dev_pager.c (device_pager_data_request) (vm_object_page_map) (ds): Cast to (void *) instead to (char *). --- device/dev_pager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/dev_pager.c b/device/dev_pager.c index 8a2797c..35c79b3 100644 --- a/device/dev_page

[PATCH 05/29] device/blkio.c (block_io): check if io_count is larger or equal to zero

2013-12-09 Thread Marin Ramesa
Check if member io_count is non-negative. If it's negative, the call to device_read_alloc() will fail. Return KERN_INVALID_ARGUMENT in that case. * device/blkio.c (block_io): Check if member io_count is non-negative. --- device/blkio.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(

[PATCH 03/29] i386/i386/db_interface.c: use vm_offset_t instead of an unsigned int

2013-12-09 Thread Marin Ramesa
This is more in line with how the function db_user_to_kernel_address() is called. In this way there is one cast less and several GCC warnings are silenced. * i386/i386/db_interface.c (db_set_hw_watchpoint) (kern_addr): Use vm_offset_t instead of an unsigned int. (db_user_to_kernel_address) (kaddr

[PATCH 04/29] i386/i386/db_trace.c: use long instead of an int

2013-12-09 Thread Marin Ramesa
This is more in line with how the function db_lookup_i386_kreg() is called. In this way there are two casts less and one GCC warning is silenced. * i386/i386/db_trace.c (db_lookup_i386_kreg) (kregp): Use long instead of an int. (db_lookup_i386_kreg): Don't cast return value. --- i386/i386/db_tr

[PATCH 02/29] i386/i386at/kd_event.c (kbdsetstat): fix difference in signedness

2013-12-09 Thread Marin Ramesa
* i386/i386at/kd_event.c (X_kdb_enter_init, X_kdb_exit_init): Cast first arguments to (unsigned int *). --- i386/i386at/kd_event.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/i386/i386at/kd_event.c b/i386/i386at/kd_event.c index db14225..4e7b00a 100644 --- a/i386/i386

[PATCH 13/13] console-client: remove spurious pthread_spin_unlocks

2013-12-09 Thread Justus Winter
* console-client/trans.c (netfs_attempt_mkfile): Remove spurious pthread_spin_unlock. (netfs_node_norefs): Likewise. --- console-client/trans.c |2 -- 1 file changed, 2 deletions(-) diff --git a/console-client/trans.c b/console-client/trans.c index 8219f97..00c5407 100644 --- a/console-clie

[PATCH 10/13] trans: fix reference counting bug in fakeroot

2013-12-09 Thread Justus Winter
The function new_node creates virtual nodes using netfs_make_node. Nodes created with netfs_make_node already have a reference count of one. Currently another reference is added in new_node. This prevents the destruction of the node causing bugs like this: % fakeroot-hurd sh -c 'l(){ flock /tmp/

[PATCH 12/13] trans: unlock nodes with faked attributes in fakeroot

2013-12-09 Thread Justus Winter
When a node has faked attributes, we cannot drop our node. Reinitialize the lock box as if the node was dropped. This fixes the following bug: % fakeroot-hurd /bin/sh -c 'touch /tmp/$$.lock chown 0 /tmp/$$.lock l(){ flock /tmp/$$.lock true;

[PATCH 07/13] trans: return nodes locked when creating fake nodes in fakeroot

2013-12-09 Thread Justus Winter
* trans/fakeroot.c (new_node): Acquire the nodes lock before releasing the idport_ihash_lock. Return nodes locked. (netfs_S_dir_lookup): Drop lock. (netfs_attempt_mkfile): Likewise. (main): Likewise. --- trans/fakeroot.c | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-)

[PATCH 11/13] trans: improve the error handling in fakeauth

2013-12-09 Thread Justus Winter
Previously the node was not correctly torn down if adding the newly created netnode to the hash table failed. Fix this by rearranging the code, doing the hash table modification first because it is easier to undo. * trans/fakeroot.c (new_node): Fix the error handling. --- trans/fakeroot.c | 37

[PATCH 06/13] trans: fix locking issue in fakeroot

2013-12-09 Thread Justus Winter
* trans/fakeroot.c (netfs_attempt_mkfile): Keep dir locked until the new node is created. --- trans/fakeroot.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trans/fakeroot.c b/trans/fakeroot.c index bee018e..b97b499 100644 --- a/trans/fakeroot.c +++ b/trans/fakeroot.c @@

[PATCH 09/13] trans: fix locking in fakeroot's netfs_S_dir_lookup

2013-12-09 Thread Justus Winter
* trans/fakeroot.c (netfs_S_dir_lookup): Fix locking. --- trans/fakeroot.c | 45 - 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/trans/fakeroot.c b/trans/fakeroot.c index eff5225..d5cb0e6 100644 --- a/trans/fakeroot.c +++ b/trans/fake

[PATCH 08/13] trans: fix reference counting and destruction of fake nodes

2013-12-09 Thread Justus Winter
Previously, fakeroot tried to do too much in netfs_node_norefs. This function is meant to deallocate nodes. Fakeroot however also tries to remove the node from the hash table and to prolong the lifetime of the node object by re-referencing it. Removing the object from the hash table is highly pr

[PATCH 05/13] trans: handle invalid responses to dir_lookup requests in fakeroot

2013-12-09 Thread Justus Winter
* trans/fakeroot.c (netfs_S_dir_lookup): Handle invalid responses to dir_lookup requests. --- trans/fakeroot.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/trans/fakeroot.c b/trans/fakeroot.c index 6e3b5d4..bee018e 100644 --- a/trans/fakeroot.c +++ b/trans/fa

[PATCH 03/13] trans: fix the use of the hash table in fakeroot.c

2013-12-09 Thread Justus Winter
Previously a pointer to the node was stored in the hash table. This writes the locp pointer into the node object overwriting the next pointer there. Store the pointer to the netnode instead. * trans/fakeroot.c (struct netnode): Add field np. (new_node): Initialize field np. (new_node): Store nn in

[PATCH 04/13] trans: improve the performance of dir_lookup in fakeroot

2013-12-09 Thread Justus Winter
Previously any FS_RETRY_NORMAL requests were handed back to the client. Redo the lookup ourself instead. This saves us the burden to create a fake node for the intermediate step, hand it back to the client and handle another request from the client. With this change there is no need to fiddle wi

[PATCH 02/13] libihash: remove dead code

2013-12-09 Thread Justus Winter
* libihash/ihash.c (hurd_ihash_add): Remove dead code. --- libihash/ihash.c |3 --- 1 file changed, 3 deletions(-) diff --git a/libihash/ihash.c b/libihash/ihash.c index be1c580..d670fee 100644 --- a/libihash/ihash.c +++ b/libihash/ihash.c @@ -372,9 +372,6 @@ hurd_ihash_add (hurd_ihash_t ht,

[PATCH 01/13] libfshelp: use a hash table in get-identity.c

2013-12-09 Thread Justus Winter
Currently fshelp_get_identity uses ports_class_iterate to de-duplicate the identity ports. Use a hash table instead. * libfshelp/get-identity.c (struct idspec): Remove field fileno. (struct idspec): Add field id_hashloc. (id_clean): New function. (id_initialize): Use id_clean as cleanup function f

More fixes for fakeroot-hurd

2013-12-09 Thread Justus Winter
Hi :) with this in, fakeroot-hurd builds the gnumach package just fine. [PATCH 01/13] libfshelp: use a hash table in get-identity.c This considerably improves performance of filesystem translators handing out lots of identity ports. fakeroot triggers just that. [PATCH 02/13] libihash: remove d

Re: [PATCH 01/14] i386/i386at/kd.c: fix signed overflow (a warning from GCC)

2013-12-09 Thread Marin Ramesa
On 09.12.2013 14:10:32, Richard Braun wrote: > On Mon, Dec 09, 2013 at 12:59:33PM +0100, Samuel Thibault wrote: > > No, it's really commenting c != K_DONE which makes the warning > > away. My current guess is that c gets implicitly casted to int > > instead of unsigned int. > > Just to make sure

Re: [PATCH 01/14] i386/i386at/kd.c: fix signed overflow (a warning from GCC)

2013-12-09 Thread Samuel Thibault
Richard Braun, le Mon 09 Dec 2013 14:10:32 +0100, a écrit : > On Mon, Dec 09, 2013 at 12:59:33PM +0100, Samuel Thibault wrote: > > No, it's really commenting c != K_DONE which makes the warning away. My > > current guess is that c gets implicitly casted to int instead of > > unsigned int. > > Just

Re: [PATCH 01/14] i386/i386at/kd.c: fix signed overflow (a warning from GCC)

2013-12-09 Thread Richard Braun
On Mon, Dec 09, 2013 at 12:59:33PM +0100, Samuel Thibault wrote: > No, it's really commenting c != K_DONE which makes the warning away. My > current guess is that c gets implicitly casted to int instead of > unsigned int. Just to make sure, I've switched char_idx and max to unsigned int and the wa

Re: [PATCH 01/14] i386/i386at/kd.c: fix signed overflow (a warning from GCC)

2013-12-09 Thread Samuel Thibault
Richard Braun, le Mon 09 Dec 2013 11:28:24 +0100, a écrit : > On Mon, Dec 09, 2013 at 11:07:46AM +0100, Marin Ramesa wrote: > > On 09.12.2013 11:00:12, Richard Braun wrote: > > > On Mon, Dec 09, 2013 at 08:20:11AM +0100, Marin Ramesa wrote: > > > > On 08.12.2013 15:25:42, Samuel Thibault wrote: > >

Re: [PATCH 01/14] i386/i386at/kd.c: fix signed overflow (a warning from GCC)

2013-12-09 Thread Richard Braun
On Mon, Dec 09, 2013 at 11:07:46AM +0100, Marin Ramesa wrote: > On 09.12.2013 11:00:12, Richard Braun wrote: > > On Mon, Dec 09, 2013 at 08:20:11AM +0100, Marin Ramesa wrote: > > > On 08.12.2013 15:25:42, Samuel Thibault wrote: > > > > Marin Ramesa, le Mon 02 Dec 2013 22:54:39 +0100, a écrit : > >

Re: [PATCH 01/14] i386/i386at/kd.c: fix signed overflow (a warning from GCC)

2013-12-09 Thread Marin Ramesa
On 09.12.2013 11:00:12, Richard Braun wrote: > On Mon, Dec 09, 2013 at 08:20:11AM +0100, Marin Ramesa wrote: > > On 08.12.2013 15:25:42, Samuel Thibault wrote: > > > Marin Ramesa, le Mon 02 Dec 2013 22:54:39 +0100, a écrit : > > > > -for ( ; (c != K_DONE) && (char_idx <= max); > > > > +for ( ; ((ch

Re: [PATCH 01/14] i386/i386at/kd.c: fix signed overflow (a warning from GCC)

2013-12-09 Thread Richard Braun
On Mon, Dec 09, 2013 at 08:20:11AM +0100, Marin Ramesa wrote: > On 08.12.2013 15:25:42, Samuel Thibault wrote: > > Marin Ramesa, le Mon 02 Dec 2013 22:54:39 +0100, a écrit : > > > -for ( ; (c != K_DONE) && (char_idx <= max); > > > +for ( ; ((char)c != K_DONE) && (char_idx <= max); > > > > I have r