Use `getdisksize()' to get the size of the mounted-on block device.
Should work for disks without partition table (wedges) now.
This commit is contained in:
parent
a8055efc22
commit
8f23e66316
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fss.c,v 1.81 2011/11/30 09:51:18 bouyer Exp $ */
|
||||
/* $NetBSD: fss.c,v 1.82 2012/07/28 15:12:42 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -36,7 +36,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.81 2011/11/30 09:51:18 bouyer Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.82 2012/07/28 15:12:42 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -622,8 +622,9 @@ fss_create_files(struct fss_softc *sc, struct fss_set *fss,
|
|||
off_t *bsize, struct lwp *l)
|
||||
{
|
||||
int error, bits, fsbsize;
|
||||
uint64_t numsec;
|
||||
unsigned int secsize;
|
||||
struct timespec ts;
|
||||
struct partinfo dpart;
|
||||
/* nd -> nd2 to reduce mistakes while updating only some namei calls */
|
||||
struct pathbuf *pb2;
|
||||
struct nameidata nd2;
|
||||
|
@ -711,11 +712,11 @@ fss_create_files(struct fss_softc *sc, struct fss_set *fss,
|
|||
* Get the block device size.
|
||||
*/
|
||||
|
||||
error = bdev_ioctl(sc->sc_bdev, DIOCGPART, &dpart, FREAD, l);
|
||||
error = getdisksize(vp, &numsec, &secsize);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
*bsize = (off_t)dpart.disklab->d_secsize*dpart.part->p_size;
|
||||
*bsize = (off_t)numsec*secsize;
|
||||
|
||||
/*
|
||||
* Get the backing store
|
||||
|
|
Loading…
Reference in New Issue