diff options
author | Milind Arun Choudhary <milindchoudhary@gmail.com> | 2007-05-08 03:29:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:15:09 -0400 |
commit | 022a1692444cd683ef42f637cc717db4d8fd9378 (patch) | |
tree | 82d8c1360921310f90b81c147b345afad98317f7 /fs/readdir.c | |
parent | 10f8a59813ee8bb41fb1d72ed2ec12a1c9f66da2 (diff) |
ROUND_UP macro cleanup in fs/(select|compat|readdir).c
ROUND_UP macro cleanup use,ALIGN or DIV_ROUND_UP where ever appropriate.
Signed-off-by: Milind Arun Choudhary <milindchoudhary@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/readdir.c')
-rw-r--r-- | fs/readdir.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/readdir.c b/fs/readdir.c index 71bd12b50b4c..efe52e676577 100644 --- a/fs/readdir.c +++ b/fs/readdir.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * Copyright (C) 1995 Linus Torvalds | 4 | * Copyright (C) 1995 Linus Torvalds |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/kernel.h> | ||
7 | #include <linux/module.h> | 8 | #include <linux/module.h> |
8 | #include <linux/time.h> | 9 | #include <linux/time.h> |
9 | #include <linux/mm.h> | 10 | #include <linux/mm.h> |
@@ -51,7 +52,6 @@ EXPORT_SYMBOL(vfs_readdir); | |||
51 | * case (the low-level handlers don't need to care about this). | 52 | * case (the low-level handlers don't need to care about this). |
52 | */ | 53 | */ |
53 | #define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de))) | 54 | #define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de))) |
54 | #define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1)) | ||
55 | 55 | ||
56 | #ifdef __ARCH_WANT_OLD_READDIR | 56 | #ifdef __ARCH_WANT_OLD_READDIR |
57 | 57 | ||
@@ -146,7 +146,7 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset, | |||
146 | struct linux_dirent __user * dirent; | 146 | struct linux_dirent __user * dirent; |
147 | struct getdents_callback * buf = (struct getdents_callback *) __buf; | 147 | struct getdents_callback * buf = (struct getdents_callback *) __buf; |
148 | unsigned long d_ino; | 148 | unsigned long d_ino; |
149 | int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 2); | 149 | int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 2, sizeof(long)); |
150 | 150 | ||
151 | buf->error = -EINVAL; /* only used if we fail.. */ | 151 | buf->error = -EINVAL; /* only used if we fail.. */ |
152 | if (reclen > buf->count) | 152 | if (reclen > buf->count) |
@@ -219,8 +219,6 @@ out: | |||
219 | return error; | 219 | return error; |
220 | } | 220 | } |
221 | 221 | ||
222 | #define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1)) | ||
223 | |||
224 | struct getdents_callback64 { | 222 | struct getdents_callback64 { |
225 | struct linux_dirent64 __user * current_dir; | 223 | struct linux_dirent64 __user * current_dir; |
226 | struct linux_dirent64 __user * previous; | 224 | struct linux_dirent64 __user * previous; |
@@ -233,7 +231,7 @@ static int filldir64(void * __buf, const char * name, int namlen, loff_t offset, | |||
233 | { | 231 | { |
234 | struct linux_dirent64 __user *dirent; | 232 | struct linux_dirent64 __user *dirent; |
235 | struct getdents_callback64 * buf = (struct getdents_callback64 *) __buf; | 233 | struct getdents_callback64 * buf = (struct getdents_callback64 *) __buf; |
236 | int reclen = ROUND_UP64(NAME_OFFSET(dirent) + namlen + 1); | 234 | int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, sizeof(u64)); |
237 | 235 | ||
238 | buf->error = -EINVAL; /* only used if we fail.. */ | 236 | buf->error = -EINVAL; /* only used if we fail.. */ |
239 | if (reclen > buf->count) | 237 | if (reclen > buf->count) |