User: Password:
|
|
Subscribe / Log in / New account

Using sysfs for configuring wireless networking

Using sysfs for configuring wireless networking

Posted Jan 12, 2006 7:00 UTC (Thu) by akumria (subscriber, #7773)
In reply to: Using sysfs for configuring wireless networking by neilbrown
Parent article: Linux and wireless networking

Let's imagine that the program crashes in-between writing the new values and hitting the 'go' button.

Wouldn't that mean that I would not be able to determine the current values of various settings?


(Log in to post comments)

Using sysfs for configuring wireless networking

Posted Jan 12, 2006 7:09 UTC (Thu) by neilbrown (subscriber, #359) [Link]

A fair point.

As the new settings have not yet come into effect, there is no particular value in finding out what they are. But it would be useful to be able to revert any partial setting of these values.

So that attribute where you write 'go' to effect the new values: Also allow 'reset' to be written which reverts all the stored-for-later-use values to the currently active values.

Ofcourse this could be achived by simply reading each attribute and writing the value back again, but that it somewhat ugly.

There is a thing called 'configfs' in -mm which is meant to be able to provide this multiple-values-at-once thing, but when I considerred using it for something, it turned out to be too special purpose. The same thing can be achieved in sysfs with a bit of creativity, and I think it fits better there.

Using sysfs for configuring wireless networking

Posted Jan 12, 2006 13:58 UTC (Thu) by bronson (subscriber, #4806) [Link]

That's starting to sound fairly brutal, don't you think? The cure might be worse than the disease.

I realize one of the key features of sysfs is that there's one value per file (try to avoid the mess that became /proc), but lack of atomic updates seems a rather fundamental limitation. What about writing multiple values to a write-only file?

echo "essid=bug;key=gazpacho" > /sys/class/net/eth1/config

Escaping would be required, of course, but that's easily solved.

I don't understand why a netlink socket would be an improvement... It requires parsing, like /proc, but is not user-configurable, like ioctls. It's the worst of both worlds!

Using sysfs for configuring wireless networking

Posted Jan 12, 2006 13:59 UTC (Thu) by nix (subscriber, #2304) [Link]

If the size of that multi-value lump is bigger than a page, write() is not necessarily atomic either.

Using sysfs for configuring wireless networking

Posted Jan 14, 2006 12:38 UTC (Sat) by fergal (guest, #602) [Link]

t = open(">/sys/blah/transaction")
... # write lots of new values
write(t, "commit")
close(t)

write(t, "rollback") or just closing the filehandle without writing "commit" would cause the new values to be discarded. Until the commit, everything else sees the old values. No danger from crashing programs, just kill them and start a new transaction. There are issues about concurrent updates to multiple parts of /sys but that'll be true in any system that provides atomic updates for multiple values.


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