Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 322984
b: refs/heads/master
c: 3604885
h: refs/heads/master
v: v3
  • Loading branch information
David Rientjes authored and Linus Torvalds committed Sep 21, 2012
1 parent 625a1f7 commit 8a66d12
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c46de2263f42fb4bbde411b9126f471e9343cb22
refs/heads/master: 36048853c5257a7b6df346b83758ffa776a59e9f
33 changes: 11 additions & 22 deletions trunk/fs/debugfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,12 +526,6 @@ struct array_data {
u32 elements;
};

static int u32_array_open(struct inode *inode, struct file *file)
{
file->private_data = NULL;
return nonseekable_open(inode, file);
}

static size_t format_array(char *buf, size_t bufsize, const char *fmt,
u32 *array, u32 array_size)
{
Expand Down Expand Up @@ -573,26 +567,21 @@ static char *format_array_alloc(const char *fmt, u32 *array,
return ret;
}

static ssize_t u32_array_read(struct file *file, char __user *buf, size_t len,
loff_t *ppos)
static int u32_array_open(struct inode *inode, struct file *file)
{
struct inode *inode = file->f_path.dentry->d_inode;
struct array_data *data = inode->i_private;
size_t size;

if (*ppos == 0) {
if (file->private_data) {
kfree(file->private_data);
file->private_data = NULL;
}

file->private_data = format_array_alloc("%u", data->array,
data->elements);
}
file->private_data = format_array_alloc("%u", data->array,
data->elements);
if (!file->private_data)
return -ENOMEM;
return nonseekable_open(inode, file);
}

size = 0;
if (file->private_data)
size = strlen(file->private_data);
static ssize_t u32_array_read(struct file *file, char __user *buf, size_t len,
loff_t *ppos)
{
size_t size = strlen(file->private_data);

return simple_read_from_buffer(buf, len, ppos,
file->private_data, size);
Expand Down

0 comments on commit 8a66d12

Please sign in to comment.