User: Password:
Subscribe / Log in / New account

benefits of sysfs

benefits of sysfs

Posted Jan 13, 2006 17:23 UTC (Fri) by elanthis (guest, #6227)
Parent article: Linux and wireless networking

Given that netlink sockets and specialized tools are already needed and will continue to be needed for many parts of the kernel, what is the benefit of having sysfs at all? All subsystems and modules could simply use a "generic" configuration protocol over netlink and standard tools for querying and setting those values could be part of the Linux userspace utilities.

Really, what's the benefit of 'cat /sys/foo' over 'linux-config --get foo' ? Is it because C code has an easier time reading a value from a file than from another program's output? That's also easily solvable with a really simple C library liblinuxconfig or somesuch.

Using a special tool like linux-config could easily make atomic writes possible, assuming the actual netlink-based configuration protocol supports them, by simply allowing multiple keys to be set on the command line or piping some specially formatted lines to linux-config's stdin.

A separate tool would also allow much better error reports than sysfs by allowing errors to be sent to stderr.

Is sysfs really that great of an idea, or was it just another case of someone pushing something into the kernel without *really* thinking things through, a lot like how devfs is (now) recognized to be?

(Log in to post comments)

benefits of sysfs

Posted Jan 14, 2006 12:05 UTC (Sat) by alex (subscriber, #1355) [Link]

"what's the benefit of 'cat /sys/foo' over 'linux-config --get foo'"

Exactly that. cat is cat, it does what it says on the tin and is pretty stable and unlikly to break. Once you move away from text based keys then you have issues with is linux-config up to date with the kernel? Has the ABI changed? Is linking working so linux-config can find /lib/

Now the debate as to if sysfs can neatly support atomic writes of groups is one to be had but I think a text based sysfs is very handy for the problem domain its aimed at.

Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds