qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Magnus Damm <magnus.damm@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] pc: boot sector writes and -kernel
Date: Fri, 25 Nov 2005 17:25:17 +0900	[thread overview]
Message-ID: <aec7e5c30511250025p62d4ef58q9d442a5e741bbb3d@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 379 bytes --]

Hello there,

This patch adds write support to the overlapping boot sector used by
the -kernel command line option.

Without the patch, guests booted with -kernel will fail updating boot
sector. This results in a fdisk that is unable to update the partition
table in the running kernel, but is able to write the correct boot
sector to disk.

Please apply.

/ magnus

[-- Attachment #2: qemu-cvs_20051125-linux_boot_sector.patch --]
[-- Type: text/x-patch, Size: 603 bytes --]

Index: block.c
===================================================================
RCS file: /cvsroot/qemu/qemu/block.c,v
retrieving revision 1.23
diff -u -p -r1.23 block.c
--- block.c	30 Oct 2005 18:30:10 -0000	1.23
+++ block.c	25 Nov 2005 08:05:55 -0000
@@ -444,6 +444,10 @@ int bdrv_write(BlockDriverState *bs, int
         return -1;
     if (bs->read_only)
         return -1;
+    if (nb_sectors == 0)
+        return 0;
+    if (sector_num == 0 && bs->boot_sector_enabled)
+        memcpy(bs->boot_sector_data, buf, 512);
     return bs->drv->bdrv_write(bs, sector_num, buf, nb_sectors);
 }
 




                 reply	other threads:[~2005-11-25  8:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aec7e5c30511250025p62d4ef58q9d442a5e741bbb3d@mail.gmail.com \
    --to=magnus.damm@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).