Received: from eggs.gnu.org ([2001:4830:134:3::10]:34216) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKXSh-0007qK-DE for qemu-devel@nongnu.org; Tue, 05 Jul 2016 17:00:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKXSg-00076P-8i for qemu-devel@nongnu.org; Tue, 05 Jul 2016 17:00:55 -0400 References: <1467732272-23368-1-git-send-email-clord@redhat.com> <1467732272-23368-5-git-send-email-clord@redhat.com> <20160705154925.GA6553@redhat.com> <32a142e7-8e46-9ae7-30b0-df42876601cb@redhat.com> From: Max Reitz Message-ID: Date: Tue, 5 Jul 2016 23:00:42 +0200 MIME-Version: 1.0 In-Reply-To: <32a142e7-8e46-9ae7-30b0-df42876601cb@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GQxs61cpdhEBHCtqdXGmc5LpO2LBBAnVA" Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v3 04/32] blockdev: Move bochs probe into separate file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow , "Daniel P. Berrange" , Colin Lord Cc: kwolf@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --GQxs61cpdhEBHCtqdXGmc5LpO2LBBAnVA From: Max Reitz To: John Snow , "Daniel P. Berrange" , Colin Lord Cc: kwolf@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Message-ID: Subject: Re: [Qemu-block] [Qemu-devel] [PATCH v3 04/32] blockdev: Move bochs probe into separate file References: <1467732272-23368-1-git-send-email-clord@redhat.com> <1467732272-23368-5-git-send-email-clord@redhat.com> <20160705154925.GA6553@redhat.com> <32a142e7-8e46-9ae7-30b0-df42876601cb@redhat.com> In-Reply-To: <32a142e7-8e46-9ae7-30b0-df42876601cb@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 05.07.2016 22:50, John Snow wrote: >=20 >=20 > On 07/05/2016 11:49 AM, Daniel P. Berrange wrote: >> On Tue, Jul 05, 2016 at 11:24:04AM -0400, Colin Lord wrote: >>> This puts the bochs probe function into its own separate file as part= of >>> the process of modularizing block drivers. Having the probe functions= >>> separate from the rest of the driver allows us to probe without havin= g >>> to potentially unnecessarily load the driver. >>> >>> Signed-off-by: Colin Lord >>> --- >>> block/Makefile.objs | 1 + >>> block/bochs.c | 55 ++--------------------------------= ---------- >>> block/probe/bochs.c | 21 +++++++++++++++++ >> >> Do we really need a sub-dir for this ? If we were going to >> have sub-dirs under block/, I'd suggest we have one subdir >> per block driver, not spread code for one block driver >> across multiple dirs. >> >=20 > Admittedly I have been nudging Colin to shoot from the hip a bit on > filename organization because I was short of ideas. >=20 > Some ideas: >=20 > (1) A combined probe.c file. This keeps the existing organization and > localizes everything to just one new file. >=20 > Downside: many formats rely on at least some minimal amount of structur= e > and constant definitions, and some of those overlap with each other. > qcow and qcow2 both using "QcowHeader" would be a prominent example. >=20 > They could all be disentangled, but it's less clear on where all the > common definitions go. A common probe.h is a bad idea since the modular= > portion of the driver has no business gaining access to other formats' > definitions. We could create a probe.c and matching > include/block/bdrv/fmt.h includes, but we lost our zeal for this method= =2E >=20 > (2) Separate probe files for each driver. >=20 > What we went with. Keeps refactoring to a minimum. Adds a bunch of > little files, but it's minimal and fairly noninvasive. >=20 > Like #1 though, we still have to figure out what to do with the common > includes. >=20 >> IMHO a block/bochs-probe.c would be better, unless we did >> move block/bochs.c into a block/bochs/driver.c dir. >> >> Either way, you should update MAINTAINERS file to record >> this newly added filename, against the bochs entry. The >> same applies to most other patches in this series adding >> new files. >> >> >> Regards, >> Daniel >> >=20 > So, something like: >=20 > block/drivers/bochs/ >=20 > bochs.c > probe.c (or bochs-probe.c) >=20 > and >=20 > include/block/drivers/bochs/ >=20 > common.h (or internal.h) >=20 >=20 > Any objections from the gallery? Yea (or =93Nay=94?). I'd rather not have as many directories in block/ as= we have files there right now and in most of these directories just two files, for two reasons: (1) I don't want it, because of my personal taste. If you just did it, I probably wouldn't complain for too long, though. (2) Code motion shouldn't be done without a good reason. I know this is of no concern to upstream (which we are talking about), but it's always iffy when it comes to backports. And I am a Red Hat employee, so I am paid to think about them. Also, there's another argument: As far as I know we sooner or later want to make probing some kind of a block driver anyway (i.e. if you choose the "probe" block driver, it'll automatically replace itself by the right one). So in that sense, one could actually argue that probing is a block driver. Max --GQxs61cpdhEBHCtqdXGmc5LpO2LBBAnVA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEvBAEBCAAZBQJXfB/6EhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrYiC CACDuSc+jhKqWe2x71baY2fUe971k2GFEE3KOLSIFK4s2W6u6egTEq011E1xxoWd aJOmfSVc8SNtWIdSRRqIK+QE0+WXYB1yZA+V4Q5GCjVp2oSnIVJawwWDAa5T05qq CaCYfGUL4Cj/HDwZ2Q3p/yxHvzCenhya8R0hGRVg+6ItEcbAHBeUcuWmOtX5gfkm sxd0adTCTHEy/fDUZxRsYTcAEyPjGrt8MhAEyfq51NNrHutRKqQOLk23C6exMKru XCXlrr5IU8xsFCwAALQPabf1e+3JOFYDenx0DMFnktNpSPM/AHVIf1Wa+nfbVb23 DSMLjzz001NQpCwTSUbsIc/T =ceBi -----END PGP SIGNATURE----- --GQxs61cpdhEBHCtqdXGmc5LpO2LBBAnVA--