Index: lib/device/dev-io.c =================================================================== RCS file: /cvsroot/src/external/gpl2/lvm2/dist/lib/device/dev-io.c,v retrieving revision 1.6 diff -u -p -r1.6 dev-io.c --- lib/device/dev-io.c 2 Dec 2009 01:53:25 -0000 1.6 +++ lib/device/dev-io.c 15 Dec 2010 19:42:17 -0000 @@ -266,26 +266,20 @@ static int _dev_get_size_dev(const struc 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); + +#ifdef __NetBSD__ + /* 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", s); 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);