From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202502 header.b=XpW2MKIF; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 8A1C05A0271 for ; Tue, 04 Feb 2025 00:55:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202502; t=1738626924; bh=HNzMF1ihrHYowTWuJbohwJIhtd017jT98nJTpLmX9z8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XpW2MKIFBOk01OqUVh2bW9Io2Ll16hEMqiVhSZXspXKigVB2ewDkDJmKgCK9nBWOi fYAguHaeOFj4ejaI15rUDXMmO68iXAttq8b35PL2QoiiB0p6BRi1JwPZvyWwjnl41U vqU7clp/cGBEdSz7fdqLrk+xqKijj3Af/y1vcksuATAGmbiaD8vKU59T/9XLilyVop ry5jtzQYIuVoEl93vUb000XnpsjOpVju8IvEbRhzRNDjEB8cyUFbEDgvj2b6aw8yW5 6Ifu6BIedLnsJoBpV1hgmadQfh6aZKd6P63NhGeCAxGyA3tGYzVa+BqKPIWpBfj02B xkPxiZdnKJpbA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Yn3K86hLmz4wc4; Tue, 4 Feb 2025 10:55:24 +1100 (AEDT) Date: Tue, 4 Feb 2025 10:55:28 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 6/6] migrate: Make migration handlers simpler and more flexible Message-ID: References: <20250203092615.500163-1-david@gibson.dropbear.id.au> <20250203092615.500163-7-david@gibson.dropbear.id.au> <20250203112003.1bcc7acd@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="3E2OQMxz0AbAf86k" Content-Disposition: inline In-Reply-To: <20250203112003.1bcc7acd@elisabeth> Message-ID-Hash: Y32HCXQWIWEB3FIROQPKOKPBM3DA3XCN X-Message-ID-Hash: Y32HCXQWIWEB3FIROQPKOKPBM3DA3XCN X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --3E2OQMxz0AbAf86k Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Feb 03, 2025 at 11:20:03AM +0100, Stefano Brivio wrote: > On Mon, 3 Feb 2025 20:26:15 +1100 > David Gibson wrote: >=20 > > +/* Stages for version 1 */ > > +static const struct migrate_stage stages_v1[] =3D { > > + { > > + .name =3D "flow pre", > > + .source =3D flow_migrate_source_pre, > > + .target =3D NULL, > > + }, > > + DATA_STAGE(flow_first_free), > > + DATA_STAGE(flowtab), > > + DATA_STAGE(flow_hashtab), > > + DATA_STAGE(g_hash_secret), >=20 > ...so this one for g_hash_secret (which is the abomination I wanted > to drop) would eventually turn into a function? Yes. > It looks neat, I'm just not sure if we'll really have "data stages" > after I change the approach to only transfer the data we need as you > suggested. I agree, that may well be the case, but we can just drop the macro and helepr functions then. > Is that part of your pending queue by the way, or should I go ahead with > it? Is which part of my pending queue? g_hash_secret as a function? No, I've thought of it, but I haven't written it yet. >=20 > > [...] > > > > /** > > - * struct migrate_data - Data sections for given source version > > - * @v: Source version this applies to, host order > > - * @sections: Array of data sections, NULL-terminated > > + * migrate_cb_t - Callback function to implement one migration stage > > */ > > -struct migrate_data { > > - uint32_t v; > > - struct iovec *sections; > > -}; > > +typedef int (*migrate_cb_t)(struct ctx *c, struct migrate_meta *m, > > + const struct migrate_stage *stage, int fd); >=20 > typedef is really annoying, we already have a flow_sidx which kind of > made sense, but this has really no advantage over something like: Eh, I guess. I find the extra . or -> a little annoying, but we can do this if you'd prefer. > struct migrate_handler { > int (*fn)(struct ctx *c, struct migrate_meta *m); > }; >=20 --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --3E2OQMxz0AbAf86k Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmehV2sACgkQzQJF27ox 2GcUhA/+M9q+5CnxSZCRUC+7O1xdI1MJTi+u1AQgjN9gnASyEOTSeGT7vUo9E7nd W/oZCTj4k8mBKdsweGx15sbWP1RObE9pU0DL8EDJKO6reumytahPhVH6q5mYV/65 8S9gz277xTpWW7wvF819gCFR2j79EeVsx10iwdvr00Nb1gMXquGtTHgUfEOYAc/5 Bmpd+0UB+6XTp5Nev58Qe0V924LQD3/gNF5N9NGyvbUbbAFz9ofHw4VhfcqXs3Ly kmxZ71iN+4K9xWDeoyO8dT3DYVaOGz4daIUVy8Y8XF9/01WyzIiq1wLNdIHKyJi6 Orlqcw9N+C8v0TFU0xO7lC6AOAutRsWeEuSXqsWh1V26QV8+Ivfx1/4VYuGHywP9 PAs+/CQ6zu/y13RGBX0ZbILUTAjMYVmHjaUo//ZmdCEAlxtoTal8oZuwkoD4FuHu VKzr8gcf1abOvDCj6V3V9U/63k0r9hgvpXz9D5OJWOaeJjnQLQLBjZ6AXg1Xr2b3 r8r/0ed32n5hL0OYrSiOOIRBp55rB5GjYmfK+liTqbbJfTM9YjKHl3RPi/rTf/dC jiX8Tlr+NavocBRBokMo+J+4QHIpUCEbuRS8Sm/emJCAOxt1eyO4VPWxpTHgIx/s XqbpYZxeHS9357ca7g3FSkP3RxueiHIBKMuVjdWPeRoNMJtt03U= =KzTy -----END PGP SIGNATURE----- --3E2OQMxz0AbAf86k--