Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/vnconfig VNDIOCSET now returns a 64bit unsigned size.
details: https://anonhg.NetBSD.org/src/rev/481cb5cd1a94
branches: trunk
changeset: 749724:481cb5cd1a94
user: dsl <dsl%NetBSD.org@localhost>
date: Sun Dec 06 16:35:16 2009 +0000
description:
VNDIOCSET now returns a 64bit unsigned size.
Use compat ioctls if the kernel rejects the request.
Fixes PR/41873.
diffstat:
usr.sbin/vnconfig/vnconfig.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diffs (46 lines):
diff -r f4ca3b35e646 -r 481cb5cd1a94 usr.sbin/vnconfig/vnconfig.c
--- a/usr.sbin/vnconfig/vnconfig.c Sun Dec 06 16:33:18 2009 +0000
+++ b/usr.sbin/vnconfig/vnconfig.c Sun Dec 06 16:35:16 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vnconfig.c,v 1.37 2009/04/19 00:56:32 lukem Exp $ */
+/* $NetBSD: vnconfig.c,v 1.38 2009/12/06 16:35:16 dsl Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -119,6 +119,7 @@
#include <err.h>
#include <errno.h>
#include <fcntl.h>
+#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -326,6 +327,10 @@
if (force)
vndio.vnd_flags |= VNDIOF_FORCE;
rv = ioctl(fd, VNDIOCCLR, &vndio);
+#ifdef VNDIOOCCLR
+ if (rv && errno == ENOTTY)
+ rv = ioctl(fd, VNDIOOCCLR, &vndio);
+#endif
if (rv)
warn("%s: VNDIOCCLR", rdev);
else if (verbose)
@@ -344,10 +349,16 @@
(void) close(ffd);
rv = ioctl(fd, VNDIOCSET, &vndio);
+#ifdef VNDIOOCSET
+ if (rv && errno == ENOTTY) {
+ rv = ioctl(fd, VNDIOOCSET, &vndio);
+ vndio.vnd_size = vndio.vnd_osize;
+ }
+#endif
if (rv)
warn("%s: VNDIOCSET", rdev);
else if (verbose) {
- printf("%s: %d bytes on %s", rdev,
+ printf("%s: %" PRIu64 " bytes on %s", rdev,
vndio.vnd_size, file);
if (vndio.vnd_flags & VNDIOF_HASGEOM)
printf(" using geometry %d/%d/%d/%d",
Home |
Main Index |
Thread Index |
Old Index