2002-11-05 03:56:37

by Matt Domsch

[permalink] [raw]
Subject: RE: convert edd to use kobjects and sysfs.

> ChangeSet 1.855.4.11, 2002/10/31 12:37:07-08:00, [email protected]
> convert edd to use kobjects and sysfs.

Pat, thanks for converting the EDD code to sysfs. Is struct attribute going
to grow some form of existance test, something like I had done before?

> -static int
> -edd_populate_dir(struct edd_device *edev)
> -{
> - struct edd_attribute *attr;
> - int i;
> - int error = 0;
> -
> - for (i = 0; (attr=def_attrs[i]); i++) {
> - if (!attr->test || (attr->test && !attr->test(edev))) {
> - if ((error = edd_create_file(edev, attr))) {
> - break;
> - }
> - }
> - }

This allows attributes to be on def_attrs[] but depending on presence of
existance test (no test means true) and test result, not all attributes for
all similar objects get files created. This cleanly handles cases where not
all attributes are implemented or valid for all objects of a given type, and
keeps the object's directory free of extraneous invalid files.

Thanks,
Matt


--
Matt Domsch
Sr. Software Engineer, Lead Engineer, Architect
Dell Linux Solutions http://www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com