Date: Tue, 31 May 2022 21:19:42 +0100 From: "Alexander V. Chernikov" <melifaro@ipfw.ru> To: Mateusz Guzik <mjguzik@gmail.com> Cc: "Alexander V. Chernikov" <melifaro@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@freebsd.org> Subject: Re: git: 8c0d1eca7834 - main - sockbuf: retain backward compatibility with userland after d59bc188d652 Message-ID: <5A6DF60F-9584-43D4-BBF8-18634742A7C3@ipfw.ru> In-Reply-To: <CAGudoHG1v1f86v8mGjs7W5hq1ibrjKaJ4fZTyxAfAufuYD6A0A@mail.gmail.com> References: <202205301510.24UFAxvj014259@gitrepo.freebsd.org> <CAGudoHGptA4h2Nvb06WCTP7iXbWMNGgcUgiCeaFL0cXz=7TGnw@mail.gmail.com> <8909171653936542@iva6-17bf07036239.qloud-c.yandex.net> <CAGudoHG1v1f86v8mGjs7W5hq1ibrjKaJ4fZTyxAfAufuYD6A0A@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> On 31 May 2022, at 15:33, Mateusz Guzik <mjguzik@gmail.com> wrote: >=20 > On 5/30/22, Alexander V. Chernikov <melifaro@ipfw.ru> wrote: >>=20 >>=20 >> 30.05.2022, 16:18, "Mateusz Guzik" <mjguzik@gmail.com>: >>>=20 >>> should probably CTASSERT on size then >>=20 >> Sorry, I=E2=80=99m afraid I don=E2=80=99t get it. Could you please = clarify? >>>=20 >=20 > diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h > index 249e0800f915..5fc21206b1bf 100644 > --- a/sys/sys/socketvar.h > +++ b/sys/sys/socketvar.h > @@ -586,6 +586,14 @@ struct xsocket { > } so_rcv, so_snd; > }; >=20 > +#if _LP64 > +_Static_assert(sizeof(struct xsocket) =3D=3D 240, "bad=E2=80=9D) Ah, got it! Well, the rationale for the commit was not to absolutely prevent = structure size changes - there may be many perfectly valid reasons to do = so. IIRC policy suggests it acceptable between the major revisions. In the case of original change - removal of mbuf counters - backward = compatibility (e.g. keeping structure size the same) does not cost us = anything. sockstat(1) from 13 will work on 14 (at least for now). > +#elsif _LP32 > +.... > +#else > +#error "port me" > +#endif > + > #ifdef _KERNEL > void sotoxsocket(struct socket *so, struct xsocket *xso); > void sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb); >=20 >>> On 5/30/22, Alexander V. Chernikov <melifaro@freebsd.org> wrote: >>>>=20 >>>> The branch main has been updated by melifaro: >>>>=20 >>>> URL: >>>> = https://cgit.FreeBSD.org/src/commit/?id=3D8c0d1eca7834bfd5a05c86bf20a76009= 17057492 >>>>=20 >>>> commit 8c0d1eca7834bfd5a05c86bf20a7600917057492 >>>> Author: Alexander V. Chernikov <melifaro@FreeBSD.org> >>>> AuthorDate: 2022-05-30 14:56:25 +0000 >>>> Commit: Alexander V. Chernikov <melifaro@FreeBSD.org> >>>> CommitDate: 2022-05-30 15:10:53 +0000 >>>>=20 >>>> sockbuf: retain backward compatibility with userland after >>>> d59bc188d652 >>>>=20 >>>> Add spare fields to xsockbuf in place of sb_mcnt / sb_ccnt to = avoid >>>> rebuilding userland binaries like sockstat(1). >>>>=20 >>>> Reviewed by: glebius >>>> --- >>>> sys/sys/socketvar.h | 2 ++ >>>> 1 file changed, 2 insertions(+) >>>>=20 >>>> diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h >>>> index 52b9376f0559..249e0800f915 100644 >>>> --- a/sys/sys/socketvar.h >>>> +++ b/sys/sys/socketvar.h >>>> @@ -577,6 +577,8 @@ struct xsocket { >>>> uint32_t sb_cc; >>>> uint32_t sb_hiwat; >>>> uint32_t sb_mbcnt; >>>> + uint32_t sb_spare0; /* was sb_mcnt */ >>>> + uint32_t sb_spare1; /* was sb_ccnt */ >>>> uint32_t sb_mbmax; >>>> int32_t sb_lowat; >>>> int32_t sb_timeo; >>>>=20 >>>=20 >>>=20 >>> -- >>> Mateusz Guzik <mjguzik gmail.com> >>=20 >=20 >=20 > --=20 > Mateusz Guzik <mjguzik gmail.com>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5A6DF60F-9584-43D4-BBF8-18634742A7C3>