Re: Calling do_mknod() from init_module()

Theodore Y. Ts'o (tytso@MIT.EDU)
Wed, 2 Apr 1997 23:51:13 -0500


From: rick@dgii.com (Rick Richardson)
Date: Wed, 2 Apr 1997 21:32:11 -0600 (CST)

We were wondering why no drivers use do_mknod() from
init_module() to automatically create the minor device
nodes when a loadable driver with dynamic major number
allocation is loaded.

It's generally not the Unix philosophy to do this. In general kernel
driver routines don't dictate what the /dev name is, so that system
administrators can choose ones other than the standard convention if
they *really* want.

One practical problem of doing this is that if you delete and remake the
inode each time the kernel module is loaded, you lose the owner, group,
and permissions that the system administrator might want to set on the
device.

If you don't care about the first philosophical point, I suppose a
reasonable compromise is to create the device if it doesn't already
exist, but don't delete the device when you unload the filesystem.

- Ted