[Ocfs2-tools-devel] [PATCH]ocfs2-tools: remove redundent HAVE_OPEN64 code, v2

Coly Li coly.li at suse.de
Fri Feb 27 06:19:39 PST 2009


This version fixed indient format, sorry for the inconvenience.

HAVE_OPEN64 just makes the code use open64() to open large file. Now the HAVE_OPEN64 related code
are used in libocfs2/getsectsize.c and libocfs2/getsize.c. These two files all include
include/ocfs2/ocfs2.h, which declares _LARGEFILE64_SOURCE, and indicates using open64() in sequence.

Therefore, it's proper to call open64() directly and remove the condition code with HAVE_OPEN64.
This patch just does it.

Signed-off-by: Coly Li <coly.li at suse.de>
---
 libocfs2/getsectsize.c |    5 -----
 libocfs2/getsize.c     |    5 -----
 2 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/libocfs2/getsectsize.c b/libocfs2/getsectsize.c
index 937baa6..74cabb7 100644
--- a/libocfs2/getsectsize.c
+++ b/libocfs2/getsectsize.c
@@ -15,7 +15,6 @@
 #define HAVE_UNISTD_H 1
 #define HAVE_ERRNO_H 1
 #define HAVE_LINUX_FD_H 1
-#define HAVE_OPEN64 1

 #define _LARGEFILE_SOURCE
 #define _LARGEFILE64_SOURCE
@@ -46,11 +45,7 @@ errcode_t ocfs2_get_device_sectsize(const char *file, int *sectsize)
 {
 	int	fd;

-#ifdef HAVE_OPEN64
 	fd = open64(file, O_RDONLY);
-#else
-	fd = open(file, O_RDONLY);
-#endif
 	if (fd < 0)
 		return errno;

diff --git a/libocfs2/getsize.c b/libocfs2/getsize.c
index 4176e4b..381e322 100644
--- a/libocfs2/getsize.c
+++ b/libocfs2/getsize.c
@@ -17,7 +17,6 @@
 #define HAVE_UNISTD_H 1
 #define HAVE_ERRNO_H 1
 #define HAVE_LINUX_FD_H 1
-#define HAVE_OPEN64 1
 #define HAVE_SYS_IOCTL_H 1
 #define HAVE_SYS_STAT_H 1
 #define HAVE_FSTAT64 1
@@ -167,11 +166,7 @@ errcode_t ocfs2_get_device_size(const char *file, int blocksize,
 	char ch;
 #endif /* HAVE_SYS_DISKLABEL_H */

-#ifdef HAVE_OPEN64
 	fd = open64(file, O_RDONLY);
-#else
-	fd = open(file, O_RDONLY);
-#endif
 	if (fd < 0)
 		return errno;

-- 
Coly Li
SuSE Labs




More information about the Ocfs2-tools-devel mailing list