qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: lepton <ytht.net@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [patch]Fix block device read for some SLOW file
Date: Wed, 27 Jul 2005 19:10:57 +0800	[thread overview]
Message-ID: <20050727111057.GA21694@gsy2.lepton.home> (raw)

Hi, I found when I am using qemu, I can't boot from emulated cdrom.
After some debug, I found the reason is that my iso file is in a samba
file system. When qemu read data from my samba file system. read will be
interrupted by signal alarm. So qemu won't boot from it.

The follwing patch will fix it.

--- qemu-0.7.1/block.c	2005-07-25 02:52:08.000000000 +0800
+++ qemu-0.7.1-lepton/block.c	2005-07-27 18:57:21.000000000 +0800
@@ -591,10 +591,16 @@ static int raw_read(BlockDriverState *bs
     int ret;
     
     lseek(s->fd, sector_num * 512, SEEK_SET);
-    ret = read(s->fd, buf, nb_sectors * 512);
-    if (ret != nb_sectors * 512) 
-        return -1;
-    return 0;
+    while(1){
+  	ret = read(s->fd, buf, nb_sectors * 512);
+	if (ret != nb_sectors * 512) {
+		if(ret==-1 && errno==EINTR)
+			continue;
+	    	else
+        		return -1;
+	}
+	return 0;
+    }
 }
 
 static int raw_write(BlockDriverState *bs, int64_t sector_num, 

             reply	other threads:[~2005-07-27 11:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-27 11:10 lepton [this message]
2005-07-27 12:55 ` [Qemu-devel] [patch]Fix block device read for some SLOW file Johannes Schindelin
2005-07-27 13:18 ` [Qemu-devel] " Jani Monoses

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=20050727111057.GA21694@gsy2.lepton.home \
    --to=ytht.net@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).