mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
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
This commit is contained in:
parent
7579dce2c6
commit
5d1186a4ed
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=321865
@ -28,7 +28,9 @@
|
|||||||
/* $FreeBSD$ */
|
/* $FreeBSD$ */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
#include <sys/disk.h>
|
||||||
#include <sys/queue.h>
|
#include <sys/queue.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@ -51,6 +53,20 @@ pager_output(const char *line)
|
|||||||
return (0);
|
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
|
#define ZFS_TEST
|
||||||
#define printf(...) fprintf(stderr, __VA_ARGS__)
|
#define printf(...) fprintf(stderr, __VA_ARGS__)
|
||||||
#include "libzfs.h"
|
#include "libzfs.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user