Justus Winter, le Sun 12 Jan 2014 20:08:45 +0100, a écrit : > Detect passive translator startup and add the resulting active > translator to the list of active translators.
Ack. > * libnetfs/dir-lookup.c (netfs_S_dir_lookup): Detect and register > passive translator startup. > --- > libnetfs/dir-lookup.c | 43 +++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 41 insertions(+), 2 deletions(-) > > diff --git a/libnetfs/dir-lookup.c b/libnetfs/dir-lookup.c > index 74351fa..99a8746 100644 > --- a/libnetfs/dir-lookup.c > +++ b/libnetfs/dir-lookup.c > @@ -1,5 +1,5 @@ > /* > - Copyright (C) 1995,96,97,98,99,2000,01,02,13 > + Copyright (C) 1995,96,97,98,99,2000,01,02,13,14 > Free Software Foundation, Inc. > Written by Michael I. Bushnell, p/BSG. > > @@ -67,6 +67,10 @@ netfs_S_dir_lookup (struct protid *diruser, > if (! relpath) > return ENOMEM; > > + /* Keep a pointer to the start of the filename for length > + calculations. */ > + char *filename_start = filename; > + > *retry_port_type = MACH_MSG_TYPE_MAKE_SEND; > *do_retry = FS_RETRY_NORMAL; > *retry_name = '\0'; > @@ -256,10 +260,16 @@ netfs_S_dir_lookup (struct protid *diruser, > } > } > > + boolean_t register_translator; > if (! error) > { > dirport = ports_get_send_right (newpi); > - ports_port_deref (newpi); > + > + /* Check if an active translator is currently running. If > + not, fshelp_fetch_root will start one. In that case, we > + need to register it in the list of active > + translators. */ > + register_translator = np->transbox.active == MACH_PORT_NULL; > > error = fshelp_fetch_root (&np->transbox, diruser->po, > dirport, > @@ -283,9 +293,38 @@ netfs_S_dir_lookup (struct protid *diruser, > strcat (retry_name, "/"); > strcat (retry_name, nextname); > } > + > + if (register_translator) > + { > + char *translator_path = strdupa (relpath); > + if (nextname != NULL) > + { > + /* This was not the last path component. > + NEXTNAME points to the next component, locate > + the end of the current component and use it > + to trim TRANSLATOR_PATH. */ > + char *end = nextname; > + while (*end != 0) > + end--; > + translator_path[end - filename_start] = '\0'; > + } > + > + error = fshelp_set_active_translator (&newpi->pi, > + translator_path, > + np->transbox.active); > + if (error) > + { > + ports_port_deref (newpi); > + goto out; > + } > + } > + > + ports_port_deref (newpi); > goto out; > } > > + ports_port_deref (newpi); > + > /* ENOENT means there was a hiccup, and the translator vanished > while NP was unlocked inside fshelp_fetch_root; continue as > normal. */ > error = 0; > -- > 1.8.5.2 > -- Samuel Je suis maintenant possesseur d'un ordinateur portable Compaq Armada 1592DT avec port infra-rouge. Auriez-vous connaissance de programmes suceptibles d'utiliser ce port afin de servir de télécommande ? -+- JN in NPC : ben quoi, c'est pas à ça que ça sert ?