Subject: Re: workaround for FreeBSD binary that hardcodes a device major (was: Re: CVS commit: src/sys/conf)
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
From: Emmanuel Dreyfus <manu@netbsd.org>
List: tech-kern
Date: 09/24/2006 09:35:13
Izumi Tsutsui <tsutsui@ceres.dti.ne.jp> wrote:

> We have to specify attribute for twa, as mentioned in config(9).
> i.e. it should be:
(snip)
> -device-major twa             char 187
> +device-major twa             char 187                twa

Ok, so I allocate twa in src/sys/conf/majors, with major 187, and it
would be alright?


For twe, I suggest the following plan: allocate it with major 188, then
tweak freebsd_sys_mknod so that creating a device with major 188 is
turned into creating a device with major 146. A sysctl could be used to
toggle that behavior on or off. Something like this:
sysctl -w emul.freebsd.twe.shiftmajor=1

We could make a little step forward and have a generic device remapping
system configurable through sysctl, but is it worth it? Something like:

sysctl -w emul.freebsd.mapdevice.188.0=146.0

The device map would be a chained list attached to struct emul. I wonder
if there would be any interest into making it per-process instead of
per-emul. That would cost a pointer per struct proc.

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu@netbsd.org