Skip to contentSkip to conversation

minor device number request for /dev/kvm (kernel-based virtual machine)

DISCUSSION Avi Kivity 3 participants 4 messages Mar 1, 2007 2 messages not in the archive KVM

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 93C4769E3BED6B42B7203BD6F065654C08C5D6D3@dmoexc01.emea.cpqcorp.net

Avi Kivity

author
#2 lore raw
Quoted 9 lines · Torben
Quoted 5 lines

10 char Non-serial mice, misc features
nnn = /dev/kvm kernel-based virtual machine (hardware
virtualization extensions)

Major 10, minor 256 has been assigned to /dev/kvm. Let me know if this is nok okay.

It doesn't work. The culprit appears to be

drivers/char/misc.c:

register_chrdev(MISC_MAJOR,"misc",&misc_fops)

which in turn means:

fs/char_dev.c:

Quoted 9 lines

int register_chrdev(unsigned int major, const char *name,
const struct file_operations *fops)

{
    struct char_device_struct *cd;
    struct cdev *cdev;
    char *s;
    int err = -ENOMEM;

    cd = __register_chrdev_region(major, 0, 256, name);

So misc minor numbers under 256 are not supported.

What's the way out? Increase the region size? I don't know if that's safe.

Signature · 1 line
error compiling committee.c: too many arguments to function
#3 lore raw
Quoted 10 lines · Avi Kivity

fs/char_dev.c:

Quoted 8 lines

int register_chrdev(unsigned int major, const char *name,
const struct file_operations *fops)
{
struct char_device_struct *cd;
struct cdev *cdev;
char *s;
int err = -ENOMEM;

Quoted 5 lines
Quoted 1 line

cd = __register_chrdev_region(major, 0, 256, name);

So misc minor numbers under 256 are not supported.

What's the way out? Increase the region size? I don't know if that's safe.

If it does not increase memory usage, then possibly:

  __register_chrdev_region(major, 0, (~0U) & MINORMASK, name);
                                  or (1<<MINORMASK)-1 if that's more clear

Jan

Signature · 5 lines
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
author
#4 lore raw
Quoted 16 lines · Jan Engelhardt
Quoted 14 lines · Avi Kivity

fs/char_dev.c:

Quoted 10 lines

int register_chrdev(unsigned int major, const char *name,
const struct file_operations *fops)
{
struct char_device_struct *cd;
struct cdev *cdev;
char *s;
int err = -ENOMEM;

cd = __register_chrdev_region(major, 0, 256, name);

So misc minor numbers under 256 are not supported.

Quoted 9 lines
Quoted 2 lines

What's the way out? Increase the region size? I don't know if that's safe.

If it does not increase memory usage, then possibly:

  __register_chrdev_region(major, 0, (~0U) & MINORMASK, name);
                                  or (1<<MINORMASK)-1 if that's more clear

I'm more worried about something in the chardev bowels not supporting >8bit minors well.

Signature · 1 line
error compiling committee.c: too many arguments to function
#5 lore raw
Quoted 11 lines
Quoted 4 lines

If it does not increase memory usage, then possibly:

  __register_chrdev_region(major, 0, (~0U) & MINORMASK, name);
                                  or (1<<MINORMASK)-1 if that's more

clear

Quoted 2 lines

I'm more worried about something in the chardev bowels not supporting

Quoted 1 line

8bit minors well.

I was under the impression that large minors was supported for misc. Skimming the code that does not seem to be the case. Can someone comment?

Torben