Whamcloud - gitweb
e2fsck: add support for xattrs in external inodes
[tools/e2fsprogs.git] / lib / ext2fs / inode.c
index 1e18195..77fc447 100644 (file)
@@ -4,11 +4,12 @@
  * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o.
  *
  * %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
@@ -156,9 +157,8 @@ errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks,
                         (fs->blocksize / scan->inode_size - 1)) *
                        scan->inode_size / fs->blocksize;
        }
-       retval = ext2fs_get_array(scan->inode_buffer_blocks,
-                                         fs->blocksize,
-                               &scan->inode_buffer);
+       retval = io_channel_alloc_buf(fs->io, scan->inode_buffer_blocks,
+                                     &scan->inode_buffer);
        scan->done_group = 0;
        scan->done_group_data = 0;
        scan->bad_block_ptr = 0;
@@ -523,7 +523,8 @@ errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ext2_ino_t *ino,
 errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino,
                                 struct ext2_inode * inode, int bufsize)
 {
-       unsigned long   group, block, block_nr, offset;
+       blk64_t         block_nr;
+       unsigned long   group, block, offset;
        char            *ptr;
        errcode_t       retval;
        int             clen, i, inodes_per_block, length;
@@ -629,7 +630,8 @@ errcode_t ext2fs_read_inode(ext2_filsys fs, ext2_ino_t ino,
 errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino,
                                  struct ext2_inode * inode, int bufsize)
 {
-       unsigned long group, block, block_nr, offset;
+       blk64_t block_nr;
+       unsigned long group, block, offset;
        errcode_t retval = 0;
        struct ext2_inode_large temp_inode, *w_inode;
        char *ptr;
@@ -670,8 +672,10 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino,
 
        if (length > (int) sizeof(struct ext2_inode_large)) {
                w_inode = malloc(length);
-               if (!w_inode)
-                       return ENOMEM;
+               if (!w_inode) {
+                       retval = ENOMEM;
+                       goto errout;
+               }
        } else
                w_inode = &temp_inode;
        memset(w_inode, 0, length);