DOSEMU image file support
PATCH 1/1 DOSEMU image file support
Hi all
The attached patch adds support for DOSEMU image files to qemu. This is useful if you want to share image files between qemu and dosemu.
cheers
Hampa
Makefile +1 -1
@@ -20,7 +20,7 @@ $(MAKE) -C $$d $@ || exit 1 ; \ done -qemu-img: qemu-img.c block.c block-cow.c block-qcow.c aes.c block-vmdk.c +qemu-img: qemu-img.c block.c block-cow.c block-dosemu.c block-qcow.c aes.c block-vmdk.c $(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS) dyngen$(EXESUF): dyngen.c
Makefile.target +1 -1
@@ -241,7 +241,7 @@ # must use static linking to avoid leaving stuff in virtual address space VL_OBJS=vl.o osdep.o block.o readline.o monitor.o pci.o console.o -VL_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o +VL_OBJS+=block-dosemu.o block-cow.o block-qcow.o aes.o block-vmdk.o ifeq ($(TARGET_ARCH), i386) # Hardware support
block-dosemu.c +197 -0
197 lines not on this page · raw message
block.c +2 -0
@@ -558,6 +558,7 @@ {BDRVRawState *s = bs->opaque;close (s->fd); +return 0 ; } static int raw_create(const char *filename, int64_t total_size,
@@ -591,6 +592,7 @@void bdrv_init (void ) {bdrv_register (&bdrv_raw); +bdrv_register (&bdrv_dosemu);#ifndef _WIN32bdrv_register (&bdrv_cow);#endif
vl.h +1 -0
@@ -351,6 +351,7 @@typedef struct BlockDriver BlockDriver ;extern BlockDriver bdrv_raw; +extern BlockDriver bdrv_dosemu;extern BlockDriver bdrv_cow;extern BlockDriver bdrv_qcow;extern BlockDriver bdrv_vmdk;
Hi,
Thank you for the patch. Two remarks if you want that I merge it:
1) use open/read/write/close instead of fopen/fread/fwrite/fclose for consistency with other block drivers.
2) change the license to BSD
Fabrice.
Quoted 16 lines · Hampa Hug
Hi all
The attached patch adds support for DOSEMU image files to qemu. This is useful if you want to share image files between qemu and dosemu.
cheers
Hampa------------------------------------------------------------------------
_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel
Hi,
Quoted 1 line · Fabrice Bellard
2) change the license to BSD
Not GPL?
Ciao,
Dscho
Quoted 4 lines · Fabrice Bellard
Thank you for the patch. Two remarks if you want that I merge it:
1) use open/read/write/close instead of fopen/fread/fwrite/fclose for consistency with other block drivers.
The reason I used stdio is that read/write are non-blocking. It is not an error for read to return fewer bytes than requested. If that happens, the other block drivers fail.
Quoted 1 line
2) change the license to BSD
I was under the impression that we used GPL. At least that's what COPYING says.
cheers
Hampa
Quoted 11 lines · Hampa Hug
Quoted 3 lines · Fabrice Bellard
Thank you for the patch. Two remarks if you want that I merge it:
1) use open/read/write/close instead of fopen/fread/fwrite/fclose for consistency with other block drivers.
The reason I used stdio is that read/write are non-blocking. It is not an error for read to return fewer bytes than requested. If that happens, the other block drivers fail.
I agree, but for disk accesses it is usual to assume they return the requested amount of bytes. fread/fwrite are buffered I/Os which is a bit overkill for block drivers.
Quoted 5 lines
Quoted 1 line
2) change the license to BSD
I was under the impression that we used GPL. At least that's what COPYING says.
The different parts of QEMU have different licenses (and of course it affects the license of the resulting program). As mentionned on the web page:
- The QEMU virtual CPU core library is released under the GNU Lesser General Public License.
- The Linux QEMU emulator is released under the GNU General Public License.
- The QEMU PC system emulator is released under the MIT/BSD License.
The block layer belongs to the QEMU PC system emulator, so its license is BSD.
Fabrice.
[Qemu-devel] Solved: QEMU messed up in Windows
I ran QEMU on Windows, running linux.img
However, everything was garbled.
After changing the color depth from 24-bit to 16-bit, now it works fine.
Hopefully that'll save some other people's time.
Thanks,
Harry
Quoted 8 lines · Fabrice Bellard
Quoted 7 lines · Hampa Hug
Quoted 4 lines · Fabrice Bellard
Thank you for the patch. Two remarks if you want that I merge it:
1) use open/read/write/close instead of fopen/fread/fwrite/fclose for consistency with other block drivers.
Quoted 7 lines
Quoted 3 lines
The reason I used stdio is that read/write are non-blocking. It is not an error for read to return fewer bytes than requested. If that happens, the other block drivers fail.
I agree, but for disk accesses it is usual to assume they return the requested amount of bytes. fread/fwrite are buffered I/Os which is a bit overkill for block drivers.
I don't think that buffered I/O is an issue here. We are doing fread/fwrite of multiples of 512 byte blocks and most implementations don't actually buffer these.
I am reluctant to just use read/write (as the other block drivers do) because it is simply wrong. It may work for local files under Linux, but what about remote files (such as files on NFS mounts) and other host operating systems?
At the very least we should write small wrapper functions for read and write that fail only if there was an error.
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
2) change the license to BSD
I was under the impression that we used GPL. At least that's what COPYING says.
The different parts of QEMU have different licenses (and of course it affects the license of the resulting program). As mentionned on the web page:
Quoted 7 lines
- The QEMU virtual CPU core library is released under the GNU Lesser General Public License.
- The Linux QEMU emulator is released under the GNU General Public License.
- The QEMU PC system emulator is released under the MIT/BSD License.The block layer belongs to the QEMU PC system emulator, so its license is BSD.
Alright, I'll change that.
cheers
Hampa
Hi,
Quoted 4 lines · Hampa Hug
I am reluctant to just use read/write (as the other block drivers do) because it is simply wrong. It may work for local files under Linux, but what about remote files (such as files on NFS mounts) and other host operating systems?
Well, it doesn't. I tried several times to use a CD image which was mounted via samba, and it always failed miserably (took me almost half an hour to realize what the problem was, too).
Ciao,
Dscho
Quoted 7 lines · Fabrice Bellard
Quoted 3 lines
The reason I used stdio is that read/write are non-blocking. It is not an error for read to return fewer bytes than requested. If that happens, the other block drivers fail.
I agree, but for disk accesses it is usual to assume they return the requested amount of bytes. fread/fwrite are buffered I/Os which is a bit overkill for block drivers.
Heh,
Not if an unmasked signal is received on NFS mounted soft/intr. That is because POSIX "allows a read that is interrupted after reading some data to return -1 (with errno set to EINTR) or to return the number of bytes already read."
Signature · 3 lines
// Gianni Tedesco (gianni at scaramanga dot co dot uk) lynx --source www.scaramanga.co.uk/scaramanga.asc | gpg --import 8646BE7D: 6D9F 2287 870E A2C9 8F60 3A3C 91B5 7669 8646 BE7D
Quoted 9 lines · Gianni Tedesco
Quoted 7 lines · Fabrice Bellard
Quoted 3 lines
The reason I used stdio is that read/write are non-blocking. It is not an error for read to return fewer bytes than requested. If that happens, the other block drivers fail.
I agree, but for disk accesses it is usual to assume they return the requested amount of bytes. fread/fwrite are buffered I/Os which is a bit overkill for block drivers.
Quoted 6 lines
Heh,
Not if an unmasked signal is received on NFS mounted soft/intr. That is because POSIX "allows a read that is interrupted after reading some data to return -1 (with errno set to EINTR) or to return the number of bytes already read."
Ignore me. I read "disk" as "filesystem".
Either way, POSIX says things are allowed to change - and we should probably be allowing for images on network filesystems anyway...
Signature · 3 lines
// Gianni Tedesco (gianni at scaramanga dot co dot uk) lynx --source www.scaramanga.co.uk/scaramanga.asc | gpg --import 8646BE7D: 6D9F 2287 870E A2C9 8F60 3A3C 91B5 7669 8646 BE7D