Author: avg Date: Tue Aug 1 11:09:18 2017 New Revision: 321865 URL: https://svnweb.freebsd.org/changeset/base/321865
Log: zfsboottest: catch up with r316585 and provide ldi_get_size method This method is required for querying file / disk sizes which is needed at least for finding all copies of ZFS VDEV labels. Reported by: ngie MFC after: 1 week Modified: head/tools/tools/zfsboottest/zfsboottest.c Modified: head/tools/tools/zfsboottest/zfsboottest.c ============================================================================== --- head/tools/tools/zfsboottest/zfsboottest.c Tue Aug 1 11:00:04 2017 (r321864) +++ head/tools/tools/zfsboottest/zfsboottest.c Tue Aug 1 11:09:18 2017 (r321865) @@ -28,7 +28,9 @@ /* $FreeBSD$ */ #include <sys/param.h> +#include <sys/disk.h> #include <sys/queue.h> +#include <sys/stat.h> #include <err.h> #include <errno.h> #include <fcntl.h> @@ -49,6 +51,20 @@ pager_output(const char *line) fprintf(stderr, "%s", line); return (0); +} + +uint64_t +ldi_get_size(void *priv) +{ + struct stat sb; + int fd; + + fd = *(int *)priv; + if (fstat(fd, &sb) != 0) + return (0); + if (S_ISCHR(sb.st_mode) && ioctl(fd, DIOCGMEDIASIZE, &sb.st_size) != 0) + return (0); + return (sb.st_size); } #define ZFS_TEST _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"