* Need help in understanding sysfs @ 2011-08-10 19:09 Vaibhav Jain 2011-08-10 19:18 ` Greg KH 2011-08-10 21:14 ` Jeff Haran 0 siblings, 2 replies; 10+ messages in thread From: Vaibhav Jain @ 2011-08-10 19:09 UTC (permalink / raw) To: kernelnewbies Hi, I need to undestand sysfs and make changes to it. Please provide me with some good references. Thanks Vaibhav Jain -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110810/402cff66/attachment.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* Need help in understanding sysfs 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 21:14 ` Jeff Haran 1 sibling, 1 reply; 10+ messages in thread From: Greg KH @ 2011-08-10 19:18 UTC (permalink / raw) To: kernelnewbies On Wed, Aug 10, 2011 at 12:09:25PM -0700, Vaibhav Jain wrote: > Hi, > I need to undestand sysfs and make changes to it. What specifically do you need to understand, and what do you want to change? sysfs is a very vast subject, and vague, we need specifics. greg k-h ^ permalink raw reply [flat|nested] 10+ messages in thread
* Need help in understanding sysfs 2011-08-10 19:18 ` Greg KH @ 2011-08-10 19:31 ` Vaibhav Jain 2011-08-10 19:47 ` Greg KH 0 siblings, 1 reply; 10+ messages in thread From: Vaibhav Jain @ 2011-08-10 19:31 UTC (permalink / raw) To: kernelnewbies Hi, I need to understand actually how sysfs works and what is the hierarchy of the sysfs directory structure. Specifically I need to know how to add entries in sysfs and how to make them work. Thanks Vaibhav Jain On Wed, Aug 10, 2011 at 12:18 PM, Greg KH <greg@kroah.com> wrote: > On Wed, Aug 10, 2011 at 12:09:25PM -0700, Vaibhav Jain wrote: > > Hi, > > I need to undestand sysfs and make changes to it. > > What specifically do you need to understand, and what do you want to > change? > > sysfs is a very vast subject, and vague, we need specifics. > > greg k-h > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110810/27463d30/attachment.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* Need help in understanding sysfs 2011-08-10 19:31 ` Vaibhav Jain @ 2011-08-10 19:47 ` Greg KH 0 siblings, 0 replies; 10+ messages in thread From: Greg KH @ 2011-08-10 19:47 UTC (permalink / raw) To: kernelnewbies A: No. Q: Should I include quotations after my reply? http://daringfireball.net/2007/07/on_top On Wed, Aug 10, 2011 at 12:31:13PM -0700, Vaibhav Jain wrote: > Hi, > ? > I need to understand actually how sysfs works and what is the hierarchy of the > sysfs directory structure. Again, that is very vague. Do you want to know how the internal dentry store is working to create the virtual filesystem, and how the namespace code handles things properly when you are walking the tree from userspace? Or do you just care enough as a driver developer who wants to add a new file for their driver or device? Those are two vastly different things, and there's stuff in the middle as well. > Specifically I need to know how to add entries in sysfs and how to make them > work. For what type of device? And, as always, what is lacking in the existing documentation that comes with the kernel that has you confused? thanks, greg k-h ^ permalink raw reply [flat|nested] 10+ messages in thread
* Need help in understanding sysfs 2011-08-10 19:09 Need help in understanding sysfs Vaibhav Jain 2011-08-10 19:18 ` Greg KH @ 2011-08-10 21:14 ` Jeff Haran 2011-08-10 21:43 ` Vaibhav Jain 1 sibling, 1 reply; 10+ messages in thread From: Jeff Haran @ 2011-08-10 21:14 UTC (permalink / raw) To: kernelnewbies From: kernelnewbies-bounces@kernelnewbies.org [mailto:kernelnewbies-bounces at kernelnewbies.org] On Behalf Of Vaibhav Jain Sent: Wednesday, August 10, 2011 12:09 PM To: kernelnewbies at kernelnewbies.org Subject: Need help in understanding sysfs Hi, I need to undestand sysfs and make changes to it. Please provide me with some good references. Thanks Vaibhav Jain First thing to try would be your favorite search engine. If you do a search for "lwn <topic>" you'll often be taken to a LWN article that is on topic though perhaps a bit dated. For instance, a search for "lwn sysfs" takes you to here: http://lwn.net/Articles/54651/ Probably a good place to start. Linux is mostly good code, but the documentation that comes with the kernel sources mostly sucks, so the web is your friend in this regard. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110810/0d5c3698/attachment.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* Need help in understanding sysfs 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 0 siblings, 2 replies; 10+ messages in thread From: Vaibhav Jain @ 2011-08-10 21:43 UTC (permalink / raw) To: kernelnewbies On Wed, Aug 10, 2011 at 2:14 PM, Jeff Haran <jharan@bytemobile.com> wrote: > *From:* kernelnewbies-bounces at kernelnewbies.org [mailto: > kernelnewbies-bounces at kernelnewbies.org] *On Behalf Of *Vaibhav Jain > *Sent:* Wednesday, August 10, 2011 12:09 PM > *To:* kernelnewbies at kernelnewbies.org > *Subject:* Need help in understanding sysfs**** > > ** ** > > Hi,**** > > I need to undestand sysfs and make changes to it.**** > > Please provide me with some good references.**** > > **** > > Thanks**** > > Vaibhav Jain**** > > **** > > First thing to try would be your favorite search engine. If you do a search > for ?lwn <topic>? you?ll often be taken to a LWN article that is on topic > though perhaps a bit dated. For instance, a search for ?lwn sysfs? takes you > to here:**** > > ** ** > > http://lwn.net/Articles/54651/**** > > ** ** > > Probably a good place to start. Linux is mostly good code, but the > documentation that comes with the kernel sources mostly sucks, so the web is > your friend in this regard.**** > > ** ** > Hi, 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. 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/ . 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. I tried searching the web but there are not many articles that explain the above two in detail unlike procfs for which there are a lot of articles with samples. The ones I found were not very interesting to read. Thanks Vaibhav Jain -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110810/964a1b4c/attachment-0001.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* Need help in understanding sysfs 2011-08-10 21:43 ` Vaibhav Jain @ 2011-08-10 22:08 ` Anuz Pratap Singh Tomar 2011-08-10 22:12 ` Greg KH 1 sibling, 0 replies; 10+ messages in thread From: Anuz Pratap Singh Tomar @ 2011-08-10 22:08 UTC (permalink / raw) To: kernelnewbies On Wed, Aug 10, 2011 at 10:43 PM, Vaibhav Jain <vjoss197@gmail.com> wrote: > > > On Wed, Aug 10, 2011 at 2:14 PM, Jeff Haran <jharan@bytemobile.com> wrote: > >> *From:* kernelnewbies-bounces at kernelnewbies.org [mailto: >> kernelnewbies-bounces at kernelnewbies.org] *On Behalf Of *Vaibhav Jain >> *Sent:* Wednesday, August 10, 2011 12:09 PM >> *To:* kernelnewbies at kernelnewbies.org >> *Subject:* Need help in understanding sysfs**** >> >> ** ** >> >> Hi,**** >> >> I need to undestand sysfs and make changes to it.**** >> >> Please provide me with some good references.**** >> >> **** >> >> Thanks**** >> >> Vaibhav Jain**** >> >> **** >> >> First thing to try would be your favorite search engine. If you do a >> search for ?lwn <topic>? you?ll often be taken to a LWN article that is on >> topic though perhaps a bit dated. For instance, a search for ?lwn sysfs? >> takes you to here:**** >> >> ** ** >> >> http://lwn.net/Articles/54651/**** >> >> ** ** >> >> Probably a good place to start. Linux is mostly good code, but the >> documentation that comes with the kernel sources mostly sucks, so the web is >> your friend in this regard.**** >> >> ** ** >> > > > Hi, > > 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. > > 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/ . 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. > > I tried searching the web but there are not many articles that explain the > above two in detail unlike procfs for which there are a lot of articles with > samples. > The ones I found were not very interesting to read. > > Thanks > Vaibhav Jain > > > > Have you used google? The third link in the google is a classic paper by patrick Mochel, it pretty much covers all the basics. There is a lot of information on sysfs in Robert love's LKD and There is an entire chapter on sysfs in LDD, which tells all the details about creating entry and other basics. > > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies at kernelnewbies.org > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110810/5b26b8e0/attachment.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* Need help in understanding sysfs 2011-08-10 21:43 ` Vaibhav Jain 2011-08-10 22:08 ` Anuz Pratap Singh Tomar @ 2011-08-10 22:12 ` Greg KH 2011-08-12 21:25 ` Vaibhav Jain 1 sibling, 1 reply; 10+ messages in thread From: Greg KH @ 2011-08-10 22:12 UTC (permalink / raw) To: kernelnewbies 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 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Need help in understanding sysfs 2011-08-10 22:12 ` Greg KH @ 2011-08-12 21:25 ` Vaibhav Jain 2011-08-12 21:35 ` Greg KH 0 siblings, 1 reply; 10+ messages in thread From: Vaibhav Jain @ 2011-08-12 21:25 UTC (permalink / raw) To: kernelnewbies On Wed, Aug 10, 2011 at 3:12 PM, Greg KH <greg@kroah.com> wrote: > 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 > Hi Greg, Thanks for ther reply! But I really need to create an entry in /sys/devices/system. I am working on a project on extending the cpu hotplug (/sys/devices/system/cpu) . I went through the books LDD and LKD and got some understanding of sysfs but they are lacking samples. I thought of looking into the code that adds the entries inside /sys/devices/system/cpu but I am unable to find it. Could you please suggest how should I go about finding the code ? I searched for it in google but did not hit anything significant. Thanks Vaibhav Jain -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110812/6a08342e/attachment.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* Need help in understanding sysfs 2011-08-12 21:25 ` Vaibhav Jain @ 2011-08-12 21:35 ` Greg KH 0 siblings, 0 replies; 10+ messages in thread From: Greg KH @ 2011-08-12 21:35 UTC (permalink / raw) To: kernelnewbies On Fri, Aug 12, 2011 at 02:25:55PM -0700, Vaibhav Jain wrote: > Thanks for ther reply! > But I really need to create an entry in /sys/devices/system. Why? > I am working on a project on extending the cpu hotplug > (/sys/devices/system/cpu) . What specifically are you doing here? Are you working with the existing CPU hotplug developers in the kernel? If not, why not? > I went through the books LDD and LKD and got some understanding of sysfs but > they are lacking samples. I thought of looking into the code that adds > the entries inside /sys/devices/system/cpu but I am unable to find > it. Where did you look? > Could you please suggest how should I go about finding the code ? vim drivers/base/cpu.c > I searched for it in google but did not hit anything significant. I suggest you look into using grep or ack or cgvg or ctags or something more relevant for doing source code searches. But again, be _VERY_ careful about adding files to that location without getting buy-in from the developers working in this area, as lots of people seem to be writing code here and most of it is being rejected by the maintainers due to it not doing things properly. See the recent conversations on the linux-kernel mailing list about moving cpus to "offline" mode for a good example of this. good luck, greg k-h ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-08-12 21:35 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 2011-08-12 21:25 ` Vaibhav Jain 2011-08-12 21:35 ` Greg KH
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.