Re: svn commit: r321920 - head/sys/sys

2017-08-06 Thread Bruce Evans
On Sat, 5 Aug 2017, Konstantin Belousov wrote: On Sat, Aug 05, 2017 at 12:26:03PM +1000, Bruce Evans wrote: +#defineminor(x)((int)(x)) Another nice simplification. Strictly, it should be (int)(dev_t)(x) since the pseudo-prototype says that the arg is converted to dev_t, but

Re: svn commit: r321920 - head/sys/sys

2017-08-05 Thread Konstantin Belousov
On Sat, Aug 05, 2017 at 12:26:03PM +1000, Bruce Evans wrote: > > +#defineminor(x)((int)(x)) > > Another nice simplification. Strictly, it should be (int)(dev_t)(x) since > the pseudo-prototype says that the arg is converted to dev_t, but yesterday > I couldn't see any differences

Re: svn commit: r321920 - head/sys/sys

2017-08-04 Thread Bruce Evans
On Thu, 3 Aug 2017, Konstantin Belousov wrote: On Thu, Aug 03, 2017 at 07:34:56PM +1000, Bruce Evans wrote: I see another problem. Masking with 0xf and casting to unsigned are gratuitously different spellings for extracting the low 32 bits. I prefer the cast. Below is one more

Re: svn commit: r321920 - head/sys/sys

2017-08-03 Thread Konstantin Belousov
On Thu, Aug 03, 2017 at 07:34:56PM +1000, Bruce Evans wrote: > I see another problem. Masking with 0xf and casting to unsigned > are gratuitously different spellings for extracting the low 32 bits. > I prefer the cast. Below is one more update. I reformulated the man page text, but not

Re: svn commit: r321920 - head/sys/sys

2017-08-03 Thread Bruce Evans
On Thu, 3 Aug 2017, Konstantin Belousov wrote: On Thu, Aug 03, 2017 at 01:21:56PM +1000, Bruce Evans wrote: It would be better to remove the comments. makedev() actually has a man page (a FreeBSD addition makedev(3)). This could have been better, and is now out of date. The largest error is

Re: svn commit: r321920 - head/sys/sys

2017-08-03 Thread Konstantin Belousov
On Thu, Aug 03, 2017 at 10:02:48AM +0200, Hans Petter Selasky wrote: > On 08/03/17 09:57, Konstantin Belousov wrote: > > .Xr mknod 2 , > > Should mknod be removed from base or stubbed in light of the more recent > devfs ? mknod is used on devfs as a way to 'undelete' devfs node. You may do

Re: svn commit: r321920 - head/sys/sys

2017-08-03 Thread Hans Petter Selasky
On 08/03/17 09:57, Konstantin Belousov wrote: .Xr mknod 2 , Should mknod be removed from base or stubbed in light of the more recent devfs ? --HPS ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To

Re: svn commit: r321920 - head/sys/sys

2017-08-03 Thread Konstantin Belousov
On Thu, Aug 03, 2017 at 01:21:56PM +1000, Bruce Evans wrote: > It would be better to remove the comments. > > makedev() actually has a man page (a FreeBSD addition makedev(3)). > This could have been better, and is now out of date. The largest error > is that major() is still documented to

Re: svn commit: r321920 - head/sys/sys

2017-08-02 Thread Bruce Evans
On Wed, 2 Aug 2017, Konstantin Belousov wrote: On Wed, Aug 02, 2017 at 02:38:50PM +0200, Hans Petter Selasky wrote: On 08/02/17 14:36, Hans Petter Selasky wrote: On 08/02/17 12:14, Konstantin Belousov wrote: +#definemajor(x)((int)((dev_t)(x) >> 32))/* major number */ +#define

Re: svn commit: r321920 - head/sys/sys

2017-08-02 Thread Hans Petter Selasky
On 08/02/17 15:54, Konstantin Belousov wrote: I agree with the usefulness of the y cast to unsigned type, but I am not sure what is the use of final dev_t cast. By the usual arithmetic conversion rules, the final type of the '|' is the highest rank type of the operands. Something unusual can

Re: svn commit: r321920 - head/sys/sys

2017-08-02 Thread Konstantin Belousov
On Wed, Aug 02, 2017 at 02:38:50PM +0200, Hans Petter Selasky wrote: > On 08/02/17 14:36, Hans Petter Selasky wrote: > > On 08/02/17 12:14, Konstantin Belousov wrote: > >> +#definemajor(x)((int)((dev_t)(x) >> 32))/* major number */ > >> +#defineminor(x)((int)((x) & 0x))

Re: svn commit: r321920 - head/sys/sys

2017-08-02 Thread Hans Petter Selasky
On 08/02/17 14:36, Hans Petter Selasky wrote: On 08/02/17 12:14, Konstantin Belousov wrote: +#definemajor(x)((int)((dev_t)(x) >> 32))/* major number */ +#defineminor(x)((int)((x) & 0x))/* minor number */ +#definemakedev(x, y)(((dev_t)(x) << 32) | (y))

Re: svn commit: r321920 - head/sys/sys

2017-08-02 Thread Hans Petter Selasky
On 08/02/17 14:37, Konstantin Belousov wrote: si_drv1->xxx instead of using si_drv0 and dev2unit(). si_drv1 is 32bit on 32bit platforms. I mean the LinuxKPI structure pointed to by si_drv1, not si_drv1 itself. --HPS ___ svn-src-all@freebsd.org

Re: svn commit: r321920 - head/sys/sys

2017-08-02 Thread Konstantin Belousov
On Wed, Aug 02, 2017 at 02:26:46PM +0200, Hans Petter Selasky wrote: > On 08/02/17 13:43, Konstantin Belousov wrote: > > On Wed, Aug 02, 2017 at 01:27:50PM +0200, Hans Petter Selasky wrote: > >> On 08/02/17 13:17, Konstantin Belousov wrote: > >>> But y must be dev_t. > >> > >> Sure, but "struct

Re: svn commit: r321920 - head/sys/sys

2017-08-02 Thread Hans Petter Selasky
On 08/02/17 12:14, Konstantin Belousov wrote: +#definemajor(x)((int)((dev_t)(x) >> 32)) /* major number */ +#defineminor(x)((int)((x) & 0x)) /* minor number */ +#definemakedev(x, y) (((dev_t)(x) << 32) | (y))/* create dev_t */ One

Re: svn commit: r321920 - head/sys/sys

2017-08-02 Thread Hans Petter Selasky
On 08/02/17 13:43, Konstantin Belousov wrote: On Wed, Aug 02, 2017 at 01:27:50PM +0200, Hans Petter Selasky wrote: On 08/02/17 13:17, Konstantin Belousov wrote: But y must be dev_t. Sure, but "struct cdev" 's si_drv0 is only "int" . How can it contain dev_t ? Why should it contain dev_t ?

Re: svn commit: r321920 - head/sys/sys

2017-08-02 Thread Konstantin Belousov
On Wed, Aug 02, 2017 at 01:27:50PM +0200, Hans Petter Selasky wrote: > On 08/02/17 13:17, Konstantin Belousov wrote: > > But y must be dev_t. > > Sure, but "struct cdev" 's si_drv0 is only "int" . How can it contain > dev_t ? Why should it contain dev_t ? Linux KPI abused that field it seems.

Re: svn commit: r321920 - head/sys/sys

2017-08-02 Thread Hans Petter Selasky
On 08/02/17 13:17, Konstantin Belousov wrote: But y must be dev_t. Sure, but "struct cdev" 's si_drv0 is only "int" . How can it contain dev_t ? --HPS ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all

Re: svn commit: r321920 - head/sys/sys

2017-08-02 Thread Konstantin Belousov
On Wed, Aug 02, 2017 at 01:11:48PM +0200, Hans Petter Selasky wrote: > On 08/02/17 13:06, Konstantin Belousov wrote: > > So linuxkpi was broken before this commit as well, as I noted in my > > other reply ? > > Hi, > > The LinuxKPI uses minor/major/makedev internally. > > y = makedev(z,t) > >

Re: svn commit: r321920 - head/sys/sys

2017-08-02 Thread Hans Petter Selasky
On 08/02/17 13:06, Konstantin Belousov wrote: So linuxkpi was broken before this commit as well, as I noted in my other reply ? Hi, The LinuxKPI uses minor/major/makedev internally. y = makedev(z,t) Then the LinuxKPI assumes z and t can be retrieved through minor and major: minor(y) == z

Re: svn commit: r321920 - head/sys/sys

2017-08-02 Thread Konstantin Belousov
On Wed, Aug 02, 2017 at 12:35:47PM +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

Re: svn commit: r321920 - head/sys/sys

2017-08-02 Thread Konstantin Belousov
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

Re: svn commit: r321920 - head/sys/sys

2017-08-02 Thread Hans Petter Selasky
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

Re: svn commit: r321920 - head/sys/sys

2017-08-02 Thread Hans Petter Selasky
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