Whamcloud - gitweb
git://git.whamcloud.com
/
tools
/
e2fsprogs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
AOSP: Suppress warnings/errors for clang+mingw
[tools/e2fsprogs.git]
/
lib
/
ext2fs
/
bmove.c
diff --git
a/lib/ext2fs/bmove.c
b/lib/ext2fs/bmove.c
index
0a5a80c
..
e2ea405
100644
(file)
--- a/
lib/ext2fs/bmove.c
+++ b/
lib/ext2fs/bmove.c
@@
-2,10
+2,15
@@
* bmove.c --- Move blocks around to make way for a particular
* filesystem structure.
*
* bmove.c --- Move blocks around to make way for a particular
* filesystem structure.
*
- * Copyright (C) 1997 Theodore Ts'o. This file may be redistributed
- * under the terms of the GNU Public License.
+ * Copyright (C) 1997 Theodore Ts'o.
+ *
+ * %Begin-Header%
+ * 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
#include <stdio.h>
#include <string.h>
#if HAVE_UNISTD_H
@@
-18,11
+23,11
@@
#include <sys/time.h>
#endif
#include <sys/time.h>
#endif
-#include
<linux/ext2_fs.h>
-#include "ext2fs
/ext2fs
.h"
+#include
"ext2_fs.h"
+#include "ext2fs
P
.h"
struct process_block_struct {
struct process_block_struct {
-
ino_t
ino;
+
ext2_ino_t
ino;
struct ext2_inode * inode;
ext2fs_block_bitmap reserve;
ext2fs_block_bitmap alloc_map;
struct ext2_inode * inode;
ext2fs_block_bitmap reserve;
ext2fs_block_bitmap alloc_map;
@@
-32,52
+37,55
@@
struct process_block_struct {
int flags;
};
int flags;
};
-static int process_block(ext2_filsys fs, blk_t *block_nr,
-
int blockcnt, blk
_t ref_block,
- int ref_offset, void *priv
ate
)
+static int process_block(ext2_filsys fs, blk
64
_t *block_nr,
+
e2_blkcnt_t blockcnt, blk64
_t ref_block,
+ int ref_offset, void *priv
_data
)
{
{
- struct process_block_struct *pb
= private
;
+ struct process_block_struct *pb;
errcode_t retval;
int ret;
errcode_t retval;
int ret;
- blk
_t
block, orig;
+ blk
64_t
block, orig;
+ pb = (struct process_block_struct *) priv_data;
block = orig = *block_nr;
ret = 0;
block = orig = *block_nr;
ret = 0;
-
+
/*
* Let's see if this is one which we need to relocate
*/
/*
* Let's see if this is one which we need to relocate
*/
- if (ext2fs_test_block_bitmap(pb->reserve, block)) {
+ if (ext2fs_test_block_bitmap
2
(pb->reserve, block)) {
do {
do {
- if (++block >=
fs->super->s_blocks_count
)
+ if (++block >=
ext2fs_blocks_count(fs->super)
)
block = fs->super->s_first_data_block;
if (block == orig) {
pb->error = EXT2_ET_BLOCK_ALLOC_FAIL;
return BLOCK_ABORT;
}
block = fs->super->s_first_data_block;
if (block == orig) {
pb->error = EXT2_ET_BLOCK_ALLOC_FAIL;
return BLOCK_ABORT;
}
- } while (ext2fs_test_block_bitmap(pb->reserve, block) ||
- ext2fs_test_block_bitmap(pb->alloc_map, block));
+ } while (ext2fs_test_block_bitmap
2
(pb->reserve, block) ||
+ ext2fs_test_block_bitmap
2
(pb->alloc_map, block));
- retval = io_channel_read_blk(fs->io, orig, 1, pb->buf);
+ retval = io_channel_read_blk
64
(fs->io, orig, 1, pb->buf);
if (retval) {
pb->error = retval;
return BLOCK_ABORT;
}
if (retval) {
pb->error = retval;
return BLOCK_ABORT;
}
- retval = io_channel_write_blk(fs->io, block, 1, pb->buf);
+ retval = io_channel_write_blk
64
(fs->io, block, 1, pb->buf);
if (retval) {
pb->error = retval;
return BLOCK_ABORT;
}
*block_nr = block;
if (retval) {
pb->error = retval;
return BLOCK_ABORT;
}
*block_nr = block;
- ext2fs_mark_block_bitmap(pb->alloc_map, block);
+ ext2fs_mark_block_bitmap
2
(pb->alloc_map, block);
ret = BLOCK_CHANGED;
if (pb->flags & EXT2_BMOVE_DEBUG)
ret = BLOCK_CHANGED;
if (pb->flags & EXT2_BMOVE_DEBUG)
- printf("ino=%ld, blockcnt=%d, %d->%d\n", pb->ino,
- blockcnt, orig, block);
+ printf("ino=%u, blockcnt=%lld, %llu->%llu\n",
+ (unsigned) pb->ino, blockcnt,
+ (unsigned long long) orig,
+ (unsigned long long) block);
}
if (pb->add_dir) {
}
if (pb->add_dir) {
- retval = ext2fs_add_dir_block(fs->dblist, pb->ino,
- block, blockcnt);
+ retval = ext2fs_add_dir_block
2
(fs->dblist, pb->ino,
+
block, blockcnt);
if (retval) {
pb->error = retval;
ret |= BLOCK_ABORT;
if (retval) {
pb->error = retval;
ret |= BLOCK_ABORT;
@@
-91,13
+99,13
@@
errcode_t ext2fs_move_blocks(ext2_filsys fs,
ext2fs_block_bitmap alloc_map,
int flags)
{
ext2fs_block_bitmap alloc_map,
int flags)
{
-
ino_t
ino;
+
ext2_ino_t
ino;
struct ext2_inode inode;
errcode_t retval;
struct process_block_struct pb;
ext2_inode_scan scan;
char *block_buf;
struct ext2_inode inode;
errcode_t retval;
struct process_block_struct pb;
ext2_inode_scan scan;
char *block_buf;
-
+
retval = ext2fs_open_inode_scan(fs, 0, &scan);
if (retval)
return retval;
retval = ext2fs_open_inode_scan(fs, 0, &scan);
if (retval)
return retval;
@@
-106,8
+114,8
@@
errcode_t ext2fs_move_blocks(ext2_filsys fs,
pb.error = 0;
pb.alloc_map = alloc_map ? alloc_map : fs->block_map;
pb.flags = flags;
pb.error = 0;
pb.alloc_map = alloc_map ? alloc_map : fs->block_map;
pb.flags = flags;
-
- retval = ext2fs_get_
mem(fs->blocksize * 4, (void **)
&block_buf);
+
+ retval = ext2fs_get_
array(4, fs->blocksize,
&block_buf);
if (retval)
return retval;
pb.buf = block_buf + fs->blocksize * 3;
if (retval)
return retval;
pb.buf = block_buf + fs->blocksize * 3;
@@
-130,20
+138,20
@@
errcode_t ext2fs_move_blocks(ext2_filsys fs,
retval = ext2fs_get_next_inode(scan, &ino, &inode);
if (retval)
return retval;
retval = ext2fs_get_next_inode(scan, &ino, &inode);
if (retval)
return retval;
-
+
while (ino) {
if ((inode.i_links_count == 0) ||
while (ino) {
if ((inode.i_links_count == 0) ||
- !ext2fs_inode_has_valid_blocks
(
&inode))
+ !ext2fs_inode_has_valid_blocks
2(fs,
&inode))
goto next;
goto next;
-
+
pb.ino = ino;
pb.inode = &inode;
pb.add_dir = (LINUX_S_ISDIR(inode.i_mode) &&
flags & EXT2_BMOVE_GET_DBLIST);
pb.ino = ino;
pb.inode = &inode;
pb.add_dir = (LINUX_S_ISDIR(inode.i_mode) &&
flags & EXT2_BMOVE_GET_DBLIST);
- retval = ext2fs_block_iterate
2
(fs, ino, 0, block_buf,
- process_block, &pb);
+ retval = ext2fs_block_iterate
3
(fs, ino, 0, block_buf,
+
process_block, &pb);
if (retval)
return retval;
if (pb.error)
if (retval)
return retval;
if (pb.error)