Re: Config interface

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

 



I'm fairly noobish, but I think I can answer some of your questions
fairly accuretly

On Thu, 23 Dec 2004 02:37:09 +0100, Jon Øyvind Kjellman
<jonkje@xxxxxxxxxxxx> wrote:
> Some questions:
> 1. I've looked at sysfs, but the docs says it _should_ only take one
> variable, i need three, would my table be acceptable?

I'm not exactly sure what you're saying here, but you can use Sysfs in
a simmilar fashion to the way you would use Proc, you can have a
number of files to interact with userspace. From what I read if I were
you I would maybe have a single file to accept rows from the table,
and output existing rows. Maybe an IOCtl for deleting current rows?
Don't have much experience in what the best design would be.

> 2. The module creates a character device. When adding sysfs entries should
> I create new kobjects and if so, who should parent them? or should I use
> the struct cdev?

You shouldn't need to make any kobjects manually, what you might want
to do is use the cdev stuff to create the char device, and use the
class_simple stuff to deal w/ sysfs. Check the code for documentation
and examples.

> 3. How do I get the current cdev structure before any open or read/writes
> have taken place?

... you will create the cdev struct during the initialization of your
module, then keep it in a static variable to refer to any time you
need, is that what you're asking?

> 4. Could this be done better using ioctls, got any good tutorials or
> intro-docs on ioctls?

Great stuff in ioctls can be found in O'Reilly's Kernel Drivers
Revision 2 book available gratis for download from their site.

> 5. Am I correct in assuming that proc is depreceated (for 2.6+)

I don't believe it is depreciated, but it is inadvisable to add any
more files to proc, add them to sys instead.

to quote Greg K-H:
"Only standard is don't add any more new proc files :)

Use sysfs instead."

~Jake B

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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