Hi Hannes, Thanks for hinting me! -----Original Message-----
From: Hannes Reinecke [mailto:hare@suse.de]
Sofar I am grep'ing /proc/devices for the major number during startup and create the device nodes at startup.
Argl.
I am now wondering what is the most uptodate and recommended method to create the device nodes without the need for a user space setup script?
The 'optimal' way would be to request a dynamic device number; it should then be created automatically via udev.
Just call 'request_blkdev' (or request_chrdev) with major = 0, and you'll get a new dynamic major number allocated. Obviously you have to track minor numbers yourself; check for drivers/md/dm.c for how it might be done.
Well, I am currently calling register_chrdev() (I could not find a reference to either request_blkdev() nor request_chrdev()) register_chrdev(MajorNr, name, &SSHT_fops); This gives me the dynamically allocated major number which I then printk to klog. In user space I then grep in /proc&devices in order to figure out which major number got dynamically allocated and then create the device nodes algorithmically. I am therefore wondering how to avoid having to use such an awkward startup script while keeping the dynamic major number (I consider this an improvement to the kernel)? Sofar I have seen code which create the devices nodes via ugly kernel space code calling user space tools which imho is not nice either. Mit freundlichen Grüßen / Best regards Martin Konold Robert Bosch GmbH Automotive Electronics Postfach 13 42 72703 Reutlingen GERMANY www.bosch.com Tel. +49 7121 35 3322 Sitz: Stuttgart, Registergericht: Amtsgericht Stuttgart, HRB 14000; Aufsichtsratsvorsitzender: Hermann Scholl; Geschäftsführung: Franz Fehrenbach, Siegfried Dais; Stefan Asenkerschbaumer, Bernd Bohr, Rudolf Colm, Volkmar Denner, Wolfgang Malchow, Peter Marks, Uwe Raschke, Wolf-Henning Scheider, Peter Tyroller -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-kernel+help@opensuse.org