From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1OBQR3-0006uy-8w for qemu-devel@nongnu.org; Mon, 10 May 2010 06:42:05 -0400 Received: from [140.186.70.92] (port=42629 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OBQPW-0005ar-10 for qemu-devel@nongnu.org; Mon, 10 May 2010 06:42:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OBQOZ-0006hF-P0 for qemu-devel@nongnu.org; Mon, 10 May 2010 06:40:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47474) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OBQOZ-0006gq-Hr for qemu-devel@nongnu.org; Mon, 10 May 2010 06:39:31 -0400 Message-ID: <4BE7E25F.20208@redhat.com> Date: Mon, 10 May 2010 13:39:27 +0300 From: Avi Kivity MIME-Version: 1.0 References: <1271872408-22842-1-git-send-email-cam@cs.ualberta.ca> <1271872408-22842-2-git-send-email-cam@cs.ualberta.ca> <1271872408-22842-3-git-send-email-cam@cs.ualberta.ca> In-Reply-To: <1271872408-22842-3-git-send-email-cam@cs.ualberta.ca> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH v5 2/5] Support adding a file to qemu's ram allocation List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cam Macdonell Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org On 04/21/2010 08:53 PM, Cam Macdonell wrote: > This avoids the need of using qemu_ram_alloc and mmap with MAP_FIXED to map a > host file into guest RAM. This function mmaps the opened file anywhere and adds > the memory to the ram blocks. > > Usage is > > qemu_ram_mmap(fd, size, MAP_SHARED, offset); > Signoff? > > +ram_addr_t qemu_ram_mmap(int fd, ram_addr_t size, int flags, off_t offset) > +{ > + RAMBlock *new_block; > + > + size = TARGET_PAGE_ALIGN(size); > + new_block = qemu_malloc(sizeof(*new_block)); > + > + /* map the file passed as a parameter to be this part of memory */ > + new_block->host = mmap(0, size, PROT_READ|PROT_WRITE, flags, fd, offset); > + > + if (new_block->host == MAP_FAILED) > + exit(1); > Braces after if () > + if (kvm_enabled()) > + kvm_setup_guest_memory(new_block->host, size); > + > More braces. -- error compiling committee.c: too many arguments to function