Received: from eggs.gnu.org ([2001:4830:134:3::10]:39895) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKm6z-0002ZZ-3M for qemu-devel@nongnu.org; Wed, 06 Jul 2016 08:39:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKm6w-0000B8-Np for qemu-devel@nongnu.org; Wed, 06 Jul 2016 08:39:27 -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> <6c680fb5-9ba5-7875-470d-86c9a7e21fc2@redhat.com> From: Max Reitz Message-ID: <53a846a0-e915-e149-88d4-84367a2a7721@redhat.com> Date: Wed, 6 Jul 2016 14:39:16 +0200 MIME-Version: 1.0 In-Reply-To: <6c680fb5-9ba5-7875-470d-86c9a7e21fc2@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="FUQnqgTjkXGvJLmmGwmENnufjg8569oVK" 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) --FUQnqgTjkXGvJLmmGwmENnufjg8569oVK 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: <53a846a0-e915-e149-88d4-84367a2a7721@redhat.com> 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> <6c680fb5-9ba5-7875-470d-86c9a7e21fc2@redhat.com> In-Reply-To: <6c680fb5-9ba5-7875-470d-86c9a7e21fc2@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 05.07.2016 23:12, John Snow wrote: >=20 >=20 > On 07/05/2016 05:00 PM, Max Reitz wrote: >> On 05.07.2016 22:50, John Snow wrote: >>> >>> >>> 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 pa= rt of >>>>> the process of modularizing block drivers. Having the probe functio= ns >>>>> separate from the rest of the driver allows us to probe without hav= ing >>>>> 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. >>>> >>> >>> Admittedly I have been nudging Colin to shoot from the hip a bit on >>> filename organization because I was short of ideas. >>> >>> Some ideas: >>> >>> (1) A combined probe.c file. This keeps the existing organization and= >>> localizes everything to just one new file. >>> >>> Downside: many formats rely on at least some minimal amount of struct= ure >>> and constant definitions, and some of those overlap with each other. >>> qcow and qcow2 both using "QcowHeader" would be a prominent example. >>> >>> 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 modul= ar >>> 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 meth= od. >>> >>> (2) Separate probe files for each driver. >>> >>> What we went with. Keeps refactoring to a minimum. Adds a bunch of >>> little files, but it's minimal and fairly noninvasive. >>> >>> Like #1 though, we still have to figure out what to do with the commo= n >>> includes. >>> >>>> 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 >>>> >>> >>> So, something like: >>> >>> block/drivers/bochs/ >>> >>> bochs.c >>> probe.c (or bochs-probe.c) >>> >>> and >>> >>> include/block/drivers/bochs/ >>> >>> common.h (or internal.h) >>> >>> >>> 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 i= s >> of no concern to upstream (which we are talking about), but it's alway= s >> iffy when it comes to backports. And I am a Red Hat employee, so I am >> paid to think about them. >> >=20 > Reason: We haven't had modules before. Now we do. Shared constants and > structures need to go somewhere, probes need to get split out. >=20 > Now, existing files (that will become the modular portions) can stay pu= t > if you'd like, but the probes and common includes need to go somewhere.= >=20 > Block drivers will be more decentralized than they've ever been. 1-3 > files per each driver, depending on if they have a probe or if they hav= e > shared definitions that the probe needs to access. >=20 > This at least raises the question for organization to minimize future > confusion. The answer to that question might be "Please leave the core > modules/drivers alone," but the question gets asked. >=20 >> Also, there's another argument: As far as I know we sooner or later wa= nt >> 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. >> >=20 > Doesn't really sound like an argument against the file layout you're > replying to. >=20 >> Max >> >=20 > 12 weeks isn't a very long time, so if you have a preferred > organizational structure, I'd prefer you present that instead of just a= > NACK, or put your vote for the currently presented organization in this= v3. I liked block/probe/. Max --FUQnqgTjkXGvJLmmGwmENnufjg8569oVK 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 iQEvBAEBCAAZBQJXfPv0EhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrY6x B/0aDS1Q+DjW/06DTFXoB9eVjY3aczwf2i6uXmcXPsqxJ8ZxMBRnyq3fQtR2Tr8D /eQsGE9aiqzjTywh/lWAqHhccBMshnauE6JUlaKgYdpGVZ43JqhUtupDv0SYvnvz FSNkl71eUimxGDPW0DZWk/kYgMABtfOq8U6gTS1d8QK2CJbEyTSmxTA6hlhjG6wz 3ghFRO1EmdJs++H7X1T3+UROTkaTREppnAaRFV94NmoXG7WS1donvnKU7X5lLy4u b9m+CY6HkftxDKm9yXczluyzb8xB1LesjVIwbxTJM7aNNcUWyAjd27o7QVmxmNlE 9x7d0wpnUQKTCw0rRBSeAc9Q =XVJt -----END PGP SIGNATURE----- --FUQnqgTjkXGvJLmmGwmENnufjg8569oVK--