Mailing List Archive

Re: minor device number request for /dev/kvm (kernel-based virtual machine)
Mathiasen, Torben wrote:
>> 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:
> 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.

--
error compiling committee.c: too many arguments to function

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: minor device number request for /dev/kvm (kernel-based virtual machine) [ In reply to ]
On Mar 1 2007 13:58, Avi Kivity wrote:
>
> fs/char_dev.c:
>> 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.

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
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: minor device number request for /dev/kvm (kernel-based virtual machine) [ In reply to ]
Jan Engelhardt wrote:
> On Mar 1 2007 13:58, Avi Kivity wrote:
>
>> fs/char_dev.c:
>>
>>> 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.
>>
>
> 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.


--
error compiling committee.c: too many arguments to function

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
RE: minor device number request for /dev/kvm (kernel-based virtual machine) [ In reply to ]
> > 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.
>

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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/