Re: Right way to configure a driver? (sysfs, ioctl, proc, configfs,....)

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

 



On Wed, 1 Feb 2006, Aritz Bastida wrote:

>>> 3.- Actually the most difficult config I must do is to pass three
>>> values from userspace to my module. Specifically two integers and a
>>> long (it's an offset to a memory zone I've previously defined)
>>>
>>> struct meminfo {
>>>         unsigned int      id;         /* segment identifier */
>>>         unsigned int      size;     /* size of the memory area */
>>>         unsigned long   offset;   /* offset to the information */
>>> };
>>>
>>> How would you pass this information in sysfs? Three values in the same
>>> file? Note that using three different files wouldn't be atomic, and I
>>> need atomicity.
>>
>> Use configfs.
>>
>
> Ummhh, and would it be correct to configure my device via a netlink
> socket? Remember that my driver is a kind of network "virtual" device.
>
> There are so many old and new ways to configure a driver that I'm a
> bit overwhelmed...
>
> Regards
> Aritz

At the risk of the obvious....

 	struct meminfo meminfo;
         ioctl(fd, UPDATE_PARAMS, &meminfo);

... and define UPDATE_PARAMS and other function codes to start
above those normally used by kernel stuff so that `strace` doesn't
make up stories.

This is what the ioctl() interface is for. Inside the kernel
you can use spinlocks (after you got the data from user-space)
to make the operations atomicc.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.13.4 on an i686 machine (5589.66 BogoMips).
Warning : 98.36% of all statistics are fiction.
_
To unsubscribe


****************************************************************
The information transmitted in this message is confidential and may be privileged.  Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited.  If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [email protected] - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux