Hello,

Mikhail Karpov, le ven. 24 avril 2026 19:27:18 +0700, a ecrit:
> Here's my attempt to add storeio to the GNU/Hurd bootstrap chain to fix
> GPLv2 vs. GPLv3 license incompatibility between ext2fs and libparted.

Nice!

> So far, I've managed to add it to the bootstrap chain in grub.cfg:
> module /hurd/rumpdisk.static rumpdisk \
>     --next-task='${storeio-task}' \
>     '$(disk-task=task-create)'
> module /hurd/storeio.static storeio \
>     --next-task='${fs-task}' -T typed '${root}' \
>     '$(storeio-task=task-create)'
> module /hurd/ext2fs.static ext2fs \
>     --multiboot-command-line='${kernel-command-line}' \
>     --exec-server-task='${exec-task}' -T typed '${root}' \
>     '$(fs-task=task-create)'
> 
> The system boots,

Cool step :D

> but I don't fully understand how to access the store provided by
> storeio if I remove the -T typed '${root}' from the ext2fs arguments.

You mean, only telling storeio.static what drive it should be using, and
not ext2fs.static, right?

> I tried extending libdiskfs/init-main.c so that at system startup, the
> store is accessed via store_create instead of store_parsed_open, which
> in turn accesses the parent task, but boot fails with the error code
> MIG_BAD_ID.

Note that:

> +  //if (diskfs_boot_filesystem ())
> +  //  {
> +  //    err = store_create (parent_task, diskfs_readonly ? STORE_READONLY : 
> 0,
> +  //                        0, &store);
> +  //    diskfs_disk_name = "storeio";
> +  //  }

You are passing the task as argument to store_create, but store_create
expects a file_t, not a task. So it's not surprising to be getting
MIG_BAD_ID, RPCs to a task are actually going to the kernel :)

So the problem now is that you want to get a file_t from the storeio
process, instead of ext2fs opening the device by itself. That would
usually be through fsys_getroot on the control port of the storeio
process, which it can get from the special port.

Actually, I'm wondering whether we need to involve libmachdev at all in
the end: since we can make ext2fs open storeio through the control port,
it doesn't need to get it through a device interface.

> @@ -45,7 +45,7 @@ static struct port_info *bootinfo;
>  static mach_port_t diskfs_exec_ctl;
>  extern task_t diskfs_exec_server_task;
>  extern task_t diskfs_kernel_task;
> -static task_t parent_task = MACH_PORT_NULL;
> +task_t parent_task = MACH_PORT_NULL;

Do we really need to expose this? Can't both libmachdev and storeio make
an fsys_getpriv call to get it without having to share?

> diff --git a/storeio/Makefile b/storeio/Makefile
> index 83b7684d..5d5b8878 100644
> --- a/storeio/Makefile
> +++ b/storeio/Makefile
> @@ -19,11 +19,13 @@
>  dir := storeio
>  makemode := server
>  
> -target = storeio
> +target = storeio storeio.static
>  SRCS = dev.c storeio.c open.c pager.c io.c
>  
>  OBJS = $(SRCS:.c=.o)
> -HURDLIBS = trivfs pager fshelp iohelp store ports ihash shouldbeinlibc
> -LDLIBS = -lpthread
> +HURDLIBS = trivfs pager fshelp iohelp store ports ihash shouldbeinlibc 
> machdev
> +LDLIBS = -lpthread $(and $(HAVE_LIBBZ2),-lbz2) $(and $(HAVE_LIBZ),-lz)
>  
>  include ../Makeconf
> +
> +storeio.static: $(boot-store-types:%=../libstore/libstore_%.a)

This holds by itself, I have commited it already, thanks!

> diff --git a/storeio/dev.c b/storeio/dev.c
> index c87400c0..30dc0354 100644
> --- a/storeio/dev.c
> +++ b/storeio/dev.c
> @@ -143,7 +143,7 @@ dev_buf_rw (struct dev *dev, size_t buf_offs, size_t 
> *io_offs, size_t *len,
>  
>  /* Called with DEV->lock held.  Try to open the store underlying DEV.  */
>  error_t
> -dev_open (struct dev *dev)
> +dev_open (struct dev *dev, struct trivfs_control *storeio_fsys)

Why not just making storeio_bootstrap_startup use &storeio_fsys rather
than &control?

> @@ -163,21 +234,39 @@ main (int argc, char *argv[])
>      {
>        task_get_bootstrap_port (mach_task_self (), &bootstrap);
>        if (bootstrap == MACH_PORT_NULL)
> -     error (2, 0, "Must be started as a translator");
> -
> -      /* Reply to our parent */
> -      err = trivfs_startup (bootstrap, 0, 0, 0, 0, 0, &storeio_fsys);
> -      if (err)
> -     error (3, err, "trivfs_startup");
> +        error (2, 0, "Must be started as a translator");
> +
> +      if (next_task != MACH_PORT_NULL)
> +        {
> +          err = storeio_bootstrap_startup (bootstrap);
> +          if (err)
> +            error (1, err, "storeio_bootstrap_init");
> +
> +          dev_open (&device, control);

I guess dev_open will be triggered by the fsys_getroot call that will
end up in the check_open_hook.

> +          control->hook = &device;
> +
> +          /* Launch. */
> +          ports_manage_port_operations_multithread (control->pi.bucket,
> +                                              demuxer,
> +                                              30*1000, 5*60*1000, 0);
> +        }
> +      else

Samuel

Reply via email to