From nobody Fri Mar 24 09:34:57 2023 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjcWK6gmQz41L2y for ; Fri, 24 Mar 2023 09:35:09 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PjcWK3qgMz3QQL for ; Fri, 24 Mar 2023 09:35:09 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ed1-x532.google.com with SMTP id eh3so5254095edb.11 for ; Fri, 24 Mar 2023 02:35:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; t=1679650508; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=tkhucASE4pV5x/ixbG9QTIBVjRLkfuBNsbmNXlMoM+4=; b=G5S4YSqQ5gYhwVziMp/Tbnf09nlsDVoP7lT+csdLGewHlkTDEOmtrB3BvxOq5328hg JjnvxGjMjMjagqhCRtPcXJdM+dkIQU9/zGoVgiiohvDHCITl62uWcIAyGikTYw5JBC9Q jA2CQDkQXZdFegmAMiCbUEh2SttOJ+Yw+CB+4GacoRyxtihsb56lcntschKWp8yoOJFJ KgEz+tk/xc2T8Vv+5aHFC0UPnB6T8TG8umPN7xIALH/F9hJpWif0pMXpLIj0lg2To2jN iYNtXIar+Vtay7XsL5SvkvknVoppsrZ0hfx6rWFlv2WyAq5iibh8OFoZHnB0IAc3sN0o YXPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679650508; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tkhucASE4pV5x/ixbG9QTIBVjRLkfuBNsbmNXlMoM+4=; b=1Q2fqrDm3Er/8Kjki4Sr5I525WgNF68doGhQQSBAKKFyg9nLLKg/ROuHZmRyNBlFwN ch/cohvwgRqERzmHllKFlh2tkS6TUWmu/bvEb4XjwQhg0+LhLQzUZ3J+huw6dlQGCfU8 8ApaYQekRqLAO3c5+e34KG/GvGPfGRURqTRdhssLlhpEPO6976SqB/WNEnE1+UQg1fw0 kwbriTfezdG7hRN6HJEnsV2BijdJ/fjoE0fbZDhLxZNB8AF6INts73Kuea5mZ7jAW99B s12Jp294jeu0bWDEEkjgPUaGOc0UPTGyEgZU1pva8JBxEg/hgF6G9bmSMJ3EdLddiPvS H9mw== X-Gm-Message-State: AAQBX9cndYOfAPiYY8Eda2aFZTpGOue79qlvAlfsQjGS2vVgOe22U+T2 1d07pG1/AZmK20SEYWloJ3cuqSheffzYGX2WxJOjFA== X-Google-Smtp-Source: AKy350akp5a2atJXSTeZ+N2ElM4JUhrx8G6bOTEoHNZWI2l39BAO29aGdxtMiwETAnOHGrEq8VW0ViklsRF56dnAQXg= X-Received: by 2002:a17:906:9f0b:b0:8b1:38d6:9853 with SMTP id fy11-20020a1709069f0b00b008b138d69853mr990138ejc.2.1679650508106; Fri, 24 Mar 2023 02:35:08 -0700 (PDT) List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 References: <13BBF767-6CBB-41D5-AD93-6ADD9C417811@FreeBSD.org> In-Reply-To: <13BBF767-6CBB-41D5-AD93-6ADD9C417811@FreeBSD.org> From: Warner Losh Date: Fri, 24 Mar 2023 03:34:57 -0600 Message-ID: Subject: Re: byteswap.h not found on 12 and 13 To: Juraj Lutter Cc: Yuri , Nuno Teixeira , FreeBSD CURRENT , FreeBSD Mailing List Content-Type: multipart/alternative; boundary="000000000000e1ffa305f7a21b2c" X-Rspamd-Queue-Id: 4PjcWK3qgMz3QQL X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N --000000000000e1ffa305f7a21b2c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Mar 24, 2023 at 3:13=E2=80=AFAM Juraj Lutter wro= te: > > > > On 24 Mar 2023, at 10:09, Warner Losh wrote: > > > > one last reply, if this is for a port, then byteswap.h can usually be > implemented as > #include #if __FreeBSD_version < 1301500 > > #include > > #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) #else #include_next #endif might make it a complete file. > > > > 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 > #include > > #define bswap_16 bswap16 > #define bswap_32 bswap32 > #define bswap_64 bswap64 > That works too. The reason I suggested what I did is that it also lets you do #undef bswap16, etc if your software needs it. Warner --000000000000e1ffa305f7a21b2c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Fri, Mar 24, 2023 at 3:13=E2=80=AF= AM Juraj Lutter <otis@freebsd.org> wrote:

> 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/param.h= >
#if __FreeBSD_version < 1301500
=C2=A0
> #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)
#else
#inc= lude_next <byteswap.h>
#endif

migh= t make it a complete file.
=C2=A0
>
> 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= .

In releng/13 there is also infiniband/byteswap.h that does:

#include <sys/types.h>
#include <sys/endian.h>

#define bswap_16=C2=A0 =C2=A0 =C2=A0 =C2=A0 bswap16
#define bswap_32=C2=A0 =C2=A0 =C2=A0 =C2=A0 bswap32
#define bswap_64=C2=A0 =C2=A0 =C2=A0 =C2=A0 bswap64
That works too. The reason I suggested what I did is that it a= lso lets you do #undef bswap16, etc if your software needs it.
Warner
--000000000000e1ffa305f7a21b2c--