[Ocfs2-tools-devel] [PATCH 1/1] Ocfs2-tools: Let debugfs.ocfs2 support LARGEFILE.

Tristan Ye tristan.ye at oracle.com
Mon Feb 23 17:42:34 PST 2009


Support 64bits I/O on 32bits linux for debugfs.ocfs2(dump) by
following the existing code style.

Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
---
 debugfs.ocfs2/commands.c     |    2 +-
 debugfs.ocfs2/include/main.h |    1 +
 debugfs.ocfs2/utils.c        |    2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/debugfs.ocfs2/commands.c b/debugfs.ocfs2/commands.c
index 7f2e4bc..0dea23f 100644
--- a/debugfs.ocfs2/commands.c
+++ b/debugfs.ocfs2/commands.c
@@ -1129,7 +1129,7 @@ static void do_dump (char **args)
 		return ;
 	}
 
-	fd = open(out_fn, O_CREAT | O_WRONLY | O_TRUNC, 0666);
+	fd = open64(out_fn, O_CREAT | O_WRONLY | O_TRUNC, 0666);
 	if (fd < 0) {
 		com_err(args[0], errno, "'%s'", out_fn);
 		return ;
diff --git a/debugfs.ocfs2/include/main.h b/debugfs.ocfs2/include/main.h
index b7a1583..3df01d4 100644
--- a/debugfs.ocfs2/include/main.h
+++ b/debugfs.ocfs2/include/main.h
@@ -26,6 +26,7 @@
 #define __MAIN_H__
 
 #define _GNU_SOURCE
+#define _LARGEFILE64_SOURCE
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/debugfs.ocfs2/utils.c b/debugfs.ocfs2/utils.c
index 3a876d4..b1494fa 100644
--- a/debugfs.ocfs2/utils.c
+++ b/debugfs.ocfs2/utils.c
@@ -725,7 +725,7 @@ errcode_t rdump_inode(ocfs2_filesys *fs, uint64_t blkno, const char *name,
 	} else if (S_ISREG(di->i_mode)) {
 		if (verbose)
 			fprintf(stdout, "%s\n", fullname);
-		fd = open(fullname, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU);
+		fd = open64(fullname, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU);
 		if (fd == -1) {
 			com_err(gbls.cmd, errno, "while opening file %s",
 				fullname);
-- 
1.5.5




More information about the Ocfs2-tools-devel mailing list