Re: procfs question

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

 



On Sun, Jun 18, 2006 at 08:33:38PM +0200, Fernando Apestegu?a wrote:
> Hi list!
> 
> I need to create a hierarchy of procfs files. I made some tests
> successfully.
> Now, I want to create a hierarchy as follows:
> 
> procfs
> |
> |
> |-my_directory
>          |
>          |-dir_a
>          |     |
>          |     |-field 1
>          |     |-field 2
>          |     |-field 3
>          |
>          |-dir_b
>          |     |-field 1
>          |     |-field 2
>          |     |-field 3
> 
> dir_a and dir_b has the correspondent dir_a and dir_b structs inside my
> module. These structs has the same type (the same fields but different
> values). So my idea was to assign the same read_proc function to all of my
> proc_dir_entry for "field *" files. Once inside this function, make a switch
> to know which concrete struct should I ask.
> Here reaches my question. The switch would depend on the parent directory
> (if I'm reading from field 1 subdir of dir_a, then search for dir_a struct)
> but the comment at proc_fs.h say that "this is not complete implemented
> yet".
> 
> Can I use that fileds? Is there a easier way to implement this? I would like
> to write as fewer lines as possible to achieve this.

Use debugfs instead.  It's much easier to do this there.  If you really
want to, sysfs can be used also, but it depends on what you want to
provide in those files.

good luck,

greg k-h

--
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