bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH v2] machdev,pci,rump: Rework bootstrap


From: Samuel Thibault
Subject: Re: [PATCH v2] machdev,pci,rump: Rework bootstrap
Date: Mon, 15 Mar 2021 23:05:13 +0100
User-agent: NeoMutt/20170609 (1.8.3)

Damien Zammit, le lun. 15 mars 2021 20:37:48 +1100, a ecrit:
> @@ -239,12 +239,37 @@ trivfs_S_fsys_startup (mach_port_t bootport,
>                         mach_port_t *realnode,
>                         mach_msg_type_name_t *realnodetype)
>  {
> +  mach_port_t mybootport;
> +
>    control_port = cntl;
>    *realnode = MACH_PORT_NULL;
> -  *realnodetype = MACH_MSG_TYPE_MOVE_SEND;
> +  *realnodetype = MACH_MSG_TYPE_COPY_SEND;
> +
> +  task_get_bootstrap_port (mach_task_self (), &mybootport);
> +  if (mybootport)
> +    fsys_startup (mybootport, flags, control_port, MACH_MSG_TYPE_COPY_SEND, 
> realnode);
>    return 0;
>  }



> static mach_port_t
> pcifs_startup(mach_port_t bootstrap, int flags)
> {
>   error_t err;
>   mach_port_t realnode;
>   struct port_info *newpi;
> 
>   err = ports_create_port (netfs_control_class, netfs_port_bucket,
>                            sizeof (struct port_info), &newpi);
>   if (!err)
>     {
>       pci_control_port = ports_get_send_right (newpi);
>       err = fsys_startup (bootstrap, flags, pci_control_port, 
> MACH_MSG_TYPE_COPY_SEND,
>                           &realnode);
>       assert_perror_backtrace (err);
>     }
>   if (err)
>     error (11, err, "Translator startup failure: fsys_startup");
> 
>   return realnode;
> }



> +  /* If we have a controlport, we are the bootstrap fs
> +   * so we need to call fsys_startup on ourselves
> +   * otherwise call it on our bootstrap port */
> +  if (controlport)
> +    pcifs_startup (controlport, O_READ);
> +  else
> +    pcifs_startup (bootstrap, O_READ);

If you don't have a bootstrap port, I don't think you need to make
any fsys_startup call? Calling it on controlport would at best be
confusing: trivfs_S_fsys_startup would get called and record controlport
in libmachdev's control_port as being the FS control port, but we don't
want that, we want to gently wait for ext2fs calling fsys_startup,
forwarded by rumpdisk.

Put another way, you can let pcifs_startup get the bootstrap port as it
is (nul or not nul), and make it call fsys_startup only when it is
non-nul (but create the control port in all cases, since that's needed
for the rest of the file).

Then you can avoid changing the machdev_trivfs_init prototype, which
would once more break netdde.

Samuel



reply via email to

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