On 3/11/21 7:47 PM, Daniel P. Berrangé wrote:
On Thu, Mar 11, 2021 at 06:54:20PM +0100, Michal Privoznik wrote:
Historically, we declared pointer type to our types:

   typedef struct _virXXX virXXX;
   typedef virXXX *virXXXPtr;

But usefulness of such declaration is questionable, at best.
Unfortunately, we can't drop every such declaration - we have to
carry some over, because they are part of public API (e.g.
virDomainPtr). But for internal types - we can do drop them and
use what every other C project uses 'virXXX *'.

This change was generated by a very ugly shell script that
generated sed script which was then called over each file in the
repository. For the shell script refer to the cover letter:

$URL

Signed-off-by: Michal Privoznik <mpriv...@redhat.com>
---
  docs/advanced-tests.rst                       |    2 +-
  docs/api_extension.html.in                    |    2 +-
  docs/coding-style.rst                         |    2 +-

snip

  tools/virt-login-shell-helper.c               |    4 +-
  tools/vsh-table.c                             |   36 +-
  tools/vsh-table.h                             |   12 +-
  tools/vsh.c                                   |    4 +-
  732 files changed, 29237 insertions(+), 30131 deletions(-)

Converting every single file at the same time in one commit is
guaranting backporting conflict hell.

eg if I'm backporting a patch from src/qemu, it is much
saner if I can cherry-pick the "Ptr" conversion from src/qemu
and only deal with conflicts in that, not the entire soure
tree.

So if we're going to do this conversion, IMHO the actual commits
need to be way more granular. At the very least I think this
needs to be split per driver, with tests/ associated with their
driver. The util/ directory needs to be split up and likewise
the conf/ directory per object type I think.

I though about it this way too, but then I realized, that the only type of merge conflicts we will get while backporting is context. I mean, after this commit, every subsequent commit will use 'virXXX *' which is perfectly okay even now. And thus what we might get the only type of conflict - cherry picked commit already expects 'virXXX *' (e.g. it renames a variable), but the downstream has 'virXXXPtr'. But this kind of conflict is trivial to resolve.

Another reason to put it into one huge patch was to not bother with dependencies. It's not uncommon that our commits touch different locations at the same time, they are not strictly aiming on one submodule (e.g. src/conf and src/qemu at the same time, or src/util and tools/virsh). The point is, making the granularity satisfactory fine grained is hard.


Also dropping usage of the "Ptr" should be separate from dropping
the typedefs themselves as I think that'll make conflicts easier
to deal with.

Yeah, this makes sense. I'll split it.

Michal

Reply via email to