summaryrefslogtreecommitdiffstats
path: root/src/analyse.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2011-03-05 18:40:22 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2011-03-05 18:40:22 +0100
commitf2c0943a5a5d2de868a6cfefa8b2c7386b8c5393 (patch)
tree067af5958b2777c67cc7811390d04f0cdc2e0675 /src/analyse.c
parent237b0d53ac0d638ccbd8671293b6695436bad32c (diff)
TestDisk: recover btrfs, a GPL-licensed copy-on-write file system for Linux.
Diffstat (limited to 'src/analyse.c')
-rw-r--r--src/analyse.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/analyse.c b/src/analyse.c
index 5aeae0b..b3c967d 100644
--- a/src/analyse.c
+++ b/src/analyse.c
@@ -2,7 +2,7 @@
File: analyse.c
- Copyright (C) 1998-2007 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 1998-2011 Christophe GRENIER <grenier@cgsecurity.org>
This software is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -32,6 +32,7 @@
#include "analyse.h"
#include "bfs.h"
#include "bsd.h"
+#include "btrfs.h"
#include "cramfs.h"
#include "exfat.h"
#include "ext2.h"
@@ -359,6 +360,7 @@ int search_type_128(unsigned char *buffer, disk_t *disk, partition_t *partition,
const struct reiserfs_super_block *rfs=(const struct reiserfs_super_block *)data;
const struct reiser4_master_sb *rfs4=(const struct reiser4_master_sb *)data;
const struct ufs_super_block *ufs=(const struct ufs_super_block *)data;
+ const struct btrfs_super_block *btrfs=(const struct btrfs_super_block*)data;
/* 64k offset */
/* Test ReiserFS */
if((memcmp(rfs->s_magic,"ReIs",4) == 0 ||
@@ -370,7 +372,24 @@ int search_type_128(unsigned char *buffer, disk_t *disk, partition_t *partition,
le32(ufs->fs_magic)==UFS2_MAGIC || be32(ufs->fs_magic)==UFS2_MAGIC) &&
recover_ufs(disk, ufs, partition, verbose, dump_ind)==0)
return 1;
+ if(memcmp(&btrfs->magic, BTRFS_MAGIC, 8)==0 &&
+ recover_btrfs(disk, btrfs, partition, verbose, dump_ind)==0)
+ return 1;
// if(recover_gfs2(disk,(buffer+0x400),partition,verbose,dump_ind)==0) return 1;
}
return 0;
}
+
+int check_linux(disk_t *disk, partition_t *partition, const int verbose)
+{
+ if(check_JFS(disk, partition)==0 ||
+ check_rfs(disk, partition, verbose)==0 ||
+ check_EXT2(disk, partition, verbose)==0 ||
+ check_cramfs(disk, partition, verbose)==0 ||
+ check_xfs(disk, partition, verbose)==0 ||
+ check_LUKS(disk, partition)==0 ||
+ check_btrfs(disk, partition, verbose)==0)
+ return 0;
+ return 1;
+}
+