Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jun 2024 16:47:06 -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:  <917A072B-D970-428A-B4B2-EA93ADFE67C7@gmail.com>
In-Reply-To: <DDB66592-97E1-47FF-8613-831DB0823A7D@gmail.com>
References:  <202406040628.4546SJ98088668@gitrepo.freebsd.org> <DDB66592-97E1-47FF-8613-831DB0823A7D@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_ED887DA8-1BF9-458D-91AD-D884882DE5A8
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_32A48224-E49F-4478-907D-645B6A321128"


--Apple-Mail=_32A48224-E49F-4478-907D-645B6A321128
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8


> On Jun 5, 2024, at 4:42=E2=80=AFPM, Enji Cooper =
<yaneurabeya@gmail.com> wrote:
>=20
>> 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) %
>=20
> 	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.

Also, POSIX says it could be defined by limits.h: =
https://pubs.opengroup.org/onlinepubs/7908799/xsh/limits.h.html . It =
might just be that an extra header is required to make the tool compile =
with the proper PAGE_SIZE prior to this change.
-Enji


--Apple-Mail=_32A48224-E49F-4478-907D-645B6A321128
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 5, =
2024, at 4:42=E2=80=AFPM, Enji Cooper &lt;yaneurabeya@gmail.com&gt; =
wrote:</div><div><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dutf-8"><div 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 &lt;se@freebsd.org&gt; =
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: =
&nbsp;&nbsp;&nbsp;&nbsp;Stefan E=C3=9Fer =
&lt;se@FreeBSD.org&gt;<br>AuthorDate: 2024-06-04 06:26:09 =
+0000<br>Commit: &nbsp;&nbsp;&nbsp;&nbsp;Stefan E=C3=9Fer =
&lt;se@FreeBSD.org&gt;<br>CommitDate: 2024-06-04 06:26:09 +0000<br><br> =
&nbsp;&nbsp;&nbsp;newfs_msdos: fix build on non-FreeBSD systems<br><br> =
&nbsp;&nbsp;&nbsp;Disable data area alignment if the build environment =
does not define<br> &nbsp;&nbsp;&nbsp;PAGE_SIZE (e.g., when building on =
Linux or macOS).<br><br> &nbsp;&nbsp;&nbsp;Reported by: =
&nbsp;&nbsp;&nbsp;jrtc27<br> &nbsp;&nbsp;&nbsp;MFC after: =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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> =
&nbsp;&nbsp;&nbsp;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> =
&nbsp;&nbsp;&nbsp;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> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alignto =3D 1;<br>+#endif<br> =
<span class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;if (alignto &gt; 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) (&nbsp;<a =
href=3D"https://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf=
.html">https://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf.=
html</a>&nbsp;) 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></div></blockquote><br></div><div>Also, POSIX says it =
could be defined by limits.h:&nbsp;<a =
href=3D"https://pubs.opengroup.org/onlinepubs/7908799/xsh/limits.h.html">h=
ttps://pubs.opengroup.org/onlinepubs/7908799/xsh/limits.h.html</a>&nbsp;. =
It might just be that an extra header is required to make the tool =
compile with the proper PAGE_SIZE prior to this =
change.</div><div>-Enji</div><br></body></html>=

--Apple-Mail=_32A48224-E49F-4478-907D-645B6A321128--

--Apple-Mail=_ED887DA8-1BF9-458D-91AD-D884882DE5A8
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-----

iQIzBAEBCAAdFiEEkHfexGRJ3gYRdA2gGpE5DjPsNJgFAmZg+PsACgkQGpE5DjPs
NJg1og//fDTssIts3YrVsadzmffYVmuEVW8gZo2bs2176RE2XkFSlasSgecyIv/2
/QQP09IuV21ZpIzd7vnJh0LSRd+6EgUf0AigQxK+x9VVQY6iev+kiEcKk4T/GI1c
sclSoOjxiOfmZXQhTaA8GOnElZkG218ToXgYrrH2ZR+gfJsRYiMgbstdD939rEBY
9N42igKuAfW4e91TnSug3bKUYHyu/6Ai9dG6U9W7nHMhc9V4sRA9jpDhR4ViuJPz
Jaz2jpfVXDVuC0woSYbVOIUkg01RE/f9ZcXWqHsJoQkomjRLw9wQKqv8KXqoCv5T
maY0UxstXlp2bJ3fO2N3tfnO88lTIZSDQK2dDao8i6sFJw2fQqoZRIaSiNq+N4Qr
JY3ffnPWhpC4CoJWbOfvPs8iCEwHgTw95NN0zbgc9Q+CvVLG3eHKhX0ju/AmzFya
npz0FoRBhBRwF+YUOfKnr+hZ6J908Fo0DKcCryn2Py7vFVEPX0bJQu2uurtf/GIT
9TSh6EKZGzwngnkWrI2YMTX/lCxuni2PGPJudIC8I3Mxlyhc06lTw8I5ZAh4qak5
BsNGd7K7sshW0lxSj7ymbRGG+Jku5+/VDzzSguPcAXfM+OXtAdv8D2Vr9aBazndo
6x9aYk8Pbot+TpPlI8KSsxSYUGPahkyXyZfqGTvJ8U6qW4dmR9Y=
=N3S5
-----END PGP SIGNATURE-----

--Apple-Mail=_ED887DA8-1BF9-458D-91AD-D884882DE5A8--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?917A072B-D970-428A-B4B2-EA93ADFE67C7>