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 Fix my yesterday fix and ...



details:   https://anonhg.NetBSD.org/src/rev/be88a69bf1dd
branches:  trunk
changeset: 760174:be88a69bf1dd
user:      haad <haad%NetBSD.org@localhost>
date:      Wed Dec 29 23:14:21 2010 +0000

description:
Fix my yesterday fix and finally make _get_dev_size recognise partition size
for device without DIOWEDGEINFO, where DIOCGDINFO is used. Patch tested by
Martin Mersberger.

diffstat:

 external/gpl2/lvm2/dist/lib/device/dev-io.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (32 lines):

diff -r 88417f1bdd86 -r be88a69bf1dd external/gpl2/lvm2/dist/lib/device/dev-io.c
--- a/external/gpl2/lvm2/dist/lib/device/dev-io.c       Wed Dec 29 22:56:59 2010 +0000
+++ b/external/gpl2/lvm2/dist/lib/device/dev-io.c       Wed Dec 29 23:14:21 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dev-io.c,v 1.9 2010/12/29 00:14:04 haad Exp $  */
+/*     $NetBSD: dev-io.c,v 1.10 2010/12/29 23:14:21 haad Exp $ */
 
 /*
  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
@@ -268,6 +268,7 @@
 #ifdef __NetBSD__
        struct disklabel        lab;
        struct dkwedge_info     dkw;
+       struct stat stat;
 #endif
 
        if ((fd = open(name, O_RDONLY)) < 0) {
@@ -285,8 +286,12 @@
                            "DIOCGDINFO for disk device %s", name);
                        close(fd);
                        return 0;
-               } else
-                       *size = lab.d_nsectors;
+               } else {
+                       if (fstat(fd, &stat) < 0)
+                               log_debug("fstat on device %s failure", name);
+                       
+                       *size = lab.d_partitions[DISKPART(stat.st_rdev)].p_size;
+               }
        } else
                *size = dkw.dkw_size;
 #else



Home | Main Index | Thread Index | Old Index