Source-Changes-HG archive

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

[src/trunk]: src/sys/fs use getdisksize()



details:   https://anonhg.NetBSD.org/src/rev/d5e6292715db
branches:  trunk
changeset: 771200:d5e6292715db
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Nov 13 23:08:47 2011 +0000

description:
use getdisksize()

diffstat:

 sys/fs/udf/udf_subr.c     |  15 ++++++++-------
 sys/fs/v7fs/v7fs_vfsops.c |  18 +++++++++---------
 2 files changed, 17 insertions(+), 16 deletions(-)

diffs (102 lines):

diff -r 66f569878777 -r d5e6292715db sys/fs/udf/udf_subr.c
--- a/sys/fs/udf/udf_subr.c     Sun Nov 13 23:07:11 2011 +0000
+++ b/sys/fs/udf/udf_subr.c     Sun Nov 13 23:08:47 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_subr.c,v 1.117 2011/09/27 01:13:16 christos Exp $ */
+/* $NetBSD: udf_subr.c,v 1.118 2011/11/13 23:08:47 christos Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.117 2011/09/27 01:13:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.118 2011/11/13 23:08:47 christos Exp $");
 #endif /* not lint */
 
 
@@ -188,7 +188,8 @@
 udf_update_discinfo(struct udf_mount *ump)
 {
        struct vnode *devvp = ump->devvp;
-       struct partinfo dpart;
+       uint64_t psize;
+       unsigned secsize;
        struct mmc_discinfo *di;
        int error;
 
@@ -204,9 +205,9 @@
        }
 
        /* disc partition support */
-       error = VOP_IOCTL(devvp, DIOCGPART, &dpart, FREAD, NOCRED);
+       error = getdisksize(devvp, &psize, &secsize);
        if (error)
-               return ENODEV;
+               return error;
 
        /* set up a disc info profile for partitions */
        di->mmc_profile         = 0x01; /* disc type */
@@ -222,8 +223,8 @@
        di->disc_flags = MMC_DFLAGS_UNRESTRICTED;
 
        /* TODO problem with last_possible_lba on resizable VND; request */
-       di->last_possible_lba = dpart.part->p_size;
-       di->sector_size       = dpart.disklab->d_secsize;
+       di->last_possible_lba = psize;
+       di->sector_size       = secsize;
 
        di->num_sessions = 1;
        di->num_tracks   = 1;
diff -r 66f569878777 -r d5e6292715db sys/fs/v7fs/v7fs_vfsops.c
--- a/sys/fs/v7fs/v7fs_vfsops.c Sun Nov 13 23:07:11 2011 +0000
+++ b/sys/fs/v7fs/v7fs_vfsops.c Sun Nov 13 23:08:47 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: v7fs_vfsops.c,v 1.4 2011/07/30 03:53:18 uch Exp $      */
+/*     $NetBSD: v7fs_vfsops.c,v 1.5 2011/11/13 23:09:58 christos Exp $ */
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: v7fs_vfsops.c,v 1.4 2011/07/30 03:53:18 uch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: v7fs_vfsops.c,v 1.5 2011/11/13 23:09:58 christos Exp $");
 #if defined _KERNEL_OPT
 #include "opt_v7fs.h"
 #endif
@@ -42,7 +42,8 @@
 #include <sys/time.h>
 #include <sys/ucred.h>
 #include <sys/mount.h>
-#include <sys/disklabel.h>
+#include <sys/disk.h>
+#include <sys/device.h>
 #include <sys/fcntl.h>
 #include <sys/malloc.h>
 #include <sys/kauth.h>
@@ -189,17 +190,16 @@
 static int
 is_v7fs_partition(struct vnode *devvp)
 {
-       struct partinfo dpart;
+       struct dkwedge_info dkw;
        int error;
 
-       if ((error = VOP_IOCTL(devvp, DIOCGPART, &dpart, FREAD, NOCRED)) != 0) {
-               DPRINTF("VOP_IOCTL=%d\n", error);
+       if ((error = getdiskinfo(devvp, &dkw)) != 0) {
+               DPRINTF("getdiskinfo=%d\n", error);
                return error;
        }
-       DPRINTF("fstype=%d dtype=%d bsize=%d\n", dpart.part->p_fstype,
-           dpart.disklab->d_type, dpart.disklab->d_secsize);
+       DPRINTF("ptype=%s size=%" PRIu64 "\n", dkw.dkw_ptype, dkw->dkw_size);
 
-       return (dpart.part->p_fstype == FS_V7) ? 0 : EINVAL;
+       return strcmp(dkw.dkw_ptype, DKW_PTYPE_V7) == 0 ? 0 : EINVAL;
 }
 
 static int



Home | Main Index | Thread Index | Old Index