<div><br> </div>
<div class="gmail_quote">On Wed, Aug 10, 2011 at 3:12 PM, Greg KH <span dir="ltr"><<a href="mailto:greg@kroah.com">greg@kroah.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div class="im">On Wed, Aug 10, 2011 at 02:43:31PM -0700, Vaibhav Jain wrote:<br>> Sorry for the vague question. I would clarify. There are two things I need :<br>><br>> 1- I need to know how information is organized in the sysfs and understand<br>
> the concepts of kobjects , attributes etc.<br><br></div>Please read the in-kernel documentation for kobjects and sysfs which<br>will explain this. If not, please let us know what is lacking.<br><br>The sysfs documentation in the kernel is a bit old, but the basics<br>
remain the same. The kobject documentation is quite up to date, and<br>should be very useful.<br><br>But, it turns out you really don't want to mess with a kobject directly<br>because:<br>
<div class="im"><br>> 2.- I need to understand how to create a file entry in the sysfs.<br>> Particulary i need to create an entry inside the<br>> directory /sys/devices/system/cpu/ .<br><br></div>No you don't :)<br>
<div class="im"><br>> I will be required to write some driver in the future which will<br>> accept inputs from this file but I am not very clear about that right<br>> now. So I was thinking of just trying to create an entry for now.<br>
<br></div>You really don't want to create a new file there unless you really know<br>what you are doing, and get a whole lot of buy-in by some of the core<br>kernel developers.<br><br>The sysdev code is a mess, and currently being worked on, and hopefully<br>
adding files to /sys/devices/system/ will be easier than it currently is<br>in the future. Until then, I'd strongly suggest staying away from<br>/sys/devices/system unless you coordinate it with the sysfs and driver<br>
core subsystem kernel maintainer.<br><br>What type of file are you wanting to add? What do you want it to do?<br><br>And most importantly, why not just look at the code that adds those<br>files to sysfs for how to do it yourself?<br>
<br>thanks,<br><br>greg k-h<br></blockquote></div>
<div> </div>
<div> </div>
<div>
<div>Hi Greg,</div>
<div> </div>
<div>Thanks for ther reply!</div>
<div>But I really need to create an entry in /sys/devices/system.</div>
<div>I am working on a project on extending the cpu hotplug (/sys/devices/system/cpu) .</div>
<div>I went through the books LDD and LKD and got some understanding of sysfs but they are </div>
<div>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.</div>
<div>Could you please suggest how should I go about finding the code ? I searched for it in google but did not hit anything significant.</div>
<div> </div>
<div>Thanks</div>
<div>Vaibhav Jain</div><br></div>