[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] three small patches
From: |
Mark Jonckheere |
Subject: |
[Qemu-devel] three small patches |
Date: |
Tue, 20 Jul 2004 18:24:18 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020408 |
These patches are against current (17-7-2004) CVS.
Patch 1:
--------
This patch makes it possible to compile vmdk.c with the infamous
RedHat-only gcc-2.96. This version of gcc doesn't like data
declarations in the middle of a code block.
diff -ur qemu/vmdk2raw.c qemu-patched/vmdk2raw.c
--- qemu.old/vmdk2raw.c Wed Jun 16 22:34:33 2004
+++ qemu/vmdk2raw.c Sat Jun 26 14:33:03 2004
@@ -129,10 +129,11 @@
/* the last chunk of the file can not be sparse
* or the file will be truncated */
if (offset + length >= disk_limit) {
+ const char nil = 0;
+
if (lseek64(out_fd, length-1, SEEK_CUR) == (off_t)-1)
perror("lseek");
/* write the last NULL byte instead of seeking */
- const char nil = 0;
write(out_fd, &nil, 1);
} else {
if (lseek64(out_fd, length, SEEK_CUR) == (off_t)-1)
@@ -186,12 +187,13 @@
static int open_vmdk(const char *filename)
{
int fd = open(filename, O_RDONLY | O_LARGEFILE);
+ char magic[4];
+
if (fd == -1) {
perror(filename);
return -1;
}
- char magic[4];
if (read(fd, &magic, sizeof(magic)) != sizeof(magic)) {
perror("read from disk");
return -1;
Patch 2:
--------
This patch enables qemu to run as a background process. It
initialises the current terminal only when serial- or monitor-I/O
is redirected to stdin/stdout or when -nographic is selected.
The program stops in the term_init() function when launched
as a background process.
examples:
qemu -hda disk.img &
xinit /usr/local/bin/qemu -hda disk.img -- :1 &
The second example launches qemu with a second X server and permits
to switch between host and guest operating systems using ctrl-alt-F7
and ctrl-alt-F8.
diff -ur qemu/vl.c qemu-patched/vl.c
--- qemu/vl.c Wed Jul 14 19:27:31 2004
+++ qemu-patched/vl.c Tue Jul 20 12:55:46 2004
@@ -3112,7 +3112,9 @@
{
vm_start();
}
- term_init();
+ /* Change terminal settings only if stdin/out is used */
+ if (client_index > 0)
+ term_init();
main_loop();
quit_timers();
return 0;
Patch 3:
--------
This patch is an extention to the previous one. Next to enable
running in background mode It adds the command line option
-full-screen which permits to start qemu immediatly in full
screen mode. Note: the trick to make sure grab is on at
startup is non-optimal.
examples:
qemu -hda disk.img -full-screen &
xinit /usr/local/bin/qemu -hda disk.img -full-screen -- :1 &
The second example launches qemu with a second X server using
the screen resolution as requested by the guest operating system
It permits to switch between host and guest operating systems
using ctrl-alt-F7 and ctrl-alt-F8.
diff -ur qemu/sdl.c qemu-patched/sdl.c
--- qemu/sdl.c Wed Jul 14 19:22:33 2004
+++ qemu-patched/sdl.c Tue Jul 20 17:09:21 2004
@@ -45,6 +45,10 @@
{
// printf("updating x=%d y=%d w=%d h=%d\n", x, y, w, h);
SDL_UpdateRect(screen, x, y, w, h);
+ /* FIXME: next two lines are a quick fix, to make
+ * sure grab is always on in fullscreen mode */
+ if (gui_fullscreen)
+ sdl_grab_start();
}
static void sdl_resize(DisplayState *ds, int w, int h)
@@ -540,7 +544,7 @@
SDL_Quit();
}
-void sdl_display_init(DisplayState *ds)
+void sdl_display_init(DisplayState *ds, int full)
{
int flags;
@@ -566,4 +570,8 @@
gui_grab = 0;
atexit(sdl_cleanup);
+
+ if (full) {
+ gui_fullscreen = 1;
+ }
}
diff -ur qemu/vl.c qemu-patched/vl.c
--- qemu/vl.c Wed Jul 14 19:27:31 2004
+++ qemu-patched/vl.c Tue Jul 20 14:00:22 2004
@@ -138,6 +138,7 @@
int graphic_width = 800;
int graphic_height = 600;
int graphic_depth = 15;
+int full_screen = 0;
TextConsole *vga_console;
/***********************************************************/
@@ -2440,6 +2441,7 @@
@@ -2440,6 +2441,7 @@
QEMU_OPTION_std_vga,
QEMU_OPTION_monitor,
QEMU_OPTION_serial,
+ QEMU_OPTION_full_screen,
};
typedef struct QEMUOption {
@@ -2493,6 +2495,7 @@
{ "std-vga", 0, QEMU_OPTION_std_vga },
{ "monitor", 1, QEMU_OPTION_monitor },
{ "serial", 1, QEMU_OPTION_serial },
+ { "full-screen", 0, QEMU_OPTION_full_screen },
/* temporary options */
{ "pci", 0, QEMU_OPTION_pci },
@@ -2832,6 +2835,9 @@
case QEMU_OPTION_serial:
pstrcpy(serial_device, sizeof(serial_device), optarg);
break;
+ case QEMU_OPTION_full_screen:
+ full_screen = 1;
+ break;
}
}
}
@@ -3015,7 +3021,7 @@
dumb_display_init(ds);
} else {
#ifdef CONFIG_SDL
- sdl_display_init(ds);
+ sdl_display_init(ds, full_screen);
#else
dumb_display_init(ds);
#endif
@@ -3112,7 +3118,9 @@
{
vm_start();
}
- term_init();
+ /* Change terminal settings only if stdin/out is used */
+ if (client_index > 0)
+ term_init();
main_loop();
quit_timers();
return 0;
diff -ur qemu/vl.h qemu-patched/vl.h
--- qemu/vl.h Wed Jul 14 19:27:33 2004
+++ qemu-patched/vl.h Tue Jul 20 14:04:09 2004
@@ -629,7 +629,7 @@
unsigned long vga_ram_offset, int vga_ram_size);
/* sdl.c */
-void sdl_display_init(DisplayState *ds);
+void sdl_display_init(DisplayState *ds, int full);
/* ide.c */
#define MAX_DISKS 4
vriendelijke groeten,
Mark.
--
:wq
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] three small patches,
Mark Jonckheere <=