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>

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

[-- Attachment #1 --]
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 à(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
>
> —
> Juraj Lutter
> otis@FreeBSD.org
>
>

-- 
Nuno Teixeira
FreeBSD Committer (ports)

[-- Attachment #2 --]
<div dir="ltr"><div>Hello Juraj,</div><div><br></div><div>---<br></div><div>--- src/sflowtool.c.orig        2023-03-24 09:29:58 UTC<br>+++ src/sflowtool.c<br>@@ -29,13 +29,18 @@ extern &quot;C&quot; {<br> #include &lt;inttypes.h&gt;<br> #include &lt;arpa/inet.h&gt;<br> #include &lt;netdb.h&gt;<br>-#include &lt;byteswap.h&gt;<br>+#include &lt;sys/endian.h&gt;<br> #include &lt;getopt.h&gt;<br><br> #include &quot;sflow.h&quot; /* sFlow v5 */<br> #include &quot;sflow_v2v4.h&quot; /* sFlow v2/4 */<br> #include &quot;assert.h&quot;<br> #include &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> #define SPOOFSOURCE 1<br> #define YES 1</div><div>---</div><div><br></div><div>Compiles fine!<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Juraj Lutter &lt;<a href="mailto:otis@freebsd.org">otis@freebsd.org</a>&gt; escreveu no dia sexta, 24/03/2023 à(s) 09:13:<br></div><blockquote class="gmail_quote" style="margin: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="mailto:imp@bsdimp.com" target="_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 bswap16 (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        bswap16<br>
#define bswap_32        bswap32<br>
#define bswap_64        bswap64<br>
<br>
otis<br>
<br>
—<br>
Juraj Lutter<br>
otis@FreeBSD.org<br>
<br>
</blockquote></div><br clear="all"><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><span style="color:rgb(102,102,102)">Nuno Teixeira<br>FreeBSD Committer (ports)</span></div></div>
help

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