Date: Sun, 28 Dec 2014 17:16:42 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r276332 - user/nwhitehorn/kboot/powerpc/kboot Message-ID: <201412281716.sBSHGgaJ065417@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Sun Dec 28 17:16:41 2014 New Revision: 276332 URL: https://svnweb.freebsd.org/changeset/base/276332 Log: Make getdev do something. This gets me to a loader prompt without crashing. No disk IO yet. Modified: user/nwhitehorn/kboot/powerpc/kboot/main.c Modified: user/nwhitehorn/kboot/powerpc/kboot/main.c ============================================================================== --- user/nwhitehorn/kboot/powerpc/kboot/main.c Sun Dec 28 16:56:52 2014 (r276331) +++ user/nwhitehorn/kboot/powerpc/kboot/main.c Sun Dec 28 17:16:41 2014 (r276332) @@ -52,8 +52,32 @@ int kboot_setcurrdev(struct env_var *ev, int kboot_getdev(void **vdev, const char *devspec, const char **path) { - printf("Devspec: %s\n", devspec); - return (0); + int i; + const char *devpath, *filepath; + struct devsw *dv; + + if (devspec[0] == '/') { + devpath = getenv("currdev"); + filepath = devspec; + } else { + devpath = devspec; + if (strchr(devspec, ':') == NULL) + filepath = NULL; + else + filepath = strchr(devspec, ':') + 1; + } + for (i = 0; (dv = devsw[i]) != NULL; i++) { + if (strncmp(dv->dv_name, devpath, strlen(dv->dv_name)) == 0) + goto found; + } + return (ENOENT); + +found: + if (path != NULL) + *path = filepath; + else if (path != NULL) + *path = strchr(devspec, ':') + 1; + *vdev = strdup(devpath); } int
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201412281716.sBSHGgaJ065417>