From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTP id 8A6585A0262 for ; Sat, 4 Mar 2023 10:55:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677923756; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jcqzHDaBiDxiFBLhlhJ09ZA3nqy8T3dWhnsb+knLqEM=; b=RKD0TQI0o/c5ErtaVSJKRbpi3oaYjdY/4yrIXeAd9ZpJfpGbps9mOeIWRqSjzRPDHI12X/ 0ijePH9jzwfGwb1sF/zDX3MsiPqSSxQKCX50x2vNaDSFdre+WxuT+U1ZRx9aRn3/Ez++Is 7QAj6sTBebM6A992sx0Fw5JmE31rjAU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-332-P7hiX8tFOKqouWLrJ-e-_A-1; Sat, 04 Mar 2023 04:55:53 -0500 X-MC-Unique: P7hiX8tFOKqouWLrJ-e-_A-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B0B4B101A521; Sat, 4 Mar 2023 09:55:52 +0000 (UTC) Received: from maya.cloud.tilaa.com (unknown [10.33.32.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 86ECC140EBF6; Sat, 4 Mar 2023 09:55:52 +0000 (UTC) Date: Sat, 4 Mar 2023 10:55:50 +0100 From: Stefano Brivio To: KuhnChris Subject: Re: [PATCH 3/3] define _bswap_constant_16/32 for musl This uses the implementation from libiio (https://github.com/analogdevicesinc/libiio/commit/9c6c6a432a0cbe2832bc97a7eeddfb61f6b8b856) Also restored the old behavior from the old util.h. Message-ID: <20230304105550.0eb99f2d@elisabeth> In-Reply-To: <20230303224931.11791-3-kuhnchris+github@kuhnchris.eu> References: <20230303224931.11791-1-kuhnchris+github@kuhnchris.eu> <20230303224931.11791-3-kuhnchris+github@kuhnchris.eu> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: JSSOOHOKSXFAV6CTB6GITQOC6VWQKK25 X-Message-ID-Hash: JSSOOHOKSXFAV6CTB6GITQOC6VWQKK25 X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Fri, 3 Mar 2023 22:49:31 +0000 KuhnChris wrote: > --- > util.h | 19 ++++++++++--------- > 1 file changed, 10 insertions(+), 9 deletions(-) Here, what you wrote in the subject (first line of commit message) should be in the commit message itself. Example of commit message for this: -- util: Provide own __bswap_constant_{16,32} if not defined by C library musl, and possibly other C libraries, don't define __bswap_constant_16 and __bswap_constant_32. Define them if they aren't. Signed-off-by: Name Surname -- The first line becomes the patch subject. Here, there would be no strict need to mention libiio because that's just one example of the same trivial implementation copied over and over again in many projects, which might come from pretty much anywhere. Wwas it copied from glibc? Was it written by the author of that commit? I don't think it qualifies as copyrightable work: https://en.wikipedia.org/wiki/Threshold_of_originality ...but you can also do that, as you have the link at hand, if you actually took it from there. > diff --git a/util.h b/util.h > index 7315ce2..a6ad4ad 100644 > --- a/util.h > +++ b/util.h > @@ -91,7 +91,16 @@ > #define MAC_ZERO ((uint8_t [ETH_ALEN]){ 0 }) > #define MAC_IS_ZERO(addr) (!memcmp((addr), MAC_ZERO, ETH_ALEN)) > > -#if defined(__GLIBC__) || defined(__UCLIBC__) > +#ifndef __bswap_constant_16 > +#define __bswap_constant_16(x) \ > + ((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))) > +#endif > + > +#ifndef __bswap_constant_32 > +#define __bswap_constant_32(x) \ > + ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ > + (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) > +#endif > > #if __BYTE_ORDER == __BIG_ENDIAN > #define htons_constant(x) (x) > @@ -101,14 +110,6 @@ > #define htonl_constant(x) (__bswap_constant_32(x)) > #endif > > -#else > - > -/* mainly musl fallback */ > - > -#define htons_constant(x) (x) > -#define htonl_constant(x) (x) > - > -#endif And this, again, shouldn't be in the first patch. > > #define IN4_IS_ADDR_UNSPECIFIED(a) \ > ((a)->s_addr == htonl(INADDR_ANY)) I understand this might be a lot to digest and a bit of effort, so let me know -- you figured out most of the issues and did all the tests, I can also fix up the patches for you. -- Stefano