Date: Wed, 5 Jun 2024 16:42:34 -0700 From: Enji Cooper <yaneurabeya@gmail.com> To: =?utf-8?Q?Stefan_E=C3=9Fer?= <se@freebsd.org> Cc: "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: 41ee91c64f47 - main - newfs_msdos: fix build on non-FreeBSD systems Message-ID: <DDB66592-97E1-47FF-8613-831DB0823A7D@gmail.com> In-Reply-To: <202406040628.4546SJ98088668@gitrepo.freebsd.org> References: <202406040628.4546SJ98088668@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail=_DBDAF988-3B9B-4D64-AF2B-11B57B8F70DB Content-Type: multipart/alternative; boundary="Apple-Mail=_2177F822-964E-4C5D-AF25-53AE6A5914A7" --Apple-Mail=_2177F822-964E-4C5D-AF25-53AE6A5914A7 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jun 3, 2024, at 11:28=E2=80=AFPM, Stefan E=C3=9Fer <se@freebsd.org> = wrote: >=20 > The branch main has been updated by se: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D41ee91c64f47faaa8131df3cd8a63bdb= 60fa486a >=20 > commit 41ee91c64f47faaa8131df3cd8a63bdb60fa486a > Author: Stefan E=C3=9Fer <se@FreeBSD.org> > AuthorDate: 2024-06-04 06:26:09 +0000 > Commit: Stefan E=C3=9Fer <se@FreeBSD.org> > CommitDate: 2024-06-04 06:26:09 +0000 >=20 > newfs_msdos: fix build on non-FreeBSD systems >=20 > Disable data area alignment if the build environment does not = define > PAGE_SIZE (e.g., when building on Linux or macOS). >=20 > Reported by: jrtc27 > MFC after: 1 week > --- > sbin/newfs_msdos/mkfs_msdos.c | 4 ++++ > 1 file changed, 4 insertions(+) >=20 > diff --git a/sbin/newfs_msdos/mkfs_msdos.c = b/sbin/newfs_msdos/mkfs_msdos.c > index 423fbbcadcc5..1bca560a59e1 100644 > --- a/sbin/newfs_msdos/mkfs_msdos.c > +++ b/sbin/newfs_msdos/mkfs_msdos.c > @@ -571,7 +571,11 @@ mkfs_msdos(const char *fname, const char *dtype, = const struct msdos_options *op) > if (o.align) > alignto =3D bpb.bpbSecPerClust; > else > +#ifdef PAGE_SIZE > alignto =3D PAGE_SIZE / bpb.bpbBytesPerSec; > +#else > + alignto =3D 1; > +#endif > if (alignto > 1) { > /* align data clusters */ > alignment =3D (bpb.bpbResSectors + bpb.bpbBigFATsecs * = bpb.bpbFATs + rds) % I realize this might seem silly, but what about = sysconf(_SC_PAGE_SIZE) ( = https://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf.html = ) with platforms that don=E2=80=99t have direct access to PAGE_SIZE? = It=E2=80=99s supported on Linux and MacOS at least. Cheers, -Enji= --Apple-Mail=_2177F822-964E-4C5D-AF25-53AE6A5914A7 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 <html><head><meta http-equiv=3D"content-type" content=3D"text/html; = charset=3Dutf-8"></head><body style=3D"overflow-wrap: break-word; = -webkit-nbsp-mode: space; line-break: = after-white-space;"><br><div><blockquote type=3D"cite"><div>On Jun 3, = 2024, at 11:28=E2=80=AFPM, Stefan E=C3=9Fer <se@freebsd.org> = wrote:</div><br class=3D"Apple-interchange-newline"><div><div>The branch = main has been updated by se:<br><br>URL: = https://cgit.FreeBSD.org/src/commit/?id=3D41ee91c64f47faaa8131df3cd8a63bdb= 60fa486a<br><br>commit = 41ee91c64f47faaa8131df3cd8a63bdb60fa486a<br>Author: = Stefan E=C3=9Fer = <se@FreeBSD.org><br>AuthorDate: 2024-06-04 06:26:09 = +0000<br>Commit: Stefan E=C3=9Fer = <se@FreeBSD.org><br>CommitDate: 2024-06-04 06:26:09 +0000<br><br> = newfs_msdos: fix build on non-FreeBSD systems<br><br> = Disable data area alignment if the build environment = does not define<br> PAGE_SIZE (e.g., when building on = Linux or macOS).<br><br> Reported by: = jrtc27<br> MFC after: = 1 week<br>---<br> = sbin/newfs_msdos/mkfs_msdos.c | 4 ++++<br> 1 file changed, 4 = insertions(+)<br><br>diff --git a/sbin/newfs_msdos/mkfs_msdos.c = b/sbin/newfs_msdos/mkfs_msdos.c<br>index 423fbbcadcc5..1bca560a59e1 = 100644<br>--- a/sbin/newfs_msdos/mkfs_msdos.c<br>+++ = b/sbin/newfs_msdos/mkfs_msdos.c<br>@@ -571,7 +571,11 @@ mkfs_msdos(const = char *fname, const char *dtype, const struct msdos_options *op)<br> = <span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span> = if (o.align)<br> <span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span><span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span>alignto =3D = bpb.bpbSecPerClust;<br> <span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span> = else<br>+#ifdef<span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span>PAGE_SIZE<br> <span = class=3D"Apple-tab-span" style=3D"white-space:pre"> </span><span = class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>alignto =3D= PAGE_SIZE / bpb.bpbBytesPerSec;<br>+#else<br>+<span = class=3D"Apple-tab-span" style=3D"white-space:pre"> </span> = alignto =3D 1;<br>+#endif<br> = <span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span> = if (alignto > 1) {<br> <span class=3D"Apple-tab-span"= style=3D"white-space:pre"> </span><span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span>/* align data clusters */<br> = <span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span><span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span>alignment =3D (bpb.bpbResSectors + bpb.bpbBigFATsecs * = bpb.bpbFATs + rds) %<br></div></div></blockquote></div><br><div><span = class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>I realize = this might seem silly, but what about sysconf(_SC_PAGE_SIZE) ( <a = href=3D"https://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf= .html">https://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf.= html</a> ) with platforms that don=E2=80=99t have direct access to = PAGE_SIZE? It=E2=80=99s supported on Linux and MacOS at = least.</div><div>Cheers,</div><div>-Enji</div></body></html>= --Apple-Mail=_2177F822-964E-4C5D-AF25-53AE6A5914A7-- --Apple-Mail=_DBDAF988-3B9B-4D64-AF2B-11B57B8F70DB Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEkHfexGRJ3gYRdA2gGpE5DjPsNJgFAmZg9+oACgkQGpE5DjPs NJgtuw/9HG0/1ATJAV4mWm6dO5t41uHH11gAj3ONXPEjG962AFQaYQf8C0p+o0sM KxsIuA325Uvh20cZTItSkHX5s580Kc+nVl3zt7lbqs8ye1uwbOyf7EaQ2p2tjYwK /SZrAZ1ac2MHrYjnz+tH1QemCKWzwhFFCRO4rClAh8mN/BoHkIG9gptDn8kMjVTv K91KpVi7p8R6yWq6GkFbvX18Dz56aJMfvs8wQey1ReHcCwkVaQSo4EZR9Rncj1pM ajm5m/hy6q5VAsQEWq26qH6ZP09ZjI24g9+PqggFRhCVImDxPKmJlN3UXuIbLMqg lZPgd/BxTEOw/8gR/Uk2O44IXVdiIZVQbTNZzKZII7bzHAR+s9SiwAupyLuUY/Lu RX5B1wa9UdoUCxw6HVf40UVy/Ycln763OBNBWjvdmIo3vvLPTzknafNvNlr3w0H9 aXHwKqjKPu6O3LH5uTm1udEGbeHP4pFwLTz0GZPI0fI2nQCTICLVDyXD4SnRR445 /gBNMeI9MIm3RCjTbaONqLjJmYoLCFE7W8NHCbDi1sCOGE+xThKfFL276t+gpPCa s1IIr6aXV9MiRQIWvDtKbgDQlAdks4qHbIUALAzyTjWUD75IoFcg5us1t3DhLohV qANBrDpxKgzfDbXBSmXz4L9Xqh58CSbAs1iMvQVnBGkfK4F/H1o= =ziqq -----END PGP SIGNATURE----- --Apple-Mail=_DBDAF988-3B9B-4D64-AF2B-11B57B8F70DB--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DDB66592-97E1-47FF-8613-831DB0823A7D>