|
@@ -697,6 +697,35 @@ void kset_init(struct kset * k)
|
|
|
spin_lock_init(&k->list_lock);
|
|
|
}
|
|
|
|
|
|
+/* default kobject attribute operations */
|
|
|
+static ssize_t kobj_attr_show(struct kobject *kobj, struct attribute *attr,
|
|
|
+ char *buf)
|
|
|
+{
|
|
|
+ struct kobj_attribute *kattr;
|
|
|
+ ssize_t ret = -EIO;
|
|
|
+
|
|
|
+ kattr = container_of(attr, struct kobj_attribute, attr);
|
|
|
+ if (kattr->show)
|
|
|
+ ret = kattr->show(kobj, kattr, buf);
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+static ssize_t kobj_attr_store(struct kobject *kobj, struct attribute *attr,
|
|
|
+ const char *buf, size_t count)
|
|
|
+{
|
|
|
+ struct kobj_attribute *kattr;
|
|
|
+ ssize_t ret = -EIO;
|
|
|
+
|
|
|
+ kattr = container_of(attr, struct kobj_attribute, attr);
|
|
|
+ if (kattr->store)
|
|
|
+ ret = kattr->store(kobj, kattr, buf, count);
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+struct sysfs_ops kobj_sysfs_ops = {
|
|
|
+ .show = kobj_attr_show,
|
|
|
+ .store = kobj_attr_store,
|
|
|
+};
|
|
|
|
|
|
/**
|
|
|
* kset_add - add a kset object to the hierarchy.
|