From owner-svn-src-user@FreeBSD.ORG Thu Jun 21 10:03:49 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 0C6C61065678; Thu, 21 Jun 2012 10:03:49 +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 EB0488FC15; Thu, 21 Jun 2012 10:03:48 +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 q5LA3mit004042; Thu, 21 Jun 2012 10:03:48 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LA3mbV004040; Thu, 21 Jun 2012 10:03:48 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206211003.q5LA3mbV004040@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 21 Jun 2012 10:03:48 +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: r237374 - 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: Thu, 21 Jun 2012 10:03:49 -0000 Author: ae Date: Thu Jun 21 10:03:48 2012 New Revision: 237374 URL: http://svn.freebsd.org/changeset/base/237374 Log: Implement DIOSGSECTORSIZE and DIOCGMEDIASIZE ioctls for biosdisk. 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 Thu Jun 21 09:57:34 2012 (r237373) +++ user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Thu Jun 21 10:03:48 2012 (r237374) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); * */ +#include #include #include @@ -114,6 +115,7 @@ static int bd_realstrategy(void *devdata size_t size, char *buf, size_t *rsize); static int bd_open(struct open_file *f, ...); static int bd_close(struct open_file *f); +static int bd_ioctl(struct open_file *f, u_long cmd, void *data); static void bd_print(int verbose); struct bd_print_args { @@ -519,6 +521,26 @@ bd_close(struct open_file *f) return (0); } +static int +bd_ioctl(struct open_file *f, u_long cmd, void *data) +{ + struct open_disk *od; + + od = (struct open_disk *) + (((struct i386_devdesc *)(f->f_devdata))->d_kind.biosdisk.data); + switch (cmd) { + case DIOCGSECTORSIZE: + *(u_int *)data = BDSECSZ(od); + break; + case DIOCGMEDIASIZE: + *(off_t *)data = BDSZ(od) * BDSECSZ(od); + break; + default: + return (ENOTTY); + } + return (0); +} + static void bd_closedisk(struct open_disk *od) {