LINUX Jannat

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Tuesday, 3 April 2012

do we really need sysfs?

Posted on 09:23 by Unknown
I and my colleague were discussing sometime back about the kernel and how the data flow occurs from user to the hardware. How is the kernel driver api is called and in what sequence? Then He poped one question to me - why do we require the SYSFS when we already have DEVFS?

My first answer was - devfs is the one which actually talk to device driver and the using sysfs, we set or get the attributes for the device. But this answer was not convincing. He posted the question in stackoverflow.com and searched but it was not convincing. Even I wondered how two are different.

Searching the internet tells that the sysfs was originally developed to test the new device model which was being written for the kernel 2.5 version. That time the procfs was used primarily for the testing but since the procfs is basically fs for the information on process and other system related information. Due to this, procfs was cluttered with lots of non-process information. So the whole idea was to write a new file system which can aide to the development of new device model. Moreover, there was no mechanism for hotplug in linux kernel. So with the development of new sysfs (previously called ddfs which was based on in-memory fs, ramfs), these were achieved. 

Sysfs is a virtual filesystem which provides a userspace-visible representation of the device model. The sysfs filesystem is usually mounted on /sys. Sysfs is designed to export the information present in the device tree which would then no longer clutter up procfs. Sysfs is used by several utilities to access information about hardware and its driver  such as udev. Scripts have been written to access information and some scripts configure device drivers and devices via their attributes. For every kobject that is registered with the system, a directory is created for it in sysfs.

The device model and sysfs are sometimes confused with each other, but they are distinct entities. The device model functions just fine without sysfs (but the reverse is not true). Driver writers generally need not worry about sysfs; it is magically created and implemented by the driver model and bus driver code. The one exception comes about when it comes to exporting attributes via sysfs. These attributes represent some aspect of how the device and/or its driver operate; they may or may not be writeable from user space. Sysfs is now the preferred way (over /proc or ioctl()) to export these variables to user space. 




I think, this is a good point to start discussion on this topic. Hope, this clears some of the doubts. Still I have some doubts, which I am googling right now ;)


cya then...for now The Big Bang Theory (specially Penny) waiting for me...Bazingaaaa
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Android CPU Governors explained
    ( Credit - xda forum ) It always fascinated me how the cpufreq-ondemand driver works in Linux. While browsing, I got a very interesting disc...
  • Mobile signal boost in 2 mins
    Tired of network not available when inside your room? Now, the home made signal booster at your service. Required Material You would require...
  • do we really need sysfs?
    I and my colleague were discussing sometime back about the kernel and how the data flow occurs from user to the hardware. How is the kernel ...
  • Project cpuboard upgrade
    Hi guys Just created my first GIT repo on github. Soon it will have Liunx-3.8.2 to start with a new upgrade project for ARM9 based system. D...
  • __init call in linux kernel..How are they called?
    I always had this doubt about how the Linux drivers and internal core gets loaded in kernel. How do we decide which drive to load first as t...
  • Linux support for ARM big.LITTLE
    By Nicolas Pitre ARM Ltd recently announced the  big.LITTLE architecture  consisting of a twist on the SMP systems that we've all gotten...
  • Context Switch..An initial investigtion on ARM processor
    Modern operating system offer multitasking and multiprocessing. Even we have multiprocessor based systems. All of these require a Scheduler ...
  • Welcome Note
    Friends, I have seen my friends, my colleagues, my seniors and juniors almost everyone near me struggling one or other day with some problem...
  • touch screen technology
    Capacitive touch screen: The capacitive touch screen is made up of a glass panel that is coated with a material. The property of this mater...
  • Linux Kernel CPUFreq framework
    Most of the processor have mechanism to save power by scaling the frequency & voltage. Now, the question arise, why these two? Existing ...

Categories

  • android
  • Context-Switch
  • cpu governor
  • git
  • Linux cpuboard upgrade

Blog Archive

  • ►  2013 (6)
    • ►  April (2)
    • ►  March (4)
  • ▼  2012 (4)
    • ►  October (1)
    • ▼  April (3)
      • touch screen technology
      • do we really need sysfs?
      • Welcome Note
Powered by Blogger.

About Me

Unknown
View my complete profile