On Mon, 3 Aug 2009, Martyn Welch wrote: > The closest thing I can think of is the entries in sysfs, though > these need to be explicitly created by the driver using > device_create(): > > $ ls -la /dev/console > crw------- 1 root dialout 5, 1 2009-08-03 08:19 /dev/console > $ find /sys -name console > /sys/devices/virtual/tty/console > /sys/class/tty/console > $ cat /sys/class/tty/console/dev > 5:1 > $ as one last followup to this, a quick back reference to the kernel code in fs/char_dev.c that keeps track of allocated major and minor regions. first, here's the struct: static struct char_device_struct { struct char_device_struct *next; unsigned int major; unsigned int baseminor; int minorct; char name[64]; struct cdev *cdev; /* will die */ } *chrdevs[CHRDEV_MAJOR_HASH_SIZE]; which clearly is keeping track of a major number, plus its associated base minor number and number of minors. however, just below that, when it comes to printing the contents of /proc/devices: void chrdev_show(struct seq_file *f, off_t offset) { struct char_device_struct *cd; if (offset < CHRDEV_MAJOR_HASH_SIZE) { mutex_lock(&chrdevs_lock); for (cd = chrdevs[offset]; cd; cd = cd->next) seq_printf(f, "%3d %s\n", cd->major, cd->name); mutex_unlock(&chrdevs_lock); } } clearly, that call to seq_printf() *could* have also printed the baseminor value, and the range of allocated minors; it just doesn't. was that a conscious decision? adding that information to the end of each line wouldn't have messed up parsing that file since the additional minor number info could always have been ignored by a userspace app like awk or whatever. is there no inherent userspace value to that minor number information? it just seems that it would have taken precious little effort to have printed that out as well. rday -- ======================================================================== Robert P. J. Day Waterloo, Ontario, CANADA Linux Consulting, Training and Annoying Kernel Pedantry. Web page: http://crashcourse.ca Twitter: http://twitter.com/rpjday "Kernel Newbie Corner" column @ linux.com: http://cli.gs/WG6WYX ======================================================================== -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ