Date: Tue, 2 Jun 2020 13:38:19 +0200 From: Emmanuel Vadot <manu@bidouilliste.com> To: "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net> Cc: "Hans Petter Selasky" <hselasky@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r361723 - head/sys/compat/linuxkpi/common/include/linux Message-ID: <20200602133819.ca4e9e508ba3334b77d24ee4@bidouilliste.com> In-Reply-To: <C7F8A958-0DC8-42C7-AE5B-AAAA28F25336@lists.zabbadoz.net> References: <202006021019.052AJjxk060018@repo.freebsd.org> <20200602123612.fc6dbafe55c2c981cb0ec9a1@bidouilliste.com> <C7F8A958-0DC8-42C7-AE5B-AAAA28F25336@lists.zabbadoz.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 02 Jun 2020 11:31:58 +0000 "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net> wrote: > On 2 Jun 2020, at 10:36, Emmanuel Vadot wrote: >=20 > > Hello Hans, > > > > On Tue, 2 Jun 2020 10:19:45 +0000 (UTC) > > Hans Petter Selasky <hselasky@FreeBSD.org> wrote: > > > >> Author: hselasky > >> Date: Tue Jun 2 10:19:45 2020 > >> New Revision: 361723 > >> URL: https://svnweb.freebsd.org/changeset/base/361723 > >> > >> Log: > >> Implement struct_size() function macro in the LinuxKPI. > >> > >> MFC after: 1 week > >> Sponsored by: Mellanox Technologies > >> > >> Modified: > >> head/sys/compat/linuxkpi/common/include/linux/kernel.h > >> > >> Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h > >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > >> --- head/sys/compat/linuxkpi/common/include/linux/kernel.h Tue Jun 2= =20 > >> 09:45:43 2020 (r361722) > >> +++ head/sys/compat/linuxkpi/common/include/linux/kernel.h Tue Jun 2= =20 > >> 10:19:45 2020 (r361723) > >> @@ -555,4 +555,10 @@ linux_ratelimited(linux_ratelimit_t *rl) > >> return (ppsratecheck(&rl->lasttime, &rl->counter, 1)); > >> } > >> > >> +#define struct_size(ptr, field, num) ({ \ > >> + const size_t __size =3D offsetof(__typeof(*(ptr)), field); \ > >> + const size_t __max =3D (SIZE_MAX - __size) / sizeof((ptr)->field[0])= ;=20 > >> \ > >> + ((num) > __max) ? SIZE_MAX : (__size + sizeof((ptr)->field[0]) *=20 > >> (num)); \ > >> +}) > >> + > >> #endif /* _LINUX_KERNEL_H_ */ > > > > Can you bump FreeBSD_version so I can fix > > https://github.com/freebsd/drm-kmod/ and update the > > graphics/drm-devel-kmod port please ? >=20 > I almost wonder if we want a ?linuxkkpi version? to check instead. > If there?s a lot more ?work? on the linuxkpi we might not want to=20 > bump __FreeBSD_version for every change which can conflict/affect=20 > external code? >=20 > /bz >=20 There is a LINUXKPI_VERSION but that's for Linux version compliance. It's not easy to add a linuxkpi_version like freebsd_version because you cannot check it in the port makefile. But that might help when mfc'ing linuxkpi stuff. FreeBSD_version is cheap enough to bump. --=20 Emmanuel Vadot <manu@bidouilliste.com> <manu@freebsd.org>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200602133819.ca4e9e508ba3334b77d24ee4>