Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 59114
b: refs/heads/master
c: 93e3cd8
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo authored and Greg Kroah-Hartman committed Jul 11, 2007
1 parent 282b518 commit 0d41a4f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 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: 7a23ad44047b1084a032bc0d127fe08af024593a
refs/heads/master: 93e3cd8270d036953120eca83610f95d3f7374c6
23 changes: 9 additions & 14 deletions trunk/fs/sysfs/bin.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,13 @@ fill_read(struct dentry *dentry, char *buffer, loff_t off, size_t count)
}

static ssize_t
read(struct file * file, char __user * userbuf, size_t count, loff_t * off)
read(struct file *file, char __user *userbuf, size_t bytes, loff_t *off)
{
char *buffer = file->private_data;
struct dentry *dentry = file->f_path.dentry;
int size = dentry->d_inode->i_size;
loff_t offs = *off;
int ret;

if (count > PAGE_SIZE)
count = PAGE_SIZE;
int count = min_t(size_t, bytes, PAGE_SIZE);

if (size) {
if (offs > size)
Expand All @@ -51,15 +48,14 @@ read(struct file * file, char __user * userbuf, size_t count, loff_t * off)
count = size - offs;
}

ret = fill_read(dentry, buffer, offs, count);
if (ret < 0)
return ret;
count = ret;
count = fill_read(dentry, buffer, offs, count);
if (count < 0)
return count;

if (copy_to_user(userbuf, buffer, count))
return -EFAULT;

pr_debug("offs = %lld, *off = %lld, count = %zd\n", offs, *off, count);
pr_debug("offs = %lld, *off = %lld, count = %d\n", offs, *off, count);

*off = offs + count;

Expand All @@ -78,16 +74,15 @@ flush_write(struct dentry *dentry, char *buffer, loff_t offset, size_t count)
return attr->write(kobj, buffer, offset, count);
}

static ssize_t write(struct file * file, const char __user * userbuf,
size_t count, loff_t * off)
static ssize_t write(struct file *file, const char __user *userbuf,
size_t bytes, loff_t *off)
{
char *buffer = file->private_data;
struct dentry *dentry = file->f_path.dentry;
int size = dentry->d_inode->i_size;
loff_t offs = *off;
int count = min_t(size_t, bytes, PAGE_SIZE);

if (count > PAGE_SIZE)
count = PAGE_SIZE;
if (size) {
if (offs > size)
return 0;
Expand Down

0 comments on commit 0d41a4f

Please sign in to comment.