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 netnode): Add field np. > (new_node): Initialize field np. > (new_node): Store nn instead of np into the hash table. > (netfs_S_dir_lookup): Adjust accordingly. > --- > trans/fakeroot.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/trans/fakeroot.c b/trans/fakeroot.c > index 1342844..1ab3216 100644 > --- a/trans/fakeroot.c > +++ b/trans/fakeroot.c > @@ -41,6 +41,7 @@ static auth_t fakeroot_auth_port; > > struct netnode > { > + struct node *np; /* our node */ > hurd_ihash_locp_t idport_locp;/* easy removal pointer in idport ihash */ > mach_port_t idport; /* port from io_identity */ > int openmodes; /* O_READ | O_WRITE | O_EXEC */ > @@ -93,7 +94,7 @@ new_node (file_t file, mach_port_t idport, int locked, int > openmodes, > return err; > } > } > - *np = netfs_make_node (nn); > + *np = nn->np = netfs_make_node (nn); > if (*np == 0) > { > if (locked) > @@ -104,7 +105,7 @@ new_node (file_t file, mach_port_t idport, int locked, > int openmodes, > { > if (!locked) > pthread_mutex_lock (&idport_ihash_lock); > - err = hurd_ihash_add (&idport_ihash, nn->idport, *np); > + err = hurd_ihash_add (&idport_ihash, nn->idport, nn); > if (!err) > netfs_nref (*np); /* Return a reference to the caller. */ > pthread_mutex_unlock (&idport_ihash_lock); > @@ -122,6 +123,7 @@ new_node (file_t file, mach_port_t idport, int locked, > int openmodes, > void > netfs_node_norefs (struct node *np) > { > + assert (np->nn->np == np); > if (np->nn->faked != 0 > && netfs_validate_stat (np, 0) == 0 && np->nn_stat.st_nlink > 0) > { > @@ -295,9 +297,11 @@ netfs_S_dir_lookup (struct protid *diruser, > else > { > pthread_mutex_lock (&idport_ihash_lock); > - np = hurd_ihash_find (&idport_ihash, idport); > - if (np != 0) > + struct netnode *nn = hurd_ihash_find (&idport_ihash, idport); > + if (nn != NULL) > { > + assert (nn->np->nn == nn); > + np = nn->np; > /* We already know about this node. */ > mach_port_deallocate (mach_task_self (), idport); > pthread_mutex_lock (&np->lock); > -- > 1.7.10.4 > -- Samuel <Raize> can you guys see what I type? <vecna> no, raize <Raize> How do I set it up so you can see it?