From owner-svn-src-user@FreeBSD.ORG Wed Jun 20 15:12:31 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D98B7106564A; Wed, 20 Jun 2012 15:12:31 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C4D3F8FC12; Wed, 20 Jun 2012 15:12:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KFCVwh050070; Wed, 20 Jun 2012 15:12:31 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KFCVST050068; Wed, 20 Jun 2012 15:12:31 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206201512.q5KFCVST050068@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 20 Jun 2012 15:12:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237321 - user/ae/bootcode/sys/boot/i386/libi386 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 20 Jun 2012 15:12:32 -0000 Author: ae Date: Wed Jun 20 15:12:31 2012 New Revision: 237321 URL: http://svn.freebsd.org/changeset/base/237321 Log: Style fixes. Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Wed Jun 20 14:47:39 2012 (r237320) +++ user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Wed Jun 20 15:12:31 2012 (r237321) @@ -147,6 +147,7 @@ bd_bios2unit(int biosdev) int bd_unit2bios(int unit) { + if ((unit >= 0) && (unit < nbdinfo)) return (bdinfo[unit].bd_unit); return (-1); @@ -340,26 +341,24 @@ display_size(uint64_t size) * sliced - are they after the first BSD slice, or the DOS * slice before it?) */ -static int +static int bd_open(struct open_file *f, ...) { - va_list ap; - struct i386_devdesc *dev; - struct open_disk *od; - int error; - - va_start(ap, f); - dev = va_arg(ap, struct i386_devdesc *); - va_end(ap); - if ((error = bd_opendisk(&od, dev))) - return(error); - - /* - * Save our context - */ - ((struct i386_devdesc *)(f->f_devdata))->d_kind.biosdisk.data = od; - DEBUG("open_disk %p, partition at 0x%x", od, od->od_boff); - return(0); + struct i386_devdesc *dev; + struct open_disk *od; + va_list ap; + int error; + + va_start(ap, f); + dev = va_arg(ap, struct i386_devdesc *); + va_end(ap); + if ((error = bd_opendisk(&od, dev)) != 0) + return (error); + + /* Save our context */ + ((struct i386_devdesc *)(f->f_devdata))->d_kind.biosdisk.data = od; + DEBUG("open_disk %p, partition at 0x%x", od, od->od_boff); + return (0); } static int @@ -408,13 +407,15 @@ bd_opendisk(struct open_disk **odp, stru return(error); } -static int +static int bd_close(struct open_file *f) { - struct open_disk *od = (struct open_disk *)(((struct i386_devdesc *)(f->f_devdata))->d_kind.biosdisk.data); + struct open_disk *od; - bd_closedisk(od); - return(0); + od = (struct open_disk *) + (((struct i386_devdesc *)(f->f_devdata))->d_kind.biosdisk.data); + bd_closedisk(od); + return (0); } static void @@ -424,15 +425,18 @@ bd_closedisk(struct open_disk *od) free(od); } -static int +static int bd_strategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize) { - struct bcache_devdata bcd; - struct open_disk *od = (struct open_disk *)(((struct i386_devdesc *)devdata)->d_kind.biosdisk.data); + struct bcache_devdata bcd; + struct open_disk *od; - bcd.dv_strategy = bd_realstrategy; - bcd.dv_devdata = devdata; - return(bcache_strategy(&bcd, od->od_unit, rw, dblk+od->od_boff, size, buf, rsize)); + od = (struct open_disk *) + (((struct i386_devdesc *)devdata)->d_kind.biosdisk.data); + bcd.dv_strategy = bd_realstrategy; + bcd.dv_devdata = devdata; + return (bcache_strategy(&bcd, od->od_unit, rw, dblk + od->od_boff, + size, buf, rsize)); } static int @@ -662,14 +666,14 @@ static int bd_read(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest) { - return (bd_io(od, dblk, blks, dest, 0)); + return (bd_io(od, dblk, blks, dest, 0)); } static int bd_write(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest) { - return (bd_io(od, dblk, blks, dest, 1)); + return (bd_io(od, dblk, blks, dest, 1)); } /*