[<prev] [next>] [day] [month] [year] [list]
Message-ID: <AANLkTikEq4f068aZxqWkrTjh85r0j0EqDpFLc1oH8i7t@mail.gmail.com>
Date: Tue, 15 Jun 2010 01:35:08 +0800
From: Liu Aleaxander <aleaxander@...il.com>
To: Alexander Viro <viro@...iv.linux.org.uk>,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: [PATCH] vfs: Use defined macro(like BITPS_PER_BYTE) in fs/file.c
Use defined macro(like BITPS_PER_BYTE) instead of some const number(like 8)
in fs/file.c. So, replace 8 with BITS_PER_BYTE, 8 * sizeof(long) with
BITS_PER_LONG in file fs/file.c. Since the two macro are defined, so use them.
Signed-off-by: Liu Aleaxander <Aleaxander@...il.com>
---
fs/file.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/file.c b/fs/file.c
index 34bb7f7..f4d3d2c 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -278,11 +278,11 @@ static int count_open_files(struct fdtable *fdt)
int i;
/* Find the last open fd */
- for (i = size/(8*sizeof(long)); i > 0; ) {
+ for (i = size/BITS_PER_LONG; i > 0; ) {
if (fdt->open_fds->fds_bits[--i])
break;
}
- i = (i+1) * 8 * sizeof(long);
+ i = (i+1) * BITS_PER_LONG;
return i;
}
@@ -360,9 +360,9 @@ struct files_struct *dup_fd(struct files_struct
*oldf, int *errorp)
new_fds = new_fdt->fd;
memcpy(new_fdt->open_fds->fds_bits,
- old_fdt->open_fds->fds_bits, open_files/8);
+ old_fdt->open_fds->fds_bits, open_files/BITS_PER_BYTE);
memcpy(new_fdt->close_on_exec->fds_bits,
- old_fdt->close_on_exec->fds_bits, open_files/8);
+ old_fdt->close_on_exec->fds_bits, open_files/BITS_PER_BYTE);
for (i = open_files; i != 0; i--) {
struct file *f = *old_fds++;
@@ -388,8 +388,8 @@ struct files_struct *dup_fd(struct files_struct
*oldf, int *errorp)
memset(new_fds, 0, size);
if (new_fdt->max_fds > open_files) {
- int left = (new_fdt->max_fds-open_files)/8;
- int start = open_files / (8 * sizeof(unsigned long));
+ int left = (new_fdt->max_fds-open_files)/BITS_PER_BYTE;
+ int start = open_files / BITS_PER_LONG;
memset(&new_fdt->open_fds->fds_bits[start], 0, left);
memset(&new_fdt->close_on_exec->fds_bits[start], 0, left);
--
1.7.0.1
new_fds = new_fdt->fd;
memcpy(new_fdt->open_fds->fds_bits,
- old_fdt->open_fds->fds_bits, open_files/8);
+ old_fdt->open_fds->fds_bits, open_files/BITS_PER_BYTE);
memcpy(new_fdt->close_on_exec->fds_bits,
- old_fdt->close_on_exec->fds_bits, open_files/8);
+ old_fdt->close_on_exec->fds_bits, open_files/BITS_PER_BYTE);
for (i = open_files; i != 0; i--) {
struct file *f = *old_fds++;
@@ -388,8 +388,8 @@ struct files_struct *dup_fd(struct files_struct
*oldf, int *errorp)
memset(new_fds, 0, size);
if (new_fdt->max_fds > open_files) {
- int left = (new_fdt->max_fds-open_files)/8;
- int start = open_files / (8 * sizeof(unsigned long));
+ int left = (new_fdt->max_fds-open_files)/BITS_PER_BYTE;
+ int start = open_files / BITS_PER_LONG;
memset(&new_fdt->open_fds->fds_bits[start], 0, left);
memset(&new_fdt->close_on_exec->fds_bits[start], 0, left);
--
1.7.0.1
--
Thanks & regards
Liu Aleaxander
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists