]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
debugfs: fix logdump to work on files > 2GB
authorTheodore Ts'o <tytso@mit.edu>
Mon, 13 Jun 2016 01:42:47 +0000 (21:42 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 13 Jun 2016 01:42:47 +0000 (21:42 -0400)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debugfs/logdump.c

index bab0ce9702e9b67e48f2904c173a678dbb7eba90..ee3201a6d5f396ac29dcce0cabaa3dce2590fe49 100644 (file)
@@ -277,7 +277,7 @@ print_usage:
 
 
 static int read_journal_block(const char *cmd, struct journal_source *source,
-                             off_t offset, char *buf, unsigned int size)
+                             ext2_loff_t offset, char *buf, unsigned int size)
 {
        int retval;
        unsigned int got;
@@ -295,8 +295,8 @@ static int read_journal_block(const char *cmd, struct journal_source *source,
                got = retval;
                retval = 0;
        } else {
-               retval = ext2fs_file_lseek(source->file, offset,
-                                          EXT2_SEEK_SET, NULL);
+               retval = ext2fs_file_llseek(source->file, offset,
+                                           EXT2_SEEK_SET, NULL);
                if (retval) {
                seek_err:
                        com_err(cmd, retval, "while seeking in reading journal");
@@ -346,7 +346,6 @@ static void dump_journal(char *cmdname, FILE *out_file,
        int                     retval;
        __u32                   magic, sequence, blocktype;
        journal_header_t        *header;
-
        tid_t                   transaction;
        unsigned int            blocknr = 0;
 
@@ -378,8 +377,8 @@ static void dump_journal(char *cmdname, FILE *out_file,
        }
 
        /* Next, read the journal superblock */
-
-       retval = read_journal_block(cmdname, source, blocknr*blocksize,
+       retval = read_journal_block(cmdname, source,
+                                   ((ext2_loff_t) blocknr) * blocksize,
                                    jsb_buffer, 1024);
        if (retval)
                return;
@@ -407,8 +406,8 @@ static void dump_journal(char *cmdname, FILE *out_file,
 
        while (1) {
                retval = read_journal_block(cmdname, source,
-                                           blocknr*blocksize, buf,
-                                           blocksize);
+                               ((ext2_loff_t) blocknr) * blocksize,
+                               buf, blocksize);
                if (retval)
                        return;
 
@@ -646,7 +645,7 @@ static void dump_metadata_block(FILE *out_file, struct journal_source *source,
                return;
 
        retval = read_journal_block("logdump", source,
-                                   blocksize * log_blocknr,
+                                   ((ext2_loff_t) log_blocknr) * blocksize,
                                    buf, blocksize);
        if (retval)
                return;