Re: Doubt regarding Minor Numbers and alloc_chrdev_region

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

 



> If I try to create a file using, 'mknod /dev/scull2 c 250 7' , the
> character device file gets created with a minor number of 7.

You can create as much /dev/scull2 files using mknod as you
want, but they are not linked with your driver.

[first_minor, count] pair passed to alloc_chrdev_region reserve
for you a range of minors that will be later used by your driver.

Next step is to actually create the link between the node and your
driver using chrdev_add.

>
> I have set COUNT_OF_CONTIGOUS_DEVICES to 1. However, I am able to create
> multiple files /dev/scull[1-10] using this driver and mknod.
>
> So, what is the significance of these two variables (first minor number
> and count of devices) that we pass to the alloc_chrdev_region api, if

Try to read/write from/to your created nodes and see what happens :d.

thanks,
Daniel.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[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