Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Aug 2017 13:55:45 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Hans Petter Selasky <hps@selasky.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r321920 - head/sys/sys
Message-ID:  <20170802105545.GB1700@kib.kiev.ua>
In-Reply-To: <50d380b1-806a-6114-7324-e4cd3d6a2b2f@selasky.org>
References:  <201708021014.v72AEHEk061037@repo.freebsd.org> <50d380b1-806a-6114-7324-e4cd3d6a2b2f@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Aug 02, 2017 at 12:23:22PM +0200, Hans Petter Selasky wrote:
> On 08/02/17 12:14, Konstantin Belousov wrote:
> > Author: kib
> > Date: Wed Aug  2 10:14:17 2017
> > New Revision: 321920
> > URL: https://svnweb.freebsd.org/changeset/base/321920
> > 
> > Log:
> >    Change major()/minor() to work with 64bit dev_t.
> >    
> >    Since traditional types for the macros values are int, remove the
> >    cookie trick and just split the dev_t at the word boundary.
> >    
> >    Reported by:	Victor Stinner <victor.stinner@gmail.com>
> >    PR:	221048
> >    Sponsored by:	The FreeBSD Foundation
> > 
> > Modified:
> >    head/sys/sys/types.h
> > 
> > Modified: head/sys/sys/types.h
> > ==============================================================================
> > --- head/sys/sys/types.h	Wed Aug  2 10:12:10 2017	(r321919)
> > +++ head/sys/sys/types.h	Wed Aug  2 10:14:17 2017	(r321920)
> > @@ -364,14 +364,9 @@ __bitcount64(__uint64_t _x)
> >   
> >   #include <sys/select.h>
> >   
> > -/*
> > - * minor() gives a cookie instead of an index since we don't want to
> > - * change the meanings of bits 0-15 or waste time and space shifting
> > - * bits 16-31 for devices that don't use them.
> > - */
> > -#define	major(x)	((int)(((u_int)(x) >> 8)&0xff))	/* major number */
> > -#define	minor(x)	((int)((x)&0xffff00ff))		/* minor number */
> > -#define	makedev(x,y)	((dev_t)(((x) << 8) | (y)))	/* create dev_t */
> > +#define	major(x)	((int)((dev_t)(x) >> 32))	/* major number */
> > +#define	minor(x)	((int)((x) & 0xffffffff))	/* minor number */
> > +#define	makedev(x, y)	(((dev_t)(x) << 32) | (y))	/* create dev_t */
> >   
> >   /*
> >    * These declarations belong elsewhere, but are repeated here and in
> 
> Hi,
> 
> This change looks like it affects user-space applications? Why is not 
> the FreeBSD version number bumped?

This change is the trailing fix for the ino64 commit.

More details are following: main feature of major/minor is the
deconstruction of the dev_t into components which can be used to
reconstruct original dev_t with makedev().  In other words, if
	makedev(major(x), minor(x)) != x
then the major/minor API is useless.

And it was useless right after ino64 commit r318736 and up to the
commit you replied to.  The fact that nobody complained until the
referenced PR, indicates that the API is not actively used (finally).

I do not see a need to bump the __FreeBSD_version for this, we do not
support older HEADs in any way.  This means that we assume that HEAD
users always use the latest HEAD.  So no bump for such minor fix.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170802105545.GB1700>