Lines Matching refs:buffer
64 static int fill_read_buffer(struct dentry * dentry, struct configfs_buffer * buffer) in fill_read_buffer() argument
71 if (!buffer->page) in fill_read_buffer()
72 buffer->page = (char *) get_zeroed_page(GFP_KERNEL); in fill_read_buffer()
73 if (!buffer->page) in fill_read_buffer()
76 count = attr->show(item, buffer->page); in fill_read_buffer()
78 buffer->needs_read_fill = 0; in fill_read_buffer()
81 buffer->count = count; in fill_read_buffer()
109 struct configfs_buffer * buffer = file->private_data; in configfs_read_file() local
112 mutex_lock(&buffer->mutex); in configfs_read_file()
113 if (buffer->needs_read_fill) { in configfs_read_file()
114 if ((retval = fill_read_buffer(file->f_path.dentry,buffer))) in configfs_read_file()
118 __func__, count, *ppos, buffer->page); in configfs_read_file()
119 retval = simple_read_from_buffer(buf, count, ppos, buffer->page, in configfs_read_file()
120 buffer->count); in configfs_read_file()
122 mutex_unlock(&buffer->mutex); in configfs_read_file()
138 fill_write_buffer(struct configfs_buffer * buffer, const char __user * buf, size_t count) in fill_write_buffer() argument
142 if (!buffer->page) in fill_write_buffer()
143 buffer->page = (char *)__get_free_pages(GFP_KERNEL, 0); in fill_write_buffer()
144 if (!buffer->page) in fill_write_buffer()
149 error = copy_from_user(buffer->page,buf,count); in fill_write_buffer()
150 buffer->needs_read_fill = 1; in fill_write_buffer()
153 buffer->page[count] = 0; in fill_write_buffer()
170 flush_write_buffer(struct dentry * dentry, struct configfs_buffer * buffer, size_t count) in flush_write_buffer() argument
175 return attr->store(item, buffer->page, count); in flush_write_buffer()
199 struct configfs_buffer * buffer = file->private_data; in configfs_write_file() local
202 mutex_lock(&buffer->mutex); in configfs_write_file()
203 len = fill_write_buffer(buffer, buf, count); in configfs_write_file()
205 len = flush_write_buffer(file->f_path.dentry, buffer, len); in configfs_write_file()
208 mutex_unlock(&buffer->mutex); in configfs_write_file()
216 struct configfs_buffer * buffer; in check_perm() local
256 buffer = kzalloc(sizeof(struct configfs_buffer),GFP_KERNEL); in check_perm()
257 if (!buffer) { in check_perm()
261 mutex_init(&buffer->mutex); in check_perm()
262 buffer->needs_read_fill = 1; in check_perm()
263 buffer->ops = ops; in check_perm()
264 file->private_data = buffer; in check_perm()
290 struct configfs_buffer * buffer = filp->private_data; in configfs_release() local
297 if (buffer) { in configfs_release()
298 if (buffer->page) in configfs_release()
299 free_page((unsigned long)buffer->page); in configfs_release()
300 mutex_destroy(&buffer->mutex); in configfs_release()
301 kfree(buffer); in configfs_release()