[PATCH] was: mdev doesn't remove devices
Rob Landley
rob at landley.net
Tue Aug 29 18:36:38 UTC 2006
On Monday 28 August 2006 5:21 pm, Jason Schoon wrote:
> Since we're on the topic of mdev already, I have a patch I had to create
> today that I thought I would run by the list.
>
> I am using mdev with a mdev.conf to launch a script file in certain cases
> (basically it enables hotplugging on USB flash devices for me).
>
> In that script, I happened to add a line that sends its output to /dev/null
> (i.e. 2>/dev/null). Well, this just so happens to create an empty file,
> which then causes mknod of /dev/null to fail with an "already exists."
You're calling this from a hotplug script that's called before /dev/null
exists. This really sounds like pilot error to me.
> So, my solution was to either make sure that my hotplug script never, ever
> talks to a dev file (a poor assumption I feel),
You're creating your devices via hotplug and you want to assume that random
devices have already been created?
> or to patch mdev to check if
> something is a regular file, and delete it. Attached is a patch that
> accomplishes just that. If someone else thinks that is a sane thing to do,
> please apply.
Isn't this really a special case for /dev/null? Why not mknod /dev/null from
your init script if your hotplug scripts are going to assume it exists before
the hotplug scripts have been called?
If you don't want to build in mknod, you can get mdev to do it:
ACTION=add DEVPATH=/sys/class/mem/null mdev
Rob
--
Never bet against the cheap plastic solution.
More information about the busybox
mailing list