bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to clone a port right


From: Carl Fredrik Hammar
Subject: Re: How to clone a port right
Date: Tue, 7 Jul 2009 21:54:51 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hi,

On Tue, Jul 07, 2009 at 09:24:27PM +0300, Sergiu Ivanov wrote:
> In the latest working design unionmount creates a proxy node (by
> cloning the netfs_root_node of unionfs translator) and sets the
> mountee on this proxy.  I'm currently trying to implement cfhammar's
> idea about having the mountee run in orphan mode.  To achieve this I
> call only fshelp_start_translator, with no file_set_translator
> following.  When calling fshelp_start_translator, I have to give a
> pointer to a function, open_port, which in my case looks like this:
> 
>   /* Opens the port on which to set the mountee.  */
>   error_t
>     open_port (int flags, mach_port_t * underlying,
>                mach_msg_type_name_t * underlying_type, task_t task,
>                void *cookie)
>   {
>     err = 0;
> 
>     /* Create a port to `np`.  */
>     newpi = netfs_make_protid
>       (netfs_make_peropen (np, flags, NULL), user);
>     if (!newpi)
>       {
>         iohelp_free_iouser (user);
>         return errno;
>       }
> 
>     *underlying = underlying_port = ports_get_send_right (newpi);
>     *underlying_type = MACH_MSG_TYPE_COPY_SEND;
> 
>     ports_port_deref (newpi);
> 
>     return err;
>   }                             /*open_port */
> 
> np is the pointer to the proxy node.  If I want to get rid of the
> proxy node I must somehow avoid keeping references to it.  However, in
> the above code I clearly add a reference to the proxy node by creating
> a port which goes to the mountee and thus, does not get destroyed
> immediately.

Is there any reason to have a proxy at all now that there's no
file_set_translator?  Why not simply pass unionfs's underlying node?

Regards,
  Fredrik




reply via email to

[Prev in Thread] Current Thread [Next in Thread]