Fix block device-related issues in zdb.

Specifically, this fixes the two following errors in zdb when a pool
is composed of block devices:

1) 'Value too large for defined data type' when running 'zdb <dataset>'.
2) 'character device required' when running 'zdb -l <block-device>'.

Signed-off-by: Ricardo M. Correia <ricardo.correia@oracle.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
Ricardo M. Correia
2010-12-14 09:50:37 -08:00
committed by Brian Behlendorf
parent a7dc7e5d5a
commit 8d4e8140ef
5 changed files with 58 additions and 23 deletions
+1 -9
View File
@@ -1803,7 +1803,7 @@ dump_label(const char *dev)
exit(1);
}
if (fstat64(fd, &statbuf) != 0) {
if (fstat64_blk(fd, &statbuf) != 0) {
(void) printf("failed to stat '%s': %s\n", path,
strerror(errno));
free(path);
@@ -1811,14 +1811,6 @@ dump_label(const char *dev)
exit(1);
}
if (S_ISBLK(statbuf.st_mode)) {
(void) printf("cannot use '%s': character device required\n",
path);
free(path);
(void) close(fd);
exit(1);
}
psize = statbuf.st_size;
psize = P2ALIGN(psize, (uint64_t)sizeof (vdev_label_t));