From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:51074) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2GC9-0004ON-Rl for qemu-devel@nongnu.org; Fri, 08 Mar 2019 09:09:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h2GC7-0002xd-Tw for qemu-devel@nongnu.org; Fri, 08 Mar 2019 09:09:53 -0500 References: <20190308062455.29755-1-armbru@redhat.com> <481d398a-e26c-6c0a-20b7-7466ae1ebf1f@redhat.com> <875zsteeih.fsf@dusky.pond.sub.org> <20190308133510.GC31583@localhost.localdomain> From: Laszlo Ersek Message-ID: <7c5033f4-3d9f-be62-4d7e-9b5931c9aedb@redhat.com> Date: Fri, 8 Mar 2019 15:09:39 +0100 MIME-Version: 1.0 In-Reply-To: <20190308133510.GC31583@localhost.localdomain> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v7] pflash: Require backend size to match device, improve errors List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , Markus Armbruster Cc: qemu-devel@nongnu.org, philmd@redhat.com, alex.bennee@linaro.org, qemu-block@nongnu.org, mreitz@redhat.com On 03/08/19 14:35, Kevin Wolf wrote: > Am 08.03.2019 um 13:28 hat Markus Armbruster geschrieben: >> Laszlo Ersek writes: >>> This one has got to be one of the longest bike-shedding sessions! :) >>> >>> I'm fine with this patch, but I could suggest two improvements. >>> >>> (1) When blk_getlength() fails, we could format the negative error code >>> returned by it into the error message. >> >> I can do that. > > By using error_setg_errno(), I assume. Not throwing away error details > is always good. > >>> (2) We could extract the common code to a new function in >>> "hw/block/block.c". (It says "Common code for block device models" on >>> the tin.) >> >> There's so much common code in these two files even before this patch... > > My understanding is that hw/block/block.c contains code that is > potentially useful to all kinds of block devices, not random code that > two specific similar devices happen to share. Ah, OK. > If we want to deduplicate some code in the flash devices, without any > expectation that other devices will use it at some point, I'd rather > create a new source file hw/block/pflash_common.c or something like > that. Sure, that makes a lot of sense then. Cheers Laszlo