Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Mar 2023 09:36:31 +0000
From:      Nuno Teixeira <eduardo@freebsd.org>
To:        Juraj Lutter <otis@freebsd.org>
Cc:        Warner Losh <imp@bsdimp.com>, Yuri <yuri@aetern.org>,  FreeBSD CURRENT <freebsd-current@freebsd.org>,  FreeBSD Mailing List <freebsd-ports@freebsd.org>
Subject:   Re: byteswap.h not found on 12 and 13
Message-ID:  <CAFDf7ULi96TAb49OW8jBO6vVOzc%2BCkNgQiDQcd-ivxKCsXsAHw@mail.gmail.com>
In-Reply-To: <13BBF767-6CBB-41D5-AD93-6ADD9C417811@FreeBSD.org>
References:  <CAFDf7UKq3bMgd3XA0=U10%2BLhOCY7fZCHds9DdBcrSuNidOityw@mail.gmail.com> <CANCZdfpT3nbZ%2BzHHtdsMDa88JsWr7Frw%2BRPGcy6B=P60DZL2_g@mail.gmail.com> <CAFDf7UL=av0KDAw2O3Fmf=x5wThezBokCQ2KHtW6wOZnn43bxQ@mail.gmail.com> <ef18fee5-358b-3c19-467b-2fd980dff797@aetern.org> <CANCZdfrvHQTZqgGdZjm5Z_fa53g92c_6EHtKZpyRAsKwRsDcLw@mail.gmail.com> <CANCZdfp=zTD5ctpjcQhDBexWP40d=z0GAd09Qa9eFM4yxXq9RQ@mail.gmail.com> <CANCZdfq2nLt1Bq2Jzn=ivvqaOvF9=y8j=ChZzy6TrE5zAzeFiw@mail.gmail.com> <13BBF767-6CBB-41D5-AD93-6ADD9C417811@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--00000000000085a8cf05f7a22185
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hello Juraj,

---
--- src/sflowtool.c.orig        2023-03-24 09:29:58 UTC
+++ src/sflowtool.c
@@ -29,13 +29,18 @@ extern "C" {
 #include <inttypes.h>
 #include <arpa/inet.h>
 #include <netdb.h>
-#include <byteswap.h>
+#include <sys/endian.h>
 #include <getopt.h>

 #include "sflow.h" /* sFlow v5 */
 #include "sflow_v2v4.h" /* sFlow v2/4 */
 #include "assert.h"
 #include "sflow_xdr.h" /* sFlow encode */
+
+#define bswap_16 bswap16
+#define bswap_32 bswap32
+#define bswap_64 bswap64

 #define SPOOFSOURCE 1
 #define YES 1
---

Compiles fine!

Juraj Lutter <otis@freebsd.org> escreveu no dia sexta, 24/03/2023 =C3=A0(s)
09:13:

>
>
> > On 24 Mar 2023, at 10:09, Warner Losh <imp@bsdimp.com> wrote:
> >
> > one last reply, if this is for a port, then byteswap.h can usually be
> implemented as
> >
> > #include <sys/endian.h>
> > #define __bswap_16(x) __bswap16(x)
> > #define __bswap_32(x) __bswap32(x)
> > #define __bswap_64(x) __bswap64(x)
> >
> > #define bswap_16(x) __bswap16(x)
> > #define bswap_32(x) __bswap32(x)
> > #define bswap_64(x) __bswap64(x)
> >
> > in older versions of FreeBSD, but some tricky software will hate the
> bswap16 (no underscore) etc defines. You could likely put that into the
> port.
>
> In releng/13 there is also infiniband/byteswap.h that does:
>
> #include <sys/types.h>
> #include <sys/endian.h>
>
> #define bswap_16        bswap16
> #define bswap_32        bswap32
> #define bswap_64        bswap64
>
> otis
>
> =E2=80=94
> Juraj Lutter
> otis@FreeBSD.org
>
>

--=20
Nuno Teixeira
FreeBSD Committer (ports)

--00000000000085a8cf05f7a22185
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hello Juraj,</div><div><br></div><div>---<br></div><d=
iv>--- src/sflowtool.c.orig =C2=A0 =C2=A0 =C2=A0 =C2=A02023-03-24 09:29:58 =
UTC<br>+++ src/sflowtool.c<br>@@ -29,13 +29,18 @@ extern &quot;C&quot; {<br=
>=C2=A0#include &lt;inttypes.h&gt;<br>=C2=A0#include &lt;arpa/inet.h&gt;<br=
>=C2=A0#include &lt;netdb.h&gt;<br>-#include &lt;byteswap.h&gt;<br>+#includ=
e &lt;sys/endian.h&gt;<br>=C2=A0#include &lt;getopt.h&gt;<br><br>=C2=A0#inc=
lude &quot;sflow.h&quot; /* sFlow v5 */<br>=C2=A0#include &quot;sflow_v2v4.=
h&quot; /* sFlow v2/4 */<br>=C2=A0#include &quot;assert.h&quot;<br>=C2=A0#i=
nclude &quot;sflow_xdr.h&quot; /* sFlow encode */<br>+<br>+#define bswap_16=
 bswap16<br>+#define bswap_32 bswap32<br>+#define bswap_64 bswap64<br><br>=
=C2=A0#define SPOOFSOURCE 1<br>=C2=A0#define YES 1</div><div>---</div><div>=
<br></div><div>Compiles fine!<br></div></div><br><div class=3D"gmail_quote"=
><div dir=3D"ltr" class=3D"gmail_attr">Juraj Lutter &lt;<a href=3D"mailto:o=
tis@freebsd.org">otis@freebsd.org</a>&gt; escreveu no dia sexta, 24/03/2023=
 =C3=A0(s) 09:13:<br></div><blockquote class=3D"gmail_quote" style=3D"margi=
n:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex=
"><br>
<br>
&gt; On 24 Mar 2023, at 10:09, Warner Losh &lt;<a href=3D"mailto:imp@bsdimp=
.com" target=3D"_blank">imp@bsdimp.com</a>&gt; wrote:<br>
&gt; <br>
&gt; one last reply, if this is for a port, then byteswap.h can usually be =
implemented as<br>
&gt; <br>
&gt; #include &lt;sys/endian.h&gt;<br>
&gt; #define __bswap_16(x) __bswap16(x)<br>
&gt; #define __bswap_32(x) __bswap32(x)<br>
&gt; #define __bswap_64(x) __bswap64(x)<br>
&gt; <br>
&gt; #define bswap_16(x) __bswap16(x)<br>
&gt; #define bswap_32(x) __bswap32(x)<br>
&gt; #define bswap_64(x) __bswap64(x)<br>
&gt; <br>
&gt; in older versions of FreeBSD, but some tricky software will hate the b=
swap16 (no underscore) etc defines. You could likely put that into the port=
.<br>
<br>
In releng/13 there is also infiniband/byteswap.h that does:<br>
<br>
#include &lt;sys/types.h&gt;<br>
#include &lt;sys/endian.h&gt;<br>
<br>
#define bswap_16=C2=A0 =C2=A0 =C2=A0 =C2=A0 bswap16<br>
#define bswap_32=C2=A0 =C2=A0 =C2=A0 =C2=A0 bswap32<br>
#define bswap_64=C2=A0 =C2=A0 =C2=A0 =C2=A0 bswap64<br>
<br>
otis<br>
<br>
=E2=80=94<br>
Juraj Lutter<br>
otis@FreeBSD.org<br>
<br>
</blockquote></div><br clear=3D"all"><br><span class=3D"gmail_signature_pre=
fix">-- </span><br><div dir=3D"ltr" class=3D"gmail_signature"><div dir=3D"l=
tr"><span style=3D"color:rgb(102,102,102)">Nuno Teixeira<br>FreeBSD Committ=
er (ports)</span></div></div>

--00000000000085a8cf05f7a22185--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFDf7ULi96TAb49OW8jBO6vVOzc%2BCkNgQiDQcd-ivxKCsXsAHw>