From 71305738698c280bdb7c7754307f20d7425e0d5a Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Sun, 29 Sep 2013 20:22:03 +0400 Subject: [PATCH] read: drop static "done" variable, we already have file_size in inode. --- simple.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/simple.c b/simple.c index de3c6f8..f770836 100644 --- a/simple.c +++ b/simple.c @@ -253,10 +253,6 @@ struct simplefs_inode *simplefs_get_inode(struct super_block *sb, ssize_t simplefs_read(struct file * filp, char __user * buf, size_t len, loff_t * ppos) { - /* Hack to make sure that we answer the read call only once and not loop infinitely. - * We need to implement support for filesize in inode to remove this hack */ - static int done = 0; - /* After the commit dd37978c5 in the upstream linux kernel, * we can use just filp->f_inode instead of the * f->f_path.dentry->d_inode redirection */ @@ -267,11 +263,6 @@ ssize_t simplefs_read(struct file * filp, char __user * buf, size_t len, char *buffer; int nbytes; - if (done) { - done = 0; - return 0; - } - if (*ppos >= inode->file_size) { /* Read request with offset beyond the filesize */ return 0; @@ -300,7 +291,6 @@ ssize_t simplefs_read(struct file * filp, char __user * buf, size_t len, *ppos += nbytes; - done = 1; return nbytes; }