From owner-svn-src-user@FreeBSD.ORG Sun Dec 28 17:16:42 2014 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A1BBB94C; Sun, 28 Dec 2014 17:16:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8DE9B66125; Sun, 28 Dec 2014 17:16:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBSHGgCr065418; Sun, 28 Dec 2014 17:16:42 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBSHGgaJ065417; Sun, 28 Dec 2014 17:16:42 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201412281716.sBSHGgaJ065417@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Sun, 28 Dec 2014 17:16:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r276332 - user/nwhitehorn/kboot/powerpc/kboot X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Dec 2014 17:16:42 -0000 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