From owner-svn-src-head@freebsd.org Thu Jun 14 07:29:17 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 2E64A100AC17; Thu, 14 Jun 2018 07:29:17 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C48187A1FF; Thu, 14 Jun 2018 07:29:16 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id ABA28260199; Thu, 14 Jun 2018 09:29:15 +0200 (CEST) Subject: Re: svn commit: r335053 - in head/sys: compat/freebsd32 compat/linux fs/nfsclient kern sys To: Bruce Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201806131222.w5DCM00c001080@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <90566a73-c793-2cc4-27ac-039bf83fd2d0@selasky.org> Date: Thu, 14 Jun 2018 09:29:00 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <201806131222.w5DCM00c001080@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 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, 14 Jun 2018 07:29:17 -0000 On 06/13/18 14:22, Bruce Evans wrote: > +/* > + * The major and minor numbers are encoded in dev_t as MMMmmmMm (where > + * letters correspond to bytes). The encoding of the lower 4 bytes is > + * constrained by compatibility with 16-bit and 32-bit dev_t's. The > + * encoding of of the upper 4 bytes is the least unnatural one consistent > + * with this and other constraints. Also, the decoding of the m bytes by > + * minor() is unnatural to maximize compatibility subject to not discarding > + * bits. The upper m byte is shifted into the position of the lower M byte > + * instead of shifting 3 upper m bytes to close the gap. Compatibility for > + * minor() is achieved iff the upper m byte is 0. > + */ > +#define major(d) __major(d) > +static __inline int > +__major(dev_t _d) > +{ > + return (((_d >> 32) & 0xffffff00) | ((_d >> 8) & 0xff)); > +} > +#define minor(d) __minor(d) > +static __inline int > +__minor(dev_t _d) > +{ > + return (((_d >> 24) & 0xff00) | (_d & 0xffff00ff)); > +} > +#define makedev(M, m) __makedev((M), (m)) > +static __inline dev_t > +__makedev(int _M, int _m) > +{ > + return (((dev_t)(_M & 0xffffff00) << 32) | ((_M & 0xff) << 8) | > + ((dev_t)(_m & 0xff00) << 24) | (_m & 0xffff00ff)); > +} Can you use all macros here? This breaks OFED, because __makedev() is used to initialize variables. --HPS