use getdisksize()

This commit is contained in:
christos 2011-11-13 23:03:55 +00:00
parent 9fc82cfc97
commit 05bbfb83a3
1 changed files with 7 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: hfs_subr.c,v 1.15 2011/02/24 23:48:59 christos Exp $ */
/* $NetBSD: hfs_subr.c,v 1.16 2011/11/13 23:03:55 christos Exp $ */
/*-
* Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hfs_subr.c,v 1.15 2011/02/24 23:48:59 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: hfs_subr.c,v 1.16 2011/11/13 23:03:55 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -43,7 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: hfs_subr.c,v 1.15 2011/02/24 23:48:59 christos Exp $
#include <sys/file.h>
#include <sys/filedesc.h>
#include <sys/mount.h>
#include <sys/disklabel.h>
#include <sys/device.h>
#include <sys/conf.h>
#include <sys/kauth.h>
#include <sys/buf.h>
@ -155,8 +155,9 @@ hfs_libcb_opendev(
{
hfs_libcb_data* cbdata = NULL;
hfs_libcb_argsopen* args;
struct partinfo dpart;
int result, mode;
uint64_t psize;
unsigned secsize;
result = 0;
args = (hfs_libcb_argsopen*)(cbargs->openvol);
@ -193,11 +194,10 @@ hfs_libcb_opendev(
cbdata->devvp = args->devvp;
/* Determine the device's block size. Default to DEV_BSIZE if unavailable.*/
if (VOP_IOCTL(args->devvp, DIOCGPART, &dpart, FREAD, args->cred)
!= 0)
if (getdisksize(args->devvp, &psize, &secsize) != 0)
cbdata->devblksz = DEV_BSIZE;
else
cbdata->devblksz = dpart.disklab->d_secsize;
cbdata->devblksz = secsize;
return 0;