On Sun, Sep 15, 2019 at 03:47:32AM +0200, Emmanuel Dreyfus wrote: > Michael van Elst <mlel...@serpens.de> wrote: > > > A real solution would just support the NAME=* syntax in getwedgename(). > > It might also allow for a case-insensitive match like userland. Then > > it would just work for config, for boot parameters and for interactive > > entries. > > You mean this change? > > --- sys/kern/kern_subr.c 27 Jan 2019 02:08:43 -0000 1.223 > +++ sys/kern/kern_subr.c 15 Sep 2019 01:46:42 -0000 > @@ -678,15 +678,20 @@ > > static const char * > getwedgename(const char *name, int namelen) > { > - const char *wpfx = "wedge:"; > - const int wpfxlen = strlen(wpfx); > + const char *wpfx1 = "wedge:"; > + const char *wpfx2 = "NAME="; > + const int wpfx1len = strlen(wpfx1); > + const int wpfx2len = strlen(wpfx2); > > - if (namelen < wpfxlen || strncmp(name, wpfx, wpfxlen) != 0) > - return NULL; > + if (namelen > wpfx1len && strncmp(name, wpfx1, wpfx1len) == 0) > + return name + wpfx1len; > > - return name + wpfxlen; > + if (namelen > wpfx2len && strncmp(name, wpfx2, wpfx2len) == 0) > + return name + wpfx2len; > + > + return NULL; > } > > static device_t > parsedisk(char *str, int len, int defpart, dev_t *devp)
Yes. Please use strncasecmp for wpfx2, userland ignores case too. We have to decide if we really want to switch things to the NAME= syntax and allow wedge: only for compatibility. Then we should also adjust what dkwedge_print_wnames() prints, currently it uses the wedge: prefix. It is called in getdisk() when you enter something invalid for a root device. The wedge: syntax is documented in config(5), boot(8.x86) and cpu_rootconf(9) and maybe in other places. It is also used in iyonix/conf/GENERIC (as example) and evbarm/conf/IYONIX. There is also MD code for evbarm that generates the wedge: syntax from the FDT entry /chosen/netbsd,gpt-guid, replacing existing boot arguments. While /chosen/netbsd,gpt-label is searched for in the wedge list to pass a device to the MI code. But that's another story. Greetings, -- Michael van Elst Internet: mlel...@serpens.de "A potential Snark may lurk in every tree."