[Accel-config] [RFC] Provide library API to read and write raw sysfs attributes

Ramesh Thomas <ramesh.thomas at intel.com> Fri, 04 Feb 2022 11:15:22 -0800
Newsgroups dev.linux.lists.accel-config
Message-ID <[email protected]>
I am thinking of providing some generic functions to read and write 
sysfs attributes without much processing. This will be useful where raw 
reads and writes are required e.g. listing values of attributes or 
initializing attributes in a loop. This will open up possibilities of 
advanced use cases where user can do custom batch configurations in 
addition to the load and save configuration option.

There will be a get and set function for devices, groups, wqs and 
engines as follows

/* structure to read and write attributes from sysfs */
struct accfg_sysfs_attr {
         char attr[MAX_PARAM_LEN];
};

int accfg_get_device_attr(struct accfg_device *device, const char 
*attr_name,
                 struct *accfg_sysfs_attr);
int accfg_set_device_attr(struct accfg_device *device, const char 
*attr_name,
                 struct *accfg_sysfs_attr);

int accfg_get_group_attr(struct accfg_group *group, const char *attr_name,
                 struct *accfg_sysfs_attr);
int accfg_set_group_attr(struct accfg_group *group, const char *attr_name,
                 struct *accfg_sysfs_attr);

similarly for wqs and engines.

Let me know if you see any issue or other suggestions.

Thanks,
Ramesh