summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-09-12 12:19:21 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2013-09-12 12:19:21 +0200
commit63673d97ecd9de19b5e13dea61d2900119373b81 (patch)
tree5d80b5596f9fda541c6f5cf3758668f72a32c63d
parentdd2eda59bb6402fc23044057100d4373f9f5d002 (diff)
TestDisk: use read_blk64() and write_blk64() to deal with ext4 64-bits blocks
-rwxr-xr-xcompile.sh10
-rw-r--r--configure.ac4
-rw-r--r--src/ext2_dir.c24
3 files changed, 29 insertions, 9 deletions
diff --git a/compile.sh b/compile.sh
index fa4e877..3ff8ad5 100755
--- a/compile.sh
+++ b/compile.sh
@@ -36,28 +36,28 @@ case "$crosscompile_target" in
*-msdosdjgpp)
VER_LIBNTFS3G=
VER_NTFSPROGS="2.0.0"
- VER_E2FSPROGS=1.41.8
+ VER_E2FSPROGS=1.42.8
;;
*-cygwin)
VER_LIBNTFS3G=
VER_NTFSPROGS="2.0.0"
- VER_E2FSPROGS=1.42.2
+ VER_E2FSPROGS=1.42.8
export PKG_CONFIG_SYSROOT_DIR=/usr/i386-pc-cygwin/
;;
*-mingw32)
VER_LIBNTFS3G=
VER_NTFSPROGS="2.0.0"
- VER_E2FSPROGS=1.42.2
+ VER_E2FSPROGS=
;;
i686-apple-darwin9|powerpc-apple-darwin)
VER_LIBNTFS3G="2011.3.28-RC"
VER_NTFSPROGS=
- VER_E2FSPROGS=1.41.8
+ VER_E2FSPROGS=1.42.8
;;
*)
VER_LIBNTFS3G="2011.3.28-RC"
VER_NTFSPROGS=
- VER_E2FSPROGS=1.42.2
+ VER_E2FSPROGS=1.42.8
;;
esac
prefix=/usr/$crosscompile_target
diff --git a/configure.ac b/configure.ac
index ed7db70..84ed5b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -469,7 +469,9 @@ AC_CHECK_MEMBERS([dal_t.error],,,[#include <dal/dal.h>])
AC_CHECK_MEMBERS([dal_t.entity],,,[#include <dal/dal.h>])
AC_CHECK_MEMBERS([dal_t.name],,,[#include <dal/dal.h>])
AC_CHECK_MEMBERS([struct dal_ops.dev],,,[#include <dal/dal.h>])
-AC_CHECK_MEMBERS([struct struct_io_manager.set_option],,,[
+AC_CHECK_MEMBERS([struct struct_io_manager.set_option,
+struct struct_io_manager.read_blk64,
+struct struct_io_manager.write_blk64],,,[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
diff --git a/src/ext2_dir.c b/src/ext2_dir.c
index ee965e5..f436abe 100644
--- a/src/ext2_dir.c
+++ b/src/ext2_dir.c
@@ -64,6 +64,8 @@ static errcode_t my_set_blksize(io_channel channel, int blksize);
static errcode_t my_read_blk(io_channel channel, unsigned long block, int count, void *buf);
static errcode_t my_write_blk(io_channel channel, unsigned long block, int count, const void *buf);
static errcode_t my_flush(io_channel channel);
+static errcode_t my_read_blk64(io_channel channel, unsigned long long block, int count, void *buf);
+static errcode_t my_write_blk64(io_channel channel, unsigned long long block, int count, const void *buf);
static io_channel alloc_io_channel(disk_t *disk_car,my_data_t *my_data);
static void dir_partition_ext2_close(dir_data_t *dir_data);
@@ -80,7 +82,13 @@ static struct struct_io_manager my_struct_manager = {
.flush = my_flush,
.write_byte= NULL,
#ifdef HAVE_STRUCT_STRUCT_IO_MANAGER_SET_OPTION
- .set_option= NULL
+ .set_option= NULL,
+#endif
+#ifdef HAVE_STRUCT_STRUCT_IO_MANAGER_READ_BLK64
+ .read_blk64=my_read_blk64,
+#endif
+#ifdef HAVE_STRUCT_STRUCT_IO_MANAGER_WRITE_BLK64
+ .write_blk64=my_write_blk64,
#endif
};
static int ext2_dir(disk_t *disk_car, const partition_t *partition, dir_data_t *dir_data, const unsigned long int cluster, file_info_t *dir_list);
@@ -153,7 +161,7 @@ static errcode_t my_set_blksize(io_channel channel, int blksize)
return 0;
}
-static errcode_t my_read_blk(io_channel channel, unsigned long block, int count, void *buf)
+static errcode_t my_read_blk64(io_channel channel, unsigned long long block, int count, void *buf)
{
ssize_t size;
const my_data_t *my_data=(const my_data_t*)channel->private_data;
@@ -173,7 +181,12 @@ static errcode_t my_read_blk(io_channel channel, unsigned long block, int count,
return 0;
}
-static errcode_t my_write_blk(io_channel channel, unsigned long block, int count, const void *buf)
+static errcode_t my_read_blk(io_channel channel, unsigned long block, int count, void *buf)
+{
+ return my_read_blk64(channel, block, count, buf);
+}
+
+static errcode_t my_write_blk64(io_channel channel, unsigned long long block, int count, const void *buf)
{
EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
#if 1
@@ -188,6 +201,11 @@ static errcode_t my_write_blk(io_channel channel, unsigned long block, int count
#endif
}
+static errcode_t my_write_blk(io_channel channel, unsigned long block, int count, const void *buf)
+{
+ return my_write_blk64(channel, block, count, buf);
+}
+
static errcode_t my_flush(io_channel channel)
{
return 0;