using mknod
I'm writing a kernel module device driver for a digital signal processor that is connected to a linux system on the PCI bus. My driver is working to this point, and now I need to make it visible to userspace, which means I have to create a node in /dev using mknod.
I have identified the device as a character device, and I have specified that it has a major number of 09, which I then tell the kernel to use. This is fine with the kernel.
Now, to use mknod, I have to have a minor number available too. However I don't tell the kernel what the minor number is, and I don't see anyplace where the kernel tells me.
With block devices in the case of a hard drive, the minor number will refer to the partition number on the hard drive. The disk itself has the minor number 0 and each partition gets a sequential number.
Using this as an analogy, am I safe in specifying a minor number of 0 for this dsp? Or is there some other rule I would use with a character device to specify the minor number?
edit: I did specify a minor number of 0 and the system seems to be happy with that. So I suppose it is OK. Would like to know, though, what the rules are because I don't want to get bit by a subtlety down the road; this dsp is real time, the system will be embedded, and I have plenty of other issues to work through.
Last edited by jiml8; 07-19-2007 at 08:41 PM.
|