From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxDoi-00088c-Q9 for qemu-devel@nongnu.org; Thu, 20 Oct 2016 09:55:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bxDod-0007Xl-VV for qemu-devel@nongnu.org; Thu, 20 Oct 2016 09:55:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38144) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bxDod-0007X4-Pv for qemu-devel@nongnu.org; Thu, 20 Oct 2016 09:55:27 -0400 Date: Thu, 20 Oct 2016 15:55:22 +0200 From: Kevin Wolf Message-ID: <20161020135522.GC5211@noname.redhat.com> References: <20161020061301.31372-1-haozhong.zhang@intel.com> <20161020143412.5ea6b564@nial.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161020143412.5ea6b564@nial.brq.redhat.com> Subject: Re: [Qemu-devel] [PATCH] hostmem-file: add a property 'notrunc' to avoid data corruption List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: Haozhong Zhang , qemu-devel@nongnu.org, Eduardo Habkost , Paolo Bonzini , Peter Crosthwaite , Richard Henderson , Xiao Guangrong , mreitz@redhat.com Am 20.10.2016 um 14:34 hat Igor Mammedov geschrieben: > > #ifdef __linux__ > > +static uint64_t get_file_size(const char *path, Error **errp) > Maybe QEMU laredy has an utility to do it that could be shared, > CCing block maintainers. We have quite a bit of code for determining the right size of a file (including block devices) on different platforms and devices. See the .bdrv_getlength implementations in raw-posix.c and raw-win32.c. However, none of them are made for consumption outside the block layer. Kevin