tech-kern archive

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

Re: CVS commit: src/sys/kern



Michael van Elst <mlelstv%serpens.de@localhost> 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)



-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index