From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49662) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZsWtr-00040U-5h for qemu-devel@nongnu.org; Sat, 31 Oct 2015 10:12:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZsWto-0000B1-0S for qemu-devel@nongnu.org; Sat, 31 Oct 2015 10:12:55 -0400 Received: from mga01.intel.com ([192.55.52.88]:58004) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZsWtn-0000Ar-RY for qemu-devel@nongnu.org; Sat, 31 Oct 2015 10:12:51 -0400 References: <1446184587-142784-1-git-send-email-guangrong.xiao@linux.intel.com> <1446184587-142784-8-git-send-email-guangrong.xiao@linux.intel.com> <5633700C.3060108@virtuozzo.com> <56346D1C.6040605@linux.intel.com> <56348BF4.7030609@virtuozzo.com> From: Xiao Guangrong Message-ID: <5634CAD2.6010505@linux.intel.com> Date: Sat, 31 Oct 2015 22:06:10 +0800 MIME-Version: 1.0 In-Reply-To: <56348BF4.7030609@virtuozzo.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v6 07/33] util: introduce qemu_file_get_page_size() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladimir Sementsov-Ogievskiy , pbonzini@redhat.com, imammedo@redhat.com Cc: ehabkost@redhat.com, kvm@vger.kernel.org, mst@redhat.com, gleb@kernel.org, mtosatti@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, dan.j.williams@intel.com, rth@twiddle.net On 10/31/2015 05:37 PM, Vladimir Sementsov-Ogievskiy wrote: > On 31.10.2015 10:26, Xiao Guangrong wrote: >> >> >> On 10/30/2015 09:26 PM, Vladimir Sementsov-Ogievskiy wrote: >>> logic is changed: >>> in old version gethugepagesize on statfs error generates exit(1) >>> in new it returns getpagesize() in this case (through fd_getpagesize) >>> (I think, fd_getpagesize should be fixed to handle error) >> >> Indeed. I will let fd_getpagesize() return 0 if statfs is failed, then the caller >> handle the error properly. > > Why not use classic error codes < 0? Just change size_t to ssize_t and return exactly fstatfs return > value. Yup, it's better, however, i am planning to introduce a Error parameter and error condition can be checked by if Error is NULL as Eduardo suggested.