Date: Thu, 27 Jul 2023 18:26:11 -0700 From: Mark Millard <marklmi@yahoo.com> To: "mckusick@freebsd.org" <mckusick@FreeBSD.org>, dev-commits-src-main@freebsd.org Subject: Re: git: 831b1ff7913f - main - UFS/FFS: Migrate to modern uintXX_t from u_intXX_t. Message-ID: <56D46196-6F4D-4C3E-AFD0-53FD43A984C4@yahoo.com> In-Reply-To: <B1344E0F-E41E-4BCD-9A78-5BF8A6B1D6BA@yahoo.com> References: <B1344E0F-E41E-4BCD-9A78-5BF8A6B1D6BA@yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Jul 27, 2023, at 17:22, Mark Millard <marklmi@yahoo.com> wrote: > Kirk McKusick <mckusick_at_FreeBSD.org> wrote on > Date: Thu, 27 Jul 2023 22:27:49 UTC : >=20 >> The branch main has been updated by mckusick: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D831b1ff7913fb0b317a258a43dce5abe= fee03a31 >>=20 >> commit 831b1ff7913fb0b317a258a43dce5abefee03a31 >> Author: Kirk McKusick <mckusick@FreeBSD.org> >> AuthorDate: 2023-07-27 22:26:01 +0000 >> Commit: Kirk McKusick <mckusick@FreeBSD.org> >> CommitDate: 2023-07-27 22:27:36 +0000 >>=20 >> UFS/FFS: Migrate to modern uintXX_t from u_intXX_t. >>=20 >> As per = https://lists.freebsd.org/archives/freebsd-scsi/2023-July/000257.html >> move to the modern uintXX_t. While here also migrate u_char to = uint8_t. >> Where other kernel interfaces allow, migrate u_long to uint64_t. >=20 > Looks dangerous to me . . . >=20 > u_long (a.k.a. unsigned long) on armv7, for example, is > 32 bits, not 64. Same for i386, I expect. I forgot to mention 32-bit powerpc and could have just quoted: LP64 ILP32 counterpart amd64 i386 powerpc64 powerpc aarch64 armv6/armv7 and/or: On all supported architectures: Type Size short 2 int 4 long sizeof(void*) long long 8 float 4 double 8 > For reference, from /usr/include/sys/types.h : >=20 > #if __BSD_VISIBLE > typedef unsigned char u_char; > typedef unsigned short u_short; > typedef unsigned int u_int; > typedef unsigned long u_long; > #ifndef _KERNEL > typedef unsigned short ushort; /* Sys V compatibility */ > typedef unsigned int uint; /* Sys V compatibility */ > #endif > #endif >=20 > Quoting FreeBSD's man arch: >=20 > ILP32 int, long, void * types machine representations all have = 4-byte > size. >=20 > LP64 int type machine representation uses 4 bytes, while long = and > void * are 8 bytes. >=20 > armv7 is ILP32, as, likely, i386 would be as well. >=20 > Note that u_int is 32 bits for both ILP32 and LP64, not 64. > But there are a lot of u_int -> uint64_t replacements in > the update. >=20 >> No functional changes intended. >=20 > It would appear that it would take a bunch of validation to know if > the size changes actually make no actual difference on the > architectures where some sizes changed. >=20 >> MFC-after: 1 week >> Sponsored-by: The FreeBSD Foundation > . . . >=20 I also noticed an int vs. uint64_t switch (but the signed status does not change the sizeof(...) results here vs. u_int / unsigned int): - len =3D roundup2(howmany(fs->fs_ncg, NBBY), sizeof(int)); + len =3D roundup2(howmany(fs->fs_ncg, NBBY), sizeof(uint64_t)); =3D=3D=3D Mark Millard marklmi at yahoo.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?56D46196-6F4D-4C3E-AFD0-53FD43A984C4>