Whamcloud - gitweb
LU-8066 obd: Generic helpers for sysfs
[fs/lustre-release.git] / lustre / obdclass / lprocfs_status.c
index 70fb906..c9b4711 100644 (file)
@@ -2174,6 +2174,30 @@ void lprocfs_oh_clear(struct obd_histogram *oh)
 }
 EXPORT_SYMBOL(lprocfs_oh_clear);
 
+ssize_t lustre_attr_show(struct kobject *kobj,
+                        struct attribute *attr, char *buf)
+{
+       struct lustre_attr *a = container_of(attr, struct lustre_attr, attr);
+
+       return a->show ? a->show(kobj, attr, buf) : 0;
+}
+EXPORT_SYMBOL_GPL(lustre_attr_show);
+
+ssize_t lustre_attr_store(struct kobject *kobj, struct attribute *attr,
+                         const char *buf, size_t len)
+{
+       struct lustre_attr *a = container_of(attr, struct lustre_attr, attr);
+
+       return a->store ? a->store(kobj, attr, buf, len) : len;
+}
+EXPORT_SYMBOL_GPL(lustre_attr_store);
+
+const struct sysfs_ops lustre_sysfs_ops = {
+       .show  = lustre_attr_show,
+       .store = lustre_attr_store,
+};
+EXPORT_SYMBOL_GPL(lustre_sysfs_ops);
+
 int lprocfs_obd_rd_max_pages_per_rpc(char *page, char **start, off_t off,
                                     int count, int *eof, void *data)
 {