From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 18:35:48 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 878BFB0E; Tue, 25 Nov 2014 18:35:48 +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 5A8512F8; Tue, 25 Nov 2014 18:35:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAPIZmYh011866; Tue, 25 Nov 2014 18:35:48 GMT (envelope-from rdivacky@FreeBSD.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAPIZm6C011865; Tue, 25 Nov 2014 18:35:48 GMT (envelope-from rdivacky@FreeBSD.org) Message-Id: <201411251835.sAPIZm6C011865@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rdivacky set sender to rdivacky@FreeBSD.org using -f From: Roman Divacky Date: Tue, 25 Nov 2014 18:35:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275059 - head/sys/boot/i386/boot2 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2014 18:35:48 -0000 Author: rdivacky Date: Tue Nov 25 18:35:47 2014 New Revision: 275059 URL: https://svnweb.freebsd.org/changeset/base/275059 Log: Shrink boot2 by a couple more bytes. Reviewed by: jhb Tested by: me, dim Modified: head/sys/boot/i386/boot2/boot2.c Modified: head/sys/boot/i386/boot2/boot2.c ============================================================================== --- head/sys/boot/i386/boot2/boot2.c Tue Nov 25 17:53:35 2014 (r275058) +++ head/sys/boot/i386/boot2/boot2.c Tue Nov 25 18:35:47 2014 (r275059) @@ -323,7 +323,8 @@ load(void) caddr_t p; ufs_ino_t ino; uint32_t addr; - int i, j; + uint8_t i, j; + int k; if (!(ino = lookup(kname))) { if (!ls) @@ -344,7 +345,7 @@ load(void) return; } else if (IS_ELF(hdr.eh)) { fs_off = hdr.eh.e_phoff; - for (j = i = 0; i < hdr.eh.e_phnum && j < 2; i++) { + for (j = k = 0; k < hdr.eh.e_phnum && j < 2; k++) { if (xfsread(ino, ep + j, sizeof(ep[0]))) return; if (ep[j].p_type == PT_LOAD) @@ -393,7 +394,9 @@ parse() char *ep, *p, *q; const char *cp; unsigned int drv; - int c, i, j; + uint8_t i; + int c, j; + size_t k; while ((c = *arg++)) { if (c == ' ' || c == '\t' || c == '\n') @@ -416,7 +419,7 @@ parse() #if SERIAL } else if (c == 'S') { j = 0; - while ((unsigned int)(i = *arg++ - '0') <= 9) + while ((i = *arg++ - '0') <= 9) j = j * 10 + i; if (j > 0 && i == -'0') { comspeed = j; @@ -479,10 +482,10 @@ parse() ? DRV_HARD : 0) + drv; dsk_meta = 0; } - if ((i = ep - arg)) { - if ((size_t)i >= sizeof(knamebuf)) + if (k = ep - arg) { + if (k >= sizeof(knamebuf)) return -1; - memcpy(knamebuf, arg, i + 1); + memcpy(knamebuf, arg, k + 1); kname = knamebuf; } } @@ -605,8 +608,10 @@ drvread(void *buf, unsigned lba, unsigne { static unsigned c = 0x2d5c7c2f; - if (!OPT_CHECK(RBX_QUIET)) - printf("%c\b", c = c << 8 | c >> 24); + if (!OPT_CHECK(RBX_QUIET)) { + xputc(c = c << 8 | c >> 24); + xputc('\b'); + } v86.ctl = V86_ADDR | V86_CALLF | V86_FLAGS; v86.addr = XREADORG; /* call to xread in boot1 */ v86.es = VTOPSEG(buf);