public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Aritz Bastida <aritzbastida@gmail.com>
To: Greg KH <greg@kroah.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Right way to configure a driver? (sysfs, ioctl, proc, configfs,....)
Date: Fri, 27 Jan 2006 11:30:26 +0100	[thread overview]
Message-ID: <7d40d7190601270230u850604av@mail.gmail.com> (raw)
In-Reply-To: <20060127050109.GA23063@kroah.com>

Hi!

> Hope this helps,
>
> greg k-h
>

Yes, it helped me much. I'll move all the configuration/statistics to
sysfs. I will read carefully the corresponding chapter in LDD3 :)
But before that, I've got a few questions with what I know:

1.- In what directory should I do all this configuration? I guess as,
I'm writing a module it should be in /sys/module/<my_module>, right?
Or would your recommend /sys/class/net or anything?

2.- In my sysfs directory I would create two subdirectories: "config"
and "stats". In the first I would place read/write files used for
configuration. For example "config/flags" for the flags variable. In
the second read-only files with the statistics. Is this approach
correct?

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.

4.- Last, you suggested that I had three files for the rx_packets count:
      rx_packets_cpu0
      rx_packets_cpu1
      rx_packets_total

     I have quite a few counters, and if that number of files is multiplied by
     the number of cpus, the number of files could be very large (imagine a
     8-cpu box), don't you think so? And after all reading a file with three
     values could be done very easily with awk...



That's all. Thank you for your help
Regards
Aritz

  reply	other threads:[~2006-01-27 10:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-26 20:06 Right way to configure a driver? (sysfs, ioctl, proc, configfs,....) Aritz Bastida
2006-01-27  5:01 ` Greg KH
2006-01-27 10:30   ` Aritz Bastida [this message]
     [not found]     ` <69304d110601270834q5fa8a078m63a7168aa7e288d1@mail.gmail.com>
2006-01-30 11:23       ` Aritz Bastida
2006-01-30 21:39         ` Greg KH
2006-02-01 14:54           ` Jan Engelhardt
2006-02-01 15:11             ` Greg KH
2006-02-01 15:44               ` Aritz Bastida
2006-02-01 16:17                 ` Jan Engelhardt
2006-02-02  6:31               ` Neil Brown
2006-01-30 21:41     ` Greg KH
2006-02-01 13:37       ` Aritz Bastida
2006-02-01 13:53         ` linux-os (Dick Johnson)
2006-02-01 14:19           ` Aritz Bastida
2006-02-01 15:11             ` linux-os (Dick Johnson)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7d40d7190601270230u850604av@mail.gmail.com \
    --to=aritzbastida@gmail.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox