From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYd0R-00012v-TT for qemu-devel@nongnu.org; Mon, 29 Sep 2014 11:37:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XYd0M-0003Vj-Ql for qemu-devel@nongnu.org; Mon, 29 Sep 2014 11:36:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41281) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYd0M-0003V3-IX for qemu-devel@nongnu.org; Mon, 29 Sep 2014 11:36:50 -0400 Date: Mon, 29 Sep 2014 17:36:39 +0200 From: Kevin Wolf Message-ID: <20140929153639.GJ3910@noname.str.redhat.com> References: <20140929121003.652fc6c2@igors-macbook-pro.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] build regression on osx in block layer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Igor Mammedov , QEMU Developers , Hu Tao Am 29.09.2014 um 15:58 hat Peter Maydell geschrieben: > On 29 September 2014 11:10, Igor Mammedov wrote: > > Build fails with: > > > > $ make > > LINK qemu-nbd > > Undefined symbols for architecture x86_64: > > "_posix_fallocate", referenced from: > > _raw_create in raw-posix.o > > ld: symbol(s) not found for architecture x86_64 > > > > introduced by > > 06247428be raw-posix: Add falloc and full preallocation > > I think the MacOSX interface to this involves > fcntl(F_PREALLOCATE). This is what Mozilla uses: > > fstore_t store = {F_ALLOCATECONTIG, F_PEOFPOSMODE, 0, aLength}; > // Try to get a continous chunk of disk space > int ret = fcntl(fd, F_PREALLOCATE, &store); > if(-1 == ret){ > // OK, perhaps we are too fragmented, allocate non-continuous > store.fst_flags = F_ALLOCATEALL; > ret = fcntl(fd, F_PREALLOCATE, &store); > if (-1 == ret) > return false; > } > return 0 == ftruncate(fd, aLength); > > This has probably broken compilation on the BSDs > as well, since I don't suppose they all have > posix_fallocate(). In extremis we can implement > it with truncate-and-write, cf: > http://stackoverflow.com/questions/11497567/fallocate-command-equivalent-in-os-x > > We probably need a util/qemu-fallocate.c... Sent a patch to make the build of that code conditional. Having some util/qemu-fallocate.c probably wouldn't hurt, but it needs to be done by someone who has a system that uses a different path (i.e. not me). Kevin