Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/miscfs/specfs unfortunately it is not that easy to get r...
details: https://anonhg.NetBSD.org/src/rev/217f5f1fedb4
branches: trunk
changeset: 342131:217f5f1fedb4
user: christos <christos%NetBSD.org@localhost>
date: Tue Dec 08 01:57:13 2015 +0000
description:
unfortunately it is not that easy to get rid of DIOCGPART. DTRT for the
raw partition and print a warning if we overflowed. I guess the right solution
for this is to create yet another version of disklabel that is 64 bit friendly.
diffstat:
sys/miscfs/specfs/spec_vnops.c | 23 ++++++++++++++++-------
1 files changed, 16 insertions(+), 7 deletions(-)
diffs (48 lines):
diff -r 372a4a251608 -r 217f5f1fedb4 sys/miscfs/specfs/spec_vnops.c
--- a/sys/miscfs/specfs/spec_vnops.c Mon Dec 07 23:20:57 2015 +0000
+++ b/sys/miscfs/specfs/spec_vnops.c Tue Dec 08 01:57:13 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spec_vnops.c,v 1.155 2015/12/05 07:59:34 jnemeth Exp $ */
+/* $NetBSD: spec_vnops.c,v 1.156 2015/12/08 01:57:13 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.155 2015/12/05 07:59:34 jnemeth Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.156 2015/12/08 01:57:13 christos Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -661,15 +661,24 @@
ioctl = vp->v_type == VCHR ? cdev_ioctl : bdev_ioctl;
- error = (*ioctl)(vp->v_rdev, DIOCGMEDIASIZE, &off, FREAD, curlwp);
+ // XXX: DIOCGPART is not 64 bit friendly so we avoid it fot the
+ // raw partition
+ if (DISKPART(vp->v_rdev) == RAW_PART)
+ error = (*ioctl)(vp->v_rdev, DIOCGMEDIASIZE,
+ &off, FREAD, curlwp);
+ else
+ error = EINVAL;
if (error) {
struct partinfo pi;
+ error = (*ioctl)(vp->v_rdev, DIOCGPART, &pi, FREAD, curlwp);
+ if (error == 0) {
+ off = (off_t)pi.disklab->d_secsize * pi.part->p_size;
#ifdef DIAGNOSTIC
- printf("ioctl DIOCGMEDIASIZE failed %d\n", error);
+ if (pi.disklab->d_secsize == UINT_MAX)
+ printf("overflow in DIOCGPART dev=%jx\n",
+ (uintmax_t)vp->v_rdev);
#endif
- error = (*ioctl)(vp->v_rdev, DIOCGPART, &pi, FREAD, curlwp);
- if (error == 0)
- off = (off_t)pi.disklab->d_secsize * pi.part->p_size;
+ }
}
if (error == 0)
Home |
Main Index |
Thread Index |
Old Index