All of lore.kernel.org
 help / color / mirror / Atom feed
From: greg@kroah.com (Greg KH)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Need help in understanding sysfs
Date: Wed, 10 Aug 2011 15:12:54 -0700	[thread overview]
Message-ID: <20110810221254.GA3285@kroah.com> (raw)
In-Reply-To: <CAKuUYSwtF3qOaiWwLkZOF=a6rgiSySzhJkp33WoYRg8x+fD1Ag@mail.gmail.com>

On Wed, Aug 10, 2011 at 02:43:31PM -0700, Vaibhav Jain wrote:
> Sorry for the vague question. I would clarify. There are two things I need :
> 
> 1-  I need to know how information is organized in the sysfs and  understand
> the concepts of kobjects , attributes etc.

Please read the in-kernel documentation for kobjects and sysfs which
will explain this.  If not, please let us know what is lacking.

The sysfs documentation in the kernel is a bit old, but the basics
remain the same.  The kobject documentation is quite up to date, and
should be very useful.

But, it turns out you really don't want to mess with a kobject directly
because:

> 2.- I need to understand how to create a file entry in the sysfs.
> Particulary i need to create an entry inside the
> directory /sys/devices/system/cpu/ .

No you don't :)

> I will be required to write some driver in the future which will
> accept inputs from this file but I am not very clear about that right
> now. So I was thinking of just trying to create an entry for now.

You really don't want to create a new file there unless you really know
what you are doing, and get a whole lot of buy-in by some of the core
kernel developers.

The sysdev code is a mess, and currently being worked on, and hopefully
adding files to /sys/devices/system/ will be easier than it currently is
in the future.  Until then, I'd strongly suggest staying away from
/sys/devices/system unless you coordinate it with the sysfs and driver
core subsystem kernel maintainer.

What type of file are you wanting to add?  What do you want it to do?

And most importantly, why not just look at the code that adds those
files to sysfs for how to do it yourself?

thanks,

greg k-h

  parent reply	other threads:[~2011-08-10 22:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-10 19:09 Need help in understanding sysfs Vaibhav Jain
2011-08-10 19:18 ` Greg KH
2011-08-10 19:31   ` Vaibhav Jain
2011-08-10 19:47     ` Greg KH
2011-08-10 21:14 ` Jeff Haran
2011-08-10 21:43   ` Vaibhav Jain
2011-08-10 22:08     ` Anuz Pratap Singh Tomar
2011-08-10 22:12     ` Greg KH [this message]
2011-08-12 21:25       ` Vaibhav Jain
2011-08-12 21:35         ` Greg KH

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=20110810221254.GA3285@kroah.com \
    --to=greg@kroah.com \
    --cc=kernelnewbies@lists.kernelnewbies.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.