[PATCH] Suppress deprecated f_maxcount in 'struct file'

From: Eric Dumazet
Date: Fri Aug 19 2005 - 17:01:33 EST


Andrew Morton a écrit :
Eric Dumazet <dada1@xxxxxxxxxxxxx> wrote:

Considering :

[root@dada1 linux-2.6.13-rc6]# find .|xargs grep f_maxcount
./fs/file_table.c: f->f_maxcount = INT_MAX;
./fs/read_write.c: if (unlikely(count > file->f_maxcount))
./include/linux/fs.h: size_t f_maxcount;


I was wondering if f_maxcount has a real use these days...


No, I guess we can just stick a hard-wired INT_MAX in there.



OK here is a patch doing the hard wiring then :)

* struct file cleanup : f_maxcount has an unique value (INT_MAX). Just use the hard-wired value.

Signed-off-by: Eric Dumazet <dada1@xxxxxxxxxxxxx>

diff -Nru linux-2.6.13-rc6/fs/file_table.c linux-2.6.13-rc6-ed/fs/file_table.c
--- linux-2.6.13-rc6/fs/file_table.c 2005-08-07 20:18:56.000000000 +0200
+++ linux-2.6.13-rc6-ed/fs/file_table.c 2005-08-19 23:51:20.000000000 +0200
@@ -89,7 +89,6 @@
rwlock_init(&f->f_owner.lock);
/* f->f_version: 0 */
INIT_LIST_HEAD(&f->f_list);
- f->f_maxcount = INT_MAX;
return f;

over:
diff -Nru linux-2.6.13-rc6/fs/read_write.c linux-2.6.13-rc6-ed/fs/read_write.c
--- linux-2.6.13-rc6/fs/read_write.c 2005-08-07 20:18:56.000000000 +0200
+++ linux-2.6.13-rc6-ed/fs/read_write.c 2005-08-19 23:51:20.000000000 +0200
@@ -188,7 +188,7 @@
struct inode *inode;
loff_t pos;

- if (unlikely(count > file->f_maxcount))
+ if (unlikely(count > INT_MAX))
goto Einval;
pos = *ppos;
if (unlikely((pos < 0) || (loff_t) (pos + count) < 0))
diff -Nru linux-2.6.13-rc6/include/linux/fs.h linux-2.6.13-rc6-ed/include/linux/fs.h
--- linux-2.6.13-rc6/include/linux/fs.h 2005-08-07 20:18:56.000000000 +0200
+++ linux-2.6.13-rc6-ed/include/linux/fs.h 2005-08-19 23:51:20.000000000 +0200
@@ -594,7 +594,6 @@
unsigned int f_uid, f_gid;
struct file_ra_state f_ra;

- size_t f_maxcount;
unsigned long f_version;
void *f_security;