Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Tejun Heo | 6d66f5c | 2007-09-20 17:31:38 +0900 | [diff] [blame] | 2 | * fs/sysfs/bin.c - sysfs binary file implementation |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
| 4 | * Copyright (c) 2003 Patrick Mochel |
| 5 | * Copyright (c) 2003 Matthew Wilcox |
| 6 | * Copyright (c) 2004 Silicon Graphics, Inc. |
Tejun Heo | 6d66f5c | 2007-09-20 17:31:38 +0900 | [diff] [blame] | 7 | * Copyright (c) 2007 SUSE Linux Products GmbH |
| 8 | * Copyright (c) 2007 Tejun Heo <teheo@suse.de> |
| 9 | * |
| 10 | * This file is released under the GPLv2. |
| 11 | * |
| 12 | * Please see Documentation/filesystems/sysfs.txt for more information. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | */ |
| 14 | |
| 15 | #undef DEBUG |
| 16 | |
| 17 | #include <linux/errno.h> |
| 18 | #include <linux/fs.h> |
Randy.Dunlap | 995982c | 2006-07-10 23:05:25 -0700 | [diff] [blame] | 19 | #include <linux/kernel.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | #include <linux/kobject.h> |
| 21 | #include <linux/module.h> |
| 22 | #include <linux/slab.h> |
Dave Young | 869512a | 2007-07-26 14:53:53 +0000 | [diff] [blame] | 23 | #include <linux/mutex.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | |
| 25 | #include <asm/uaccess.h> |
| 26 | |
| 27 | #include "sysfs.h" |
| 28 | |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 29 | struct bin_buffer { |
| 30 | struct mutex mutex; |
| 31 | void *buffer; |
Tejun Heo | 0ab6608 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 32 | int mmapped; |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 33 | }; |
| 34 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | static int |
| 36 | fill_read(struct dentry *dentry, char *buffer, loff_t off, size_t count) |
| 37 | { |
Tejun Heo | 3e51903 | 2007-06-14 03:45:15 +0900 | [diff] [blame] | 38 | struct sysfs_dirent *attr_sd = dentry->d_fsdata; |
Tejun Heo | b1fc3d6 | 2007-09-20 16:05:11 +0900 | [diff] [blame] | 39 | struct bin_attribute *attr = attr_sd->s_bin_attr.bin_attr; |
| 40 | struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; |
Tejun Heo | 0ab6608 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 41 | int rc; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | |
Tejun Heo | 0ab6608 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 43 | /* need attr_sd for attr, its parent for kobj */ |
| 44 | if (!sysfs_get_active_two(attr_sd)) |
| 45 | return -ENODEV; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | |
Tejun Heo | 0ab6608 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 47 | rc = -EIO; |
| 48 | if (attr->read) |
Zhang Rui | 91a6902 | 2007-06-09 13:57:22 +0800 | [diff] [blame] | 49 | rc = attr->read(kobj, attr, buffer, off, count); |
Tejun Heo | 0ab6608 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 50 | |
| 51 | sysfs_put_active_two(attr_sd); |
| 52 | |
| 53 | return rc; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | static ssize_t |
Tejun Heo | 93e3cd82 | 2007-06-14 03:45:13 +0900 | [diff] [blame] | 57 | read(struct file *file, char __user *userbuf, size_t bytes, loff_t *off) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | { |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 59 | struct bin_buffer *bb = file->private_data; |
Josef "Jeff" Sipek | f427f5d | 2006-12-08 02:36:36 -0800 | [diff] [blame] | 60 | struct dentry *dentry = file->f_path.dentry; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | int size = dentry->d_inode->i_size; |
| 62 | loff_t offs = *off; |
Tejun Heo | 93e3cd82 | 2007-06-14 03:45:13 +0900 | [diff] [blame] | 63 | int count = min_t(size_t, bytes, PAGE_SIZE); |
Nick Piggin | b31ca3f | 2008-09-12 11:24:11 +0200 | [diff] [blame] | 64 | char *temp; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | |
Greg Kroah-Hartman | 4503efd | 2009-01-20 15:51:16 -0800 | [diff] [blame^] | 66 | if (!bytes) |
| 67 | return 0; |
| 68 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | if (size) { |
| 70 | if (offs > size) |
| 71 | return 0; |
| 72 | if (offs + count > size) |
| 73 | count = size - offs; |
| 74 | } |
| 75 | |
Nick Piggin | b31ca3f | 2008-09-12 11:24:11 +0200 | [diff] [blame] | 76 | temp = kmalloc(count, GFP_KERNEL); |
| 77 | if (!temp) |
| 78 | return -ENOMEM; |
| 79 | |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 80 | mutex_lock(&bb->mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 82 | count = fill_read(dentry, bb->buffer, offs, count); |
Nick Piggin | b31ca3f | 2008-09-12 11:24:11 +0200 | [diff] [blame] | 83 | if (count < 0) { |
| 84 | mutex_unlock(&bb->mutex); |
| 85 | goto out_free; |
| 86 | } |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 87 | |
Nick Piggin | b31ca3f | 2008-09-12 11:24:11 +0200 | [diff] [blame] | 88 | memcpy(temp, bb->buffer, count); |
| 89 | |
| 90 | mutex_unlock(&bb->mutex); |
| 91 | |
| 92 | if (copy_to_user(userbuf, temp, count)) { |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 93 | count = -EFAULT; |
Nick Piggin | b31ca3f | 2008-09-12 11:24:11 +0200 | [diff] [blame] | 94 | goto out_free; |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 95 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | |
Tejun Heo | 93e3cd82 | 2007-06-14 03:45:13 +0900 | [diff] [blame] | 97 | pr_debug("offs = %lld, *off = %lld, count = %d\n", offs, *off, count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | |
| 99 | *off = offs + count; |
| 100 | |
Nick Piggin | b31ca3f | 2008-09-12 11:24:11 +0200 | [diff] [blame] | 101 | out_free: |
| 102 | kfree(temp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | return count; |
| 104 | } |
| 105 | |
| 106 | static int |
| 107 | flush_write(struct dentry *dentry, char *buffer, loff_t offset, size_t count) |
| 108 | { |
Tejun Heo | 3e51903 | 2007-06-14 03:45:15 +0900 | [diff] [blame] | 109 | struct sysfs_dirent *attr_sd = dentry->d_fsdata; |
Tejun Heo | b1fc3d6 | 2007-09-20 16:05:11 +0900 | [diff] [blame] | 110 | struct bin_attribute *attr = attr_sd->s_bin_attr.bin_attr; |
| 111 | struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; |
Tejun Heo | 0ab6608 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 112 | int rc; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | |
Tejun Heo | 0ab6608 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 114 | /* need attr_sd for attr, its parent for kobj */ |
| 115 | if (!sysfs_get_active_two(attr_sd)) |
| 116 | return -ENODEV; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | |
Tejun Heo | 0ab6608 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 118 | rc = -EIO; |
| 119 | if (attr->write) |
Zhang Rui | 91a6902 | 2007-06-09 13:57:22 +0800 | [diff] [blame] | 120 | rc = attr->write(kobj, attr, buffer, offset, count); |
Tejun Heo | 0ab6608 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 121 | |
| 122 | sysfs_put_active_two(attr_sd); |
| 123 | |
| 124 | return rc; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | } |
| 126 | |
Tejun Heo | 93e3cd82 | 2007-06-14 03:45:13 +0900 | [diff] [blame] | 127 | static ssize_t write(struct file *file, const char __user *userbuf, |
| 128 | size_t bytes, loff_t *off) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | { |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 130 | struct bin_buffer *bb = file->private_data; |
Josef "Jeff" Sipek | f427f5d | 2006-12-08 02:36:36 -0800 | [diff] [blame] | 131 | struct dentry *dentry = file->f_path.dentry; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | int size = dentry->d_inode->i_size; |
| 133 | loff_t offs = *off; |
Tejun Heo | 93e3cd82 | 2007-06-14 03:45:13 +0900 | [diff] [blame] | 134 | int count = min_t(size_t, bytes, PAGE_SIZE); |
Nick Piggin | b31ca3f | 2008-09-12 11:24:11 +0200 | [diff] [blame] | 135 | char *temp; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | |
Greg Kroah-Hartman | 4503efd | 2009-01-20 15:51:16 -0800 | [diff] [blame^] | 137 | if (!bytes) |
| 138 | return 0; |
| 139 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 140 | if (size) { |
| 141 | if (offs > size) |
| 142 | return 0; |
| 143 | if (offs + count > size) |
| 144 | count = size - offs; |
| 145 | } |
| 146 | |
Nick Piggin | b31ca3f | 2008-09-12 11:24:11 +0200 | [diff] [blame] | 147 | temp = kmalloc(count, GFP_KERNEL); |
| 148 | if (!temp) |
| 149 | return -ENOMEM; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | |
Nick Piggin | b31ca3f | 2008-09-12 11:24:11 +0200 | [diff] [blame] | 151 | if (copy_from_user(temp, userbuf, count)) { |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 152 | count = -EFAULT; |
Nick Piggin | b31ca3f | 2008-09-12 11:24:11 +0200 | [diff] [blame] | 153 | goto out_free; |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 154 | } |
| 155 | |
Nick Piggin | b31ca3f | 2008-09-12 11:24:11 +0200 | [diff] [blame] | 156 | mutex_lock(&bb->mutex); |
| 157 | |
| 158 | memcpy(bb->buffer, temp, count); |
| 159 | |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 160 | count = flush_write(dentry, bb->buffer, offs, count); |
Nick Piggin | b31ca3f | 2008-09-12 11:24:11 +0200 | [diff] [blame] | 161 | mutex_unlock(&bb->mutex); |
| 162 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | if (count > 0) |
| 164 | *off = offs + count; |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 165 | |
Nick Piggin | b31ca3f | 2008-09-12 11:24:11 +0200 | [diff] [blame] | 166 | out_free: |
| 167 | kfree(temp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | return count; |
| 169 | } |
| 170 | |
| 171 | static int mmap(struct file *file, struct vm_area_struct *vma) |
| 172 | { |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 173 | struct bin_buffer *bb = file->private_data; |
Tejun Heo | 3e51903 | 2007-06-14 03:45:15 +0900 | [diff] [blame] | 174 | struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; |
Tejun Heo | b1fc3d6 | 2007-09-20 16:05:11 +0900 | [diff] [blame] | 175 | struct bin_attribute *attr = attr_sd->s_bin_attr.bin_attr; |
| 176 | struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 177 | int rc; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 178 | |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 179 | mutex_lock(&bb->mutex); |
Tejun Heo | 0ab6608 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 180 | |
| 181 | /* need attr_sd for attr, its parent for kobj */ |
| 182 | if (!sysfs_get_active_two(attr_sd)) |
| 183 | return -ENODEV; |
| 184 | |
| 185 | rc = -EINVAL; |
| 186 | if (attr->mmap) |
| 187 | rc = attr->mmap(kobj, attr, vma); |
| 188 | |
| 189 | if (rc == 0 && !bb->mmapped) |
| 190 | bb->mmapped = 1; |
| 191 | else |
| 192 | sysfs_put_active_two(attr_sd); |
| 193 | |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 194 | mutex_unlock(&bb->mutex); |
| 195 | |
| 196 | return rc; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | } |
| 198 | |
| 199 | static int open(struct inode * inode, struct file * file) |
| 200 | { |
Tejun Heo | 3e51903 | 2007-06-14 03:45:15 +0900 | [diff] [blame] | 201 | struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; |
Tejun Heo | b1fc3d6 | 2007-09-20 16:05:11 +0900 | [diff] [blame] | 202 | struct bin_attribute *attr = attr_sd->s_bin_attr.bin_attr; |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 203 | struct bin_buffer *bb = NULL; |
Tejun Heo | 0ab6608 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 204 | int error; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 | |
Tejun Heo | 078ce64 | 2007-09-20 16:05:10 +0900 | [diff] [blame] | 206 | /* binary file operations requires both @sd and its parent */ |
| 207 | if (!sysfs_get_active_two(attr_sd)) |
Tejun Heo | 0ab6608 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 208 | return -ENODEV; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 209 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | error = -EACCES; |
| 211 | if ((file->f_mode & FMODE_WRITE) && !(attr->write || attr->mmap)) |
Tejun Heo | 7b59575 | 2007-06-14 03:45:17 +0900 | [diff] [blame] | 212 | goto err_out; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | if ((file->f_mode & FMODE_READ) && !(attr->read || attr->mmap)) |
Tejun Heo | 7b59575 | 2007-06-14 03:45:17 +0900 | [diff] [blame] | 214 | goto err_out; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 215 | |
| 216 | error = -ENOMEM; |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 217 | bb = kzalloc(sizeof(*bb), GFP_KERNEL); |
| 218 | if (!bb) |
Tejun Heo | 7b59575 | 2007-06-14 03:45:17 +0900 | [diff] [blame] | 219 | goto err_out; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 220 | |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 221 | bb->buffer = kmalloc(PAGE_SIZE, GFP_KERNEL); |
| 222 | if (!bb->buffer) |
Tejun Heo | 7b59575 | 2007-06-14 03:45:17 +0900 | [diff] [blame] | 223 | goto err_out; |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 224 | |
| 225 | mutex_init(&bb->mutex); |
| 226 | file->private_data = bb; |
| 227 | |
Tejun Heo | 078ce64 | 2007-09-20 16:05:10 +0900 | [diff] [blame] | 228 | /* open succeeded, put active references */ |
| 229 | sysfs_put_active_two(attr_sd); |
Tejun Heo | 0ab6608 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 230 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | |
Tejun Heo | 7b59575 | 2007-06-14 03:45:17 +0900 | [diff] [blame] | 232 | err_out: |
Tejun Heo | 078ce64 | 2007-09-20 16:05:10 +0900 | [diff] [blame] | 233 | sysfs_put_active_two(attr_sd); |
Tejun Heo | 0ab6608 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 234 | kfree(bb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 235 | return error; |
| 236 | } |
| 237 | |
| 238 | static int release(struct inode * inode, struct file * file) |
| 239 | { |
Tejun Heo | 3e51903 | 2007-06-14 03:45:15 +0900 | [diff] [blame] | 240 | struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 241 | struct bin_buffer *bb = file->private_data; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 242 | |
Tejun Heo | 0ab6608 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 243 | if (bb->mmapped) |
| 244 | sysfs_put_active_two(attr_sd); |
Tejun Heo | eb36165 | 2007-06-14 03:45:16 +0900 | [diff] [blame] | 245 | kfree(bb->buffer); |
| 246 | kfree(bb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 247 | return 0; |
| 248 | } |
| 249 | |
Arjan van de Ven | 4b6f5d2 | 2006-03-28 01:56:42 -0800 | [diff] [blame] | 250 | const struct file_operations bin_fops = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 251 | .read = read, |
| 252 | .write = write, |
| 253 | .mmap = mmap, |
| 254 | .llseek = generic_file_llseek, |
| 255 | .open = open, |
| 256 | .release = release, |
| 257 | }; |
| 258 | |
| 259 | /** |
| 260 | * sysfs_create_bin_file - create binary file for object. |
| 261 | * @kobj: object. |
| 262 | * @attr: attribute descriptor. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 263 | */ |
| 264 | |
| 265 | int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr) |
| 266 | { |
Tejun Heo | 608e266 | 2007-06-14 04:27:22 +0900 | [diff] [blame] | 267 | BUG_ON(!kobj || !kobj->sd || !attr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | |
Tejun Heo | 608e266 | 2007-06-14 04:27:22 +0900 | [diff] [blame] | 269 | return sysfs_add_file(kobj->sd, &attr->attr, SYSFS_KOBJ_BIN_ATTR); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 270 | } |
| 271 | |
| 272 | |
| 273 | /** |
| 274 | * sysfs_remove_bin_file - remove binary file for object. |
| 275 | * @kobj: object. |
| 276 | * @attr: attribute descriptor. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | */ |
| 278 | |
Randy.Dunlap | 995982c | 2006-07-10 23:05:25 -0700 | [diff] [blame] | 279 | void sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 280 | { |
Alan Stern | 5f1835d | 2007-08-16 16:13:06 -0400 | [diff] [blame] | 281 | sysfs_hash_and_remove(kobj->sd, attr->attr.name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 282 | } |
| 283 | |
| 284 | EXPORT_SYMBOL_GPL(sysfs_create_bin_file); |
| 285 | EXPORT_SYMBOL_GPL(sysfs_remove_bin_file); |