aboutsummaryrefslogtreecommitdiff
path: root/block-raw-posix.c
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2009-03-07 20:06:23 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2009-03-07 20:06:23 +0000
commitc5e97233e8c8e53aab1b80b5e9891a71c4edea3e (patch)
tree6bf1eb8605f56e1f1647df85e4351a24e763895f /block-raw-posix.c
parent9399f095bd742ef8dc0f1b08baa3893d9bdbeebc (diff)
Support for DragonFly BSD (Hasso Tepper)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6746 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block-raw-posix.c')
-rw-r--r--block-raw-posix.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/block-raw-posix.c b/block-raw-posix.c
index 85ca704946..8695368994 100644
--- a/block-raw-posix.c
+++ b/block-raw-posix.c
@@ -63,6 +63,11 @@
#include <sys/dkio.h>
#endif
+#ifdef __DragonFly__
+#include <sys/ioctl.h>
+#include <sys/diskslice.h>
+#endif
+
//#define DEBUG_FLOPPY
//#define DEBUG_BLOCK
@@ -762,6 +767,15 @@ static int64_t raw_getlength(BlockDriverState *bs)
if (!fstat(fd, &sb) && (S_IFCHR & sb.st_mode)) {
#ifdef DIOCGMEDIASIZE
if (ioctl(fd, DIOCGMEDIASIZE, (off_t *)&size))
+#elif defined(DIOCGPART)
+ {
+ struct partinfo pi;
+ if (ioctl(fd, DIOCGPART, &pi) == 0)
+ size = pi.media_size;
+ else
+ size = 0;
+ }
+ if (size == 0)
#endif
#ifdef CONFIG_COCOA
size = LONG_LONG_MAX;