Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Use `getdisksize()' to get the size of the mounted-o...



details:   https://anonhg.NetBSD.org/src/rev/afb2ea238655
branches:  trunk
changeset: 780535:afb2ea238655
user:      hannken <hannken%NetBSD.org@localhost>
date:      Sat Jul 28 15:12:42 2012 +0000

description:
Use `getdisksize()' to get the size of the mounted-on block device.

Should work for disks without partition table (wedges) now.

diffstat:

 sys/dev/fss.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (43 lines):

diff -r 1b98b79e7c80 -r afb2ea238655 sys/dev/fss.c
--- a/sys/dev/fss.c     Sat Jul 28 15:09:44 2012 +0000
+++ b/sys/dev/fss.c     Sat Jul 28 15:12:42 2012 +0000
@@ -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 @@
     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 @@
         * 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



Home | Main Index | Thread Index | Old Index