user space way to determine "region" of allocated minors?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  i'm guessing there's no way to do this but, if you list the file
/proc/devices, you see only the character and block devices and the
major number corresponding to them:

Character devices:
  1 mem
  4 /dev/vc/0
  4 tty
  4 ttyS
  5 /dev/tty
  5 /dev/console
  5 /dev/ptmx
  7 vcs
 10 misc
 13 input
 14 sound
 21 sg
 29 fb
 ... etc etc ...

is there any way, from user space, to see the *minor* number region
corresponding to those entries?  by way of explanation, in
fs/char_dev.c, you have the structure:

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];

so each structure clearly stores the "baseminor" and the "minorct".
but when it comes to print to the /proc/devices file, we read:

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);
        }
}

which displays only the major number and the name.  is there any way
to easily get the rest of that information?  is it displayed
elsewhere, possibly under /sys?

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


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux