make_dev_alias and sub-directories

John Baldwin jhb at freebsd.org
Thu Oct 31 19:27:19 UTC 2013


On Wednesday, October 30, 2013 6:10:22 am Norbert Koch wrote:
> Hello.
> 
> I have written a device driver which
> creates dev entries in a sub-directory of /dev, e.g.:
>  /dev/mydev/mydev0a
>  /dev/mydev/mydev0b
>  /dev/mydev/mydev0c ...
> 
> I want to alias mydev0a to mydev0.
> 
> With make_dev_alias (pdev, "mydev/mydev0") I see an incorrect symlink:
>  /dev/mydev/mydev0 -> mydev/mydev0a
> 
> Calling make_dev_alias (pdev, "mydev0") works:
>  /dev/mydev0 -> mydev/mydev0a
> But this is not what I want.
> 
> Any way to get this
>  /dev/mydev/mydev0 -> mydev0a ?
> 
> In other words: Is the behaviour I see a bug or a feature?

I think it is an oversight, but I'm not sure which way it should work.  
Probably we should parse the passed in alias name and add '../' prefixes to 
the 'pdev' name to generate the symlink contents so that you get:

/dev/mydev/mydev0 -> ../mydev/mydev0a

This would also let you do something like make_dev_alias(null, "foo/null2") to
create:

/dev/foo/null2 -> ../null

-- 
John Baldwin


More information about the freebsd-hackers mailing list