Whamcloud - gitweb
debugfs: add filefrag command
[tools/e2fsprogs.git] / lib / ext2fs / imager.c
index c0c10f0..a0fb81e 100644 (file)
@@ -8,11 +8,12 @@
  * functions in this library.  So sue me.
  *
  * %Begin-Header%
- * This file may be redistributed under the terms of the GNU Public
- * License.
+ * This file may be redistributed under the terms of the GNU Library
+ * General Public License, version 2.
  * %End-Header%
  */
 
+#include "config.h"
 #include <stdio.h>
 #include <string.h>
 #if HAVE_UNISTD_H
@@ -62,7 +63,7 @@ errcode_t ext2fs_image_inode_write(ext2_filsys fs, int fd, int flags)
 {
        unsigned int    group, left, c, d;
        char            *buf, *cp;
-       blk_t           blk;
+       blk64_t         blk;
        ssize_t         actual;
        errcode_t       retval;
 
@@ -71,7 +72,7 @@ errcode_t ext2fs_image_inode_write(ext2_filsys fs, int fd, int flags)
                return ENOMEM;
 
        for (group = 0; group < fs->group_desc_count; group++) {
-               blk = fs->group_desc[(unsigned)group].bg_inode_table;
+               blk = ext2fs_inode_table_loc(fs, (unsigned)group);
                if (!blk) {
                        retval = EXT2_ET_MISSING_INODE_TABLE;
                        goto errout;
@@ -81,7 +82,7 @@ errcode_t ext2fs_image_inode_write(ext2_filsys fs, int fd, int flags)
                        c = BUF_BLOCKS;
                        if (c > left)
                                c = left;
-                       retval = io_channel_read_blk(fs->io, blk, c, buf);
+                       retval = io_channel_read_blk64(fs->io, blk, c, buf);
                        if (retval)
                                goto errout;
                        cp = buf;
@@ -136,7 +137,7 @@ errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd,
 {
        unsigned int    group, c, left;
        char            *buf;
-       blk_t           blk;
+       blk64_t         blk;
        ssize_t         actual;
        errcode_t       retval;
 
@@ -145,7 +146,7 @@ errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd,
                return ENOMEM;
 
        for (group = 0; group < fs->group_desc_count; group++) {
-               blk = fs->group_desc[(unsigned)group].bg_inode_table;
+               blk = ext2fs_inode_table_loc(fs, (unsigned)group);
                if (!blk) {
                        retval = EXT2_ET_MISSING_INODE_TABLE;
                        goto errout;
@@ -164,7 +165,7 @@ errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd,
                                retval = EXT2_ET_SHORT_READ;
                                goto errout;
                        }
-                       retval = io_channel_write_blk(fs->io, blk, c, buf);
+                       retval = io_channel_write_blk64(fs->io, blk, c, buf);
                        if (retval)
                                goto errout;