LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   sysfs_create_group() (https://www.linuxquestions.org/questions/programming-9/sysfs_create_group-638229/)

stevexyz 04-27-2008 02:01 PM

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


All times are GMT -5. The time now is 02:42 PM.