From owner-svn-src-head@freebsd.org Thu Apr 5 15:46:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B0F7F8EC70; Thu, 5 Apr 2018 15:46:25 +0000 (UTC) (envelope-from royger@gmail.com) Received: from mail-wm0-x22b.google.com (mail-wm0-x22b.google.com [IPv6:2a00:1450:400c:c09::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 089B382BCC; Thu, 5 Apr 2018 15:46:25 +0000 (UTC) (envelope-from royger@gmail.com) Received: by mail-wm0-x22b.google.com with SMTP id b127so6980758wmf.5; Thu, 05 Apr 2018 08:46:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=+iQBHN6MuEXXuH5MHTqc3xzybLKCp18b5mC8LLkvkOc=; b=YBEzVE13rOrepXug3vKUDBUSvDeOPo9TAikGAQeuJIKGQRn4BA+Gn78C3Uh6gm0+tx Ptjqb7iySuwTPy2ur/1kyFCXEtXNTEIJf4rYtoPNhWUDPdrhk/SJTXYO9uH3GA1jmqKL H5SoB3eZtAHHNSM9K/I9Wg7EzSSog4hZHpWS3qH3QEdaL5crKkTTViMR7DKO3+4FHrVG TVI6ipTyTNZKLPf7XYIL0QB1UNODbTrr8XfVU/5olkhP+UIo0oGJMII4I7lz04t4S32q DygxX1hDQToJ2vGjZhGNxP7NeV8lpEahuYkH7DzMIIazW0slbs75a8BnAhv7vqAwW6nG h+4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=+iQBHN6MuEXXuH5MHTqc3xzybLKCp18b5mC8LLkvkOc=; b=JRMnZkIQmylmPrnVSkcELHnLch9GiPZbn9EY880Urhr2AYKQXW/58HAxRPleo0GYsO DhNsVuddkXuSH+JuAmhxmePpXuhMvwOMQqt1yZogy2/iSwnqZYc2FxLfeUe28+JBV8Zx FCnVEIVvCMnTPHVRyQqb9wfdV0cu0gD+bNNmJDEHWVZwVHuvZifC0qtDc5M+NFk5tEN5 D+wDuUX6ic2YE+vzWvbV5/sVHvSLLri1FbMm7iHnDHmWaIAjIsSFDWhdWKlf6d8zx7xV xwoF+cP6VG9xs+agNNTw5+3aml76HnNoSPk2P5OV58SKCZLen22TJe7NDPBGcd7adZIp gvew== X-Gm-Message-State: ALQs6tCljR6S/Hb8Gk31xjtbuM+zdxL1//1FvzFzcw0LDrkx8K2dNrdy lZRqM1p4H7RM9c1OWsgutoezzA== X-Google-Smtp-Source: AIpwx48tmlEY5nzJC+dvJ6p31wwfmTj2oriRf2gAHtys3K8tyj6lK28CL1Np05nU/a7b/vR26JNSbA== X-Received: by 10.80.243.4 with SMTP id p4mr3411790edm.131.1522943183714; Thu, 05 Apr 2018 08:46:23 -0700 (PDT) Received: from localhost (default-46-102-197-194.interdsl.co.uk. [46.102.197.194]) by smtp.gmail.com with ESMTPSA id y6sm4719240edh.3.2018.04.05.08.46.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Apr 2018 08:46:22 -0700 (PDT) Sender: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= Date: Thu, 5 Apr 2018 16:46:19 +0100 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: Ian Lepore Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r332072 - head/sys/sys Message-ID: <20180405154619.q3blip266qa3z5ut@MacBook-Pro-de-Roger.local> References: <201804051431.w35EVtg4047897@repo.freebsd.org> <1522942377.49673.245.camel@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1522942377.49673.245.camel@freebsd.org> User-Agent: NeoMutt/20180323 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Apr 2018 15:46:26 -0000 On Thu, Apr 05, 2018 at 09:32:57AM -0600, Ian Lepore wrote: > On Thu, 2018-04-05 at 14:31 +0000, Roger Pau Monné wrote: > > Author: royger > > Date: Thu Apr  5 14:31:54 2018 > > New Revision: 332072 > > URL: https://svnweb.freebsd.org/changeset/base/332072 > > > > Log: > >   introduce GiB and MiB macros > >    > >   This macros convert from GiB or MiB into bytes. > >    > >   Sponsored by: Citrix Systems R&D > > > > Modified: > >   head/sys/sys/param.h > > > > Modified: head/sys/sys/param.h > > ============================================================================== > > --- head/sys/sys/param.h Thu Apr  5 14:25:39 2018 (r332071) > > +++ head/sys/sys/param.h Thu Apr  5 14:31:54 2018 (r332072) > > @@ -362,4 +362,8 @@ __END_DECLS > >   */ > >  #define __PAST_END(array, offset) (((__typeof__(*(array)) *)(array))[offset]) > >   > > +/* Unit conversion macros. */ > > +#define GiB(v) (v ## ULL << 30) > > +#define MiB(v) (v ## ULL << 20) > > + > >  #endif /* _SYS_PARAM_H_ */ > > > > These names don't make it clear whether the conversion is bytes->GiB or > GiB->bytes.  The names seem way too generic for a public namespace in a > file as heavily included behind your back as param.h is. > > Also, this completely reasonable usage won't work, likely with > confusing compile error messages: > >   int bytes, gibytes; >   ... >   bytes = GiB(gibytes); I find those helpful for their specific usage. I could introduce static inline functions like: size_t gb_to_bytes(size_t)... But I assume this is also going to cause further discussion. Roger.