Date: Thu, 21 Jun 2012 10:03:48 +0000 (UTC) From: "Andrey V. Elsukov" <ae@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r237374 - user/ae/bootcode/sys/boot/i386/libi386 Message-ID: <201206211003.q5LA3mbV004040@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <sys/disk.h> #include <stand.h> #include <machine/bootinfo.h> @@ -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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206211003.q5LA3mbV004040>