[TEST(/review)] major/minor/devname fix

Poul-Henning Kamp phk at phk.freebsd.dk
Wed Mar 9 22:32:42 PST 2005


In message <20050310062410.GA27497 at nagual.pp.ru>, Andrey Chernov writes:
>On Wed, Mar 09, 2005 at 10:40:18PM +0100, Poul-Henning Kamp wrote:
>> +dev_t
>> +dev2udev(struct cdev *x)
>> +{
>> +	if (x == NULL)
>> +		return (NODEV);
>> +	return (x->si_inode ^ devfs_random());
>> +}
>
>...
>
>> +	dp = devfs_itod(ud ^ devfs_random());
>
>
>Why you try to use randomization here instead of sequental ordering (or 
>reversing/shifting it)? In such small number of bits there is a big 
>probability of collisions may occurse.

There is no risk of collision, look at what devfs_random() does.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-current mailing list