On Tue, Sep 12, 2023 at 08:35:00AM +0000, Emmanuel Dreyfus wrote: > How are we supposed to discover the start block number? All rf_buildroothack() > knows is dk_nwedges from struct disk. It gets struct dkwedge_info using > dkwedge_find_by_parent(), which second argument seems to be the first dk > device number to inspect. Why can't a dkwedge_get_flags() use wedge nummber > as well?
The whole wedge in-kernel API confuses me, sorry if this makes the discussion more complex. I was expecting somehting like: for (size_t ndx = 0; ndx < dk_nwedges; ndx++) { struct dkwedge_info dkw; unsigned flags; device_t t = dkwedge_find_by_parent(parent, ndx); >>> dkwedge_get_info(t, &dkw); flags = dkwedge_get_flags(t); if (flags & DKW_FLAGS_BOOTME) rf_boot_from_filesystem_starting_at(dkw.offset....) ... but we don't seem to have something like dkwedge_get_info. > The protoypes could closely match dkwedge_find_by_parent() > int dkwedge_get_flags((const char *parent_name, size_t *dknum, int *flags) > int dkwedge_set_flags((const char *parent_name, size_t *dknum, int flags) > > This size_t * type seems oddd, but it is what dkwedge_find_by_parent() uses. For boot purposes, and given that we have already discovered all wedges on this disk and (for now) the list ist stable: yes, it could. Martin