From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Dxjsk-0006bR-Jf for qemu-devel@nongnu.org; Wed, 27 Jul 2005 07:15:27 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Dxjsi-0006a9-Kn for qemu-devel@nongnu.org; Wed, 27 Jul 2005 07:15:25 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dxjsg-0006To-AT for qemu-devel@nongnu.org; Wed, 27 Jul 2005 07:15:22 -0400 Received: from [64.233.162.194] (helo=zproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Dxjzc-0006eR-Af for qemu-devel@nongnu.org; Wed, 27 Jul 2005 07:22:32 -0400 Received: by zproxy.gmail.com with SMTP id s18so139422nze for ; Wed, 27 Jul 2005 04:11:11 -0700 (PDT) Received: from lepton by gsy2.lepton.home with local (Exim 4.50) id 1DxjoP-0005eN-AZ for qemu-devel@nongnu.org; Wed, 27 Jul 2005 19:10:57 +0800 Date: Wed, 27 Jul 2005 19:10:57 +0800 From: lepton Message-ID: <20050727111057.GA21694@gsy2.lepton.home> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [patch]Fix block device read for some SLOW file Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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,