aboutsummaryrefslogtreecommitdiff
path: root/emulators/qemu-devel/files
diff options
context:
space:
mode:
authorNorikatsu Shigemura <nork@FreeBSD.org>2004-11-04 14:26:08 +0000
committerNorikatsu Shigemura <nork@FreeBSD.org>2004-11-04 14:26:08 +0000
commitd605d852cef58961edca5dd5656d1ff5287164aa (patch)
tree2b541ae88e3d7e91f3b50f3955416841fcbd0d14 /emulators/qemu-devel/files
parent6148aa68da041bce6f37bc657e9b6e5f894f16ff (diff)
downloadports-d605d852cef58961edca5dd5656d1ff5287164aa.tar.gz
ports-d605d852cef58961edca5dd5656d1ff5287164aa.zip
Notes
Diffstat (limited to 'emulators/qemu-devel/files')
-rw-r--r--emulators/qemu-devel/files/patch-block.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/emulators/qemu-devel/files/patch-block.c b/emulators/qemu-devel/files/patch-block.c
new file mode 100644
index 000000000000..d174d8f96e27
--- /dev/null
+++ b/emulators/qemu-devel/files/patch-block.c
@@ -0,0 +1,36 @@
+--- qemu/block.c.orig Thu Sep 30 06:27:57 2004
++++ qemu/block.c Thu Nov 4 23:19:37 2004
+@@ -21,6 +21,17 @@
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
++
++#include "config-host.h"
++
++#ifdef _BSD
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <sys/ioctl.h>
++#include <sys/queue.h>
++#include <sys/disk.h>
++#endif
++
+ #include "vl.h"
+ #include "block_int.h"
+
+@@ -522,6 +533,15 @@
+ return -1;
+ bs->read_only = 1;
+ }
++#ifdef _BSD
++ struct stat sb;
++ if (!fstat(fd,&sb) && (S_IFCHR & sb.st_mode)) {
++#ifdef DIOCGMEDIASIZE
++ if (ioctl(fd, DIOCGMEDIASIZE, (off_t *)&size))
++#endif
++ size = lseek(fd, 0LL, SEEK_END);
++ } else
++#endif
+ size = lseek(fd, 0, SEEK_END);
+ bs->total_sectors = size / 512;
+ s->fd = fd;