Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/gpl2/lvm2/dist/lib/device Change way how we get dev...
details: https://anonhg.NetBSD.org/src/rev/06e78225035b
branches: trunk
changeset: 760011:06e78225035b
user: haad <haad%NetBSD.org@localhost>
date: Thu Dec 23 21:39:08 2010 +0000
description:
Change way how we get device size from device. Do not use LSEEK but
DIOCGWEDGEINFO and DIOCGDINFO. This should fix problem with raidframe + lvm
reported by
Toby Karyadi on current-users@.
Thanks for reporting this issue.
diffstat:
external/gpl2/lvm2/dist/lib/device/dev-io.c | 24 +++++++++---------------
1 files changed, 9 insertions(+), 15 deletions(-)
diffs (44 lines):
diff -r 67be175bcebc -r 06e78225035b external/gpl2/lvm2/dist/lib/device/dev-io.c
--- a/external/gpl2/lvm2/dist/lib/device/dev-io.c Thu Dec 23 21:34:02 2010 +0000
+++ b/external/gpl2/lvm2/dist/lib/device/dev-io.c Thu Dec 23 21:39:08 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dev-io.c,v 1.7 2010/12/23 14:46:25 mlelstv Exp $ */
+/* $NetBSD: dev-io.c,v 1.8 2010/12/23 21:39:08 haad Exp $ */
/*
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
@@ -275,26 +275,20 @@
log_sys_error("open", name);
#endif
return 0;
- }
+ }
#ifdef __NetBSD__
- if ((*size = lseek (fd, 0, SEEK_END)) < 0) {
- log_sys_error("lseek SEEK_END", name);
- close(fd);
- return 0;
- }
-
- if (ioctl(fd, DIOCGDINFO, &lab) < 0) {
- if (ioctl(fd, DIOCGWEDGEINFO, &dkw) < 0) {
- log_debug("ioctl DIOCGWEDGEINFO", name);
+ /* Get info about partition/wedge */
+ if (ioctl(fd, DIOCGWEDGEINFO, &dkw) == -1) {
+ if (ioctl(fd, DIOCGDINFO, &lab) == -1) {
+ log_debug("Please implement DIOCGWEDGEINFO or "
+ "DIOCGDINFO for disk device %s", name);
close(fd);
return 0;
} else
- if (dkw.dkw_size)
- *size = dkw.dkw_size;
- } else
- if (lab.d_secsize)
*size /= lab.d_secsize;
+ } else
+ *size = dkw.dkw_size;
#else
if (ioctl(fd, BLKGETSIZE64, size) < 0) {
log_sys_error("ioctl BLKGETSIZE64", name);
Home |
Main Index |
Thread Index |
Old Index