LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-27-2008, 02:01 PM   #1
stevexyz
LQ Newbie
 
Registered: Apr 2008
Location: Hampshire, UK
Distribution: None
Posts: 27

Rep: Reputation: 16
sysfs_create_group()


Hi there,

I have a device with a number of almost identical channels, each with six attributes, so the file and directory entries look like this:

Code:
/sys/.../devicename/A/{in0,in1,in2,out1,out2,out3}
                    B/{in0,in1,in2,out1,out2,out3}
                    C/{in0,in1,in2,out1,out2,out3}
                    D/{in0,in1,in2,out1,out2,out3}
                    E/{in0,in1,in2,out1,out2,out3}
It makes sense to put all the attributes for the {in0.... out3} into an attribute group with a name corresponding to its channel and call sysfs_create_group() for each channel.

Device attributes are passed into their store/show functions like this:
Code:
static ssize_t store_whatever(struct device *d, struct device_attribute *a,                   
                              const char *buf, size_t c)
Is there a pleasant method of determining from within the show/store functions which group the passed-in attributes belong to?

The method I'm using right now is far too complex and too clumsy to be the correct solution!

Thanks, Steve
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration