[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 8/8] libnetfs: register passive translator startups
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 8/8] libnetfs: register passive translator startups |
Date: |
Sun, 12 Jan 2014 20:55:04 +0100 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
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 ?
- Re: [PATCH 4/8] trans/mtab: make the translator multithreaded, (continued)
- [PATCH 3/8] trans/mtab: properly lock mtab objects, Justus Winter, 2014/01/12
- [PATCH 5/8] trans/mtab: do not include non-filesystem translators by default, Justus Winter, 2014/01/12
- [PATCH 6/8] libfshelp: fix the api of fshelp_set_active_translator, Justus Winter, 2014/01/12
- [PATCH 7/8] libdiskfs: register passive translator startups, Justus Winter, 2014/01/12
- [PATCH 8/8] libnetfs: register passive translator startups, Justus Winter, 2014/01/12
- Re: [PATCH 8/8] libnetfs: register passive translator startups,
Samuel Thibault <=
- Re: [PATCH 1/8] trans/mtab: populate mtab objects on demand, Samuel Thibault, 2014/01/12