]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/sysfs/file.c
sysfs: merge regular and bin file handling
[karo-tx-linux.git] / fs / sysfs / file.c
index 417d005955d90c3c178b4f0022408bf964bbc854..5f7a955550debdb85b483c973dca82407b1581da 100644 (file)
@@ -987,6 +987,32 @@ void sysfs_remove_file_from_group(struct kobject *kobj,
 }
 EXPORT_SYMBOL_GPL(sysfs_remove_file_from_group);
 
+/**
+ *     sysfs_create_bin_file - create binary file for object.
+ *     @kobj:  object.
+ *     @attr:  attribute descriptor.
+ */
+int sysfs_create_bin_file(struct kobject *kobj,
+                         const struct bin_attribute *attr)
+{
+       BUG_ON(!kobj || !kobj->sd || !attr);
+
+       return sysfs_add_file(kobj->sd, &attr->attr, SYSFS_KOBJ_BIN_ATTR);
+}
+EXPORT_SYMBOL_GPL(sysfs_create_bin_file);
+
+/**
+ *     sysfs_remove_bin_file - remove binary file for object.
+ *     @kobj:  object.
+ *     @attr:  attribute descriptor.
+ */
+void sysfs_remove_bin_file(struct kobject *kobj,
+                          const struct bin_attribute *attr)
+{
+       sysfs_hash_and_remove(kobj->sd, attr->attr.name, NULL);
+}
+EXPORT_SYMBOL_GPL(sysfs_remove_bin_file);
+
 struct sysfs_schedule_callback_struct {
        struct list_head        workq_list;
        struct kobject          *kobj;