Commit 5c2b32cf authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov

ioping: DragonFlyBSD port

patch from michaelneuma@gmail.com
Signed-off-by: default avatarKonstantin Khlebnikov <koct9i@gmail.com>
parent c2a4d16a
...@@ -58,6 +58,11 @@ ...@@ -58,6 +58,11 @@
# define HAVE_ERR_INCLUDE # define HAVE_ERR_INCLUDE
#endif #endif
#ifdef __DragonFly__
# include <sys/diskslice.h>
# define HAVE_ERR_INCLUDE
#endif
#ifdef __APPLE__ #ifdef __APPLE__
# include <sys/ioctl.h> # include <sys/ioctl.h>
# include <sys/mount.h> # include <sys/mount.h>
...@@ -512,8 +517,6 @@ off_t get_device_size(int fd, struct stat *st) ...@@ -512,8 +517,6 @@ off_t get_device_size(int fd, struct stat *st)
{ {
unsigned long long blksize = 0; unsigned long long blksize = 0;
int ret = 0; int ret = 0;
(void)fd;
(void)st;
#if defined(BLKGETSIZE64) #if defined(BLKGETSIZE64)
/* linux */ /* linux */
...@@ -530,9 +533,15 @@ off_t get_device_size(int fd, struct stat *st) ...@@ -530,9 +533,15 @@ off_t get_device_size(int fd, struct stat *st)
blksize = st->st_size; blksize = st->st_size;
#elif defined(__MINGW32__) #elif defined(__MINGW32__)
blksize = 0; blksize = 0;
#elif defined(__DragonFly__)
struct partinfo pinfo;
ret = ioctl(fd, DIOCGPART, &pinfo);
blksize = pinfo.media_size;
#else #else
# error no get disk size method # error no get disk size method
#endif #endif
(void)fd;
(void)st;
if (ret) if (ret)
err(2, "block get size ioctl failed"); err(2, "block get size ioctl failed");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment