summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/bsd.c5
-rw-r--r--src/bsd.h3
-rw-r--r--src/fat.c37
-rw-r--r--src/fat.h7
-rw-r--r--src/fnctdsk.c18
-rw-r--r--src/fnctdsk.h3
-rw-r--r--src/intrf.c47
-rw-r--r--src/intrf.h2
-rw-r--r--src/intrfn.h1
-rw-r--r--src/jfs.c5
-rw-r--r--src/jfs.h3
-rw-r--r--src/lvm.c9
-rw-r--r--src/lvm.h4
-rw-r--r--src/ntfs.c5
-rw-r--r--src/ntfs.h3
-rw-r--r--src/parti386.c12
-rw-r--r--src/partnone.c7
-rw-r--r--src/partnone.h1
-rw-r--r--src/swap.c5
-rw-r--r--src/swap.h3
20 files changed, 94 insertions, 86 deletions
diff --git a/src/bsd.c b/src/bsd.c
index 587ea05..9c01386 100644
--- a/src/bsd.c
+++ b/src/bsd.c
@@ -2,7 +2,7 @@
File: bsd.c
- Copyright (C) 1998-2006 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 1998-2006,2008 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
@@ -33,6 +33,7 @@
#include "intrf.h"
#include "fnctdsk.h"
#include "log.h"
+static int test_BSD(disk_t *disk_car, const struct disklabel*bsd_header,partition_t *partition,const int verbose, const int dump_ind, const unsigned int max_partitions);
int check_BSD(disk_t *disk_car,partition_t *partition,const int verbose, const unsigned int max_partitions)
{
@@ -53,7 +54,7 @@ int check_BSD(disk_t *disk_car,partition_t *partition,const int verbose, const u
return 0;
}
-int test_BSD(disk_t *disk_car, const struct disklabel*bsd_header,partition_t *partition,const int verbose, const int dump_ind, const unsigned int max_partitions)
+static int test_BSD(disk_t *disk_car, const struct disklabel*bsd_header,partition_t *partition,const int verbose, const int dump_ind, const unsigned int max_partitions)
{
if((le32(bsd_header->d_magic) == DISKMAGIC)&&
(le32(bsd_header->d_magic2)==DISKMAGIC))
diff --git a/src/bsd.h b/src/bsd.h
index 51f8e60..1c14459 100644
--- a/src/bsd.h
+++ b/src/bsd.h
@@ -2,7 +2,7 @@
File: bsd.h
- Copyright (C) 1998-2004,2006 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 1998-2004,2006,2008 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
@@ -166,7 +166,6 @@ struct disklabel {
#define TST_FS_RAID 15 /* RAIDFrame drive */
#define TST_FS_JFS2 21 /* IBM JFS2 */
int check_BSD(disk_t *disk_car,partition_t *partition,const int verbose,const unsigned int max_partitions);
-int test_BSD(disk_t *disk_car, const struct disklabel*bsd_header,partition_t *partition,const int verbose, const int dump_ind, const unsigned int max_partitions);
int recover_BSD(disk_t *disk_car, const struct disklabel*bsd_header,partition_t *partition,const int verbose, const int dump_ind);
#endif
diff --git a/src/fat.c b/src/fat.c
index 11c0713..50fb16c 100644
--- a/src/fat.c
+++ b/src/fat.c
@@ -2,7 +2,7 @@
File: fat.c
- Copyright (C) 1998-2007 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 1998-2008 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
@@ -53,7 +53,32 @@ extern const arch_fnct_t arch_mac;
static int set_FAT_info(disk_t *disk_car, const struct fat_boot_sector *fat_header, partition_t *partition,const int verbose);
static void fat_set_part_name(partition_t *partition,const unsigned char *src,const int max_size);
+static int fat32_set_part_name(disk_t *disk_car, partition_t *partition, const struct fat_boot_sector*fat_header);
static int log_fat_info(const struct fat_boot_sector*fh1, const upart_type_t upart_type, const unsigned int sector_size);
+static int test_HPFS(disk_t *disk_car,const struct fat_boot_sector *fat_header, partition_t *partition,const int verbose, const int dump_ind);
+static int test_OS2MB(disk_t *disk_car,const struct fat_boot_sector *fat_header, partition_t *partition,const int verbose, const int dump_ind);
+static unsigned long int fat32_get_free_count(const unsigned char *boot_fat32, const unsigned int sector_size);
+static unsigned long int fat32_get_next_free(const unsigned char *boot_fat32, const unsigned int sector_size);
+
+#define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */
+#define IS_FREE(n) (!*(n) || *(const unsigned char *) (n) == DELETED_FLAG)
+#define ATTR_RO 1 /* read-only */
+#define ATTR_HIDDEN 2 /* hidden */
+#define ATTR_SYS 4 /* system */
+#define ATTR_VOLUME 8 /* volume label */
+#define ATTR_DIR 16 /* directory */
+#define ATTR_ARCH 32 /* archived */
+
+#define ATTR_NONE 0 /* no attribute bits */
+#define ATTR_UNUSED (ATTR_VOLUME | ATTR_ARCH | ATTR_SYS | ATTR_HIDDEN)
+ /* attribute bits that are copied "as is" */
+#define ATTR_EXT (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME)
+#define ATTR_EXT_MASK (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME | ATTR_DIR | ATTR_ARCH)
+ /* bits that are used by the Windows 95/Windows NT extended FAT */
+#define FAT12_BAD 0x0FF7
+#define FAT12_EOC 0x0FF8
+#define FAT16_BAD 0xFFF7
+#define FAT16_EOC 0xFFF8
static void fat_set_part_name(partition_t *partition,const unsigned char *src,const int max_size)
{
@@ -832,12 +857,12 @@ unsigned int get_dir_entries(const struct fat_boot_sector *fat_header)
unsigned int sectors(const struct fat_boot_sector *fat_header)
{ return (fat_header->sectors[1]<<8)+fat_header->sectors[0]; }
-unsigned long int fat32_get_free_count(const unsigned char *boot_fat32, const unsigned int sector_size)
+static unsigned long int fat32_get_free_count(const unsigned char *boot_fat32, const unsigned int sector_size)
{
return (boot_fat32[sector_size+0x1E8+3]<<24)+(boot_fat32[sector_size+0x1E8+2]<<16)+(boot_fat32[sector_size+0x1E8+1]<<8)+boot_fat32[sector_size+0x1E8];
}
-unsigned long int fat32_get_next_free(const unsigned char *boot_fat32, const unsigned int sector_size)
+static unsigned long int fat32_get_next_free(const unsigned char *boot_fat32, const unsigned int sector_size)
{
return (boot_fat32[sector_size+0x1EC+3]<<24)+(boot_fat32[sector_size+0x1EC+2]<<16)+(boot_fat32[sector_size+0x1EC+1]<<8)+boot_fat32[sector_size+0x1EC];
}
@@ -912,7 +937,7 @@ int recover_FAT(disk_t *disk_car, const struct fat_boot_sector*fat_header, parti
return 0;
}
-int fat32_set_part_name(disk_t *disk_car, partition_t *partition, const struct fat_boot_sector*fat_header)
+static int fat32_set_part_name(disk_t *disk_car, partition_t *partition, const struct fat_boot_sector*fat_header)
{
partition->fsname[0]='\0';
if((fat_header->sectors_per_cluster>0)&&(fat_header->sectors_per_cluster<=128))
@@ -978,7 +1003,7 @@ int check_HPFS(disk_t *disk_car,partition_t *partition,const int verbose)
return 0;
}
-int test_HPFS(disk_t *disk_car,const struct fat_boot_sector *fat_header, partition_t *partition,const int verbose, const int dump_ind)
+static int test_HPFS(disk_t *disk_car,const struct fat_boot_sector *fat_header, partition_t *partition,const int verbose, const int dump_ind)
{
const char*buffer=(const char*)fat_header;
if(le16(fat_header->marker)==0xAA55)
@@ -1051,7 +1076,7 @@ int recover_OS2MB(disk_t *disk_car, const struct fat_boot_sector*fat_header, par
return 0;
}
-int test_OS2MB(disk_t *disk_car,const struct fat_boot_sector *fat_header, partition_t *partition,const int verbose, const int dump_ind)
+static int test_OS2MB(disk_t *disk_car,const struct fat_boot_sector *fat_header, partition_t *partition,const int verbose, const int dump_ind)
{
const char*buffer=(const char*)fat_header;
if(le16(fat_header->marker)==0xAA55 && memcmp(buffer+FAT_NAME1,"FAT ",8)==0)
diff --git a/src/fat.h b/src/fat.h
index b84a503..a211b26 100644
--- a/src/fat.h
+++ b/src/fat.h
@@ -2,7 +2,7 @@
File: fat.h
- Copyright (C) 1998-2004,2007 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 1998-2004,2007-2008 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
@@ -118,13 +118,10 @@ int is_part_fat32(const partition_t *partition);
unsigned int get_dir_entries(const struct fat_boot_sector *fat_header);
int dump_fat_info(const struct fat_boot_sector*fh1, const upart_type_t upart_type, const unsigned int sector_size);
int dump_2fat_info(const struct fat_boot_sector*fh1, const struct fat_boot_sector*fh2, const upart_type_t upart_type, const unsigned int sector_size);
-int fat32_set_part_name(disk_t *disk_car, partition_t *partition, const struct fat_boot_sector*fat_header);
unsigned int fat_sector_size(const struct fat_boot_sector *fat_header);
unsigned int sectors(const struct fat_boot_sector *fat_header);
unsigned int fat32_get_prev_cluster(disk_t *disk_car,const partition_t *partition, const unsigned int fat_offset, const unsigned int cluster, const unsigned int no_of_cluster);
int fat32_free_info(disk_t *disk_car,const partition_t *partition, const unsigned int fat_offset, const unsigned int no_of_cluster, unsigned int *next_free, unsigned int*free_count);
-unsigned long int fat32_get_free_count(const unsigned char *boot_fat32, const unsigned int sector_size);
-unsigned long int fat32_get_next_free(const unsigned char *boot_fat32, const unsigned int sector_size);
#define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */
#define IS_FREE(n) (!*(n) || *(const unsigned char *) (n) == DELETED_FLAG)
@@ -155,8 +152,6 @@ int check_FAT(disk_t *disk_car,partition_t *partition, const int verbose);
int test_FAT(disk_t *disk_car,const struct fat_boot_sector *fat_header, partition_t *partition,const int verbose, const int dump_ind);
int recover_HPFS(disk_t *disk_car, const struct fat_boot_sector*fat_header, partition_t *partition, const int verbose, const int dump_ind);
int check_HPFS(disk_t *disk_car,partition_t *partition, const int verbose);
-int test_HPFS(disk_t *disk_car,const struct fat_boot_sector *fat_header, partition_t *partition,const int verbose, const int dump_ind);
int recover_OS2MB(disk_t *disk_car, const struct fat_boot_sector*fat_header, partition_t *partition, const int verbose, const int dump_ind);
int check_OS2MB(disk_t *disk_car,partition_t *partition, const int verbose);
-int test_OS2MB(disk_t *disk_car,const struct fat_boot_sector *fat_header, partition_t *partition,const int verbose, const int dump_ind);
int check_VFAT_volume_name(const char *name, const unsigned int max_size);
diff --git a/src/fnctdsk.c b/src/fnctdsk.c
index 5983d80..8d158bb 100644
--- a/src/fnctdsk.c
+++ b/src/fnctdsk.c
@@ -2,7 +2,7 @@
File: fnctdsk.c
- Copyright (C) 1998-2005 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 1998-2005,2008 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
@@ -41,6 +41,7 @@
#include "guid_cpy.h"
static unsigned int get_geometry_from_list_part_aux(const disk_t *disk_car, const list_part_t *list_part, const int verbose);
+static list_part_t *element_new(partition_t *part);
unsigned long int C_H_S2LBA(const disk_t *disk_car,const unsigned int C, const unsigned int H, const unsigned int S)
{
@@ -53,12 +54,6 @@ uint64_t CHS2offset(const disk_t *disk_car,const CHS_t*CHS)
disk_car->geom.sectors_per_head + CHS->sector - 1) * disk_car->sector_size;
}
-uint64_t C_H_S2offset(const disk_t *disk_car,const unsigned int C, const unsigned int H, const unsigned int S)
-{
- return (((uint64_t)C * disk_car->geom.heads_per_cylinder + H) *
- disk_car->geom.sectors_per_head + S - 1) * disk_car->sector_size;
-}
-
unsigned int offset2sector(const disk_t *disk_car, const uint64_t offset)
{
return ((offset / disk_car->sector_size) % disk_car->geom.sectors_per_head) + 1;
@@ -83,13 +78,6 @@ void offset2CHS(const disk_t *disk_car,const uint64_t offset, CHS_t*CHS)
CHS->cylinder=pos/disk_car->geom.heads_per_cylinder;
}
-void dup_CHS(CHS_t * CHS_dst, const CHS_t * CHS_source)
-{
- CHS_dst->cylinder=CHS_source->cylinder;
- CHS_dst->head=CHS_source->head;
- CHS_dst->sector=CHS_source->sector;
-}
-
void dup_partition_t(partition_t *dst, const partition_t *src)
{
#if 0
@@ -375,7 +363,7 @@ partition_t *partition_new(const arch_fnct_t *arch)
return partition;
}
-list_part_t *element_new(partition_t *part)
+static list_part_t *element_new(partition_t *part)
{
list_part_t *new_element=(list_part_t*)MALLOC(sizeof(*new_element));
new_element->part=part;
diff --git a/src/fnctdsk.h b/src/fnctdsk.h
index d4f2080..9c4ab84 100644
--- a/src/fnctdsk.h
+++ b/src/fnctdsk.h
@@ -21,14 +21,11 @@
*/
unsigned long int C_H_S2LBA(const disk_t *disk_car,const unsigned int C, const unsigned int H, const unsigned int S);
uint64_t CHS2offset(const disk_t *disk_car,const CHS_t*CHS);
-uint64_t C_H_S2offset(const disk_t *disk_car,const unsigned int C, const unsigned int H, const unsigned int S);
unsigned int offset2sector(const disk_t *disk_car, const uint64_t offset);
unsigned int offset2head(const disk_t *disk_car, const uint64_t offset);
unsigned int offset2cylinder(const disk_t *disk_car, const uint64_t offset);
void offset2CHS(const disk_t *disk_car,const uint64_t offset, CHS_t*CHS);
-void dup_CHS(CHS_t * CHS_dest, const CHS_t * CHS_source);
-list_part_t *element_new(partition_t *part);
list_disk_t *insert_new_disk(list_disk_t *list_disk, disk_t *disk_car);
list_part_t *insert_new_partition(list_part_t *list_part, partition_t *part, const int force_insert, int *insert_error);
list_part_t *remove_partition(list_part_t *list_part, list_part_t *element2removed);
diff --git a/src/intrf.c b/src/intrf.c
index 39aeb4d..a8eefca 100644
--- a/src/intrf.c
+++ b/src/intrf.c
@@ -297,6 +297,7 @@ char *get_default_location(void)
#ifdef HAVE_NCURSES
#define INTER_DIR (LINES-25+16)
+static int aff_txt(int line, WINDOW *window, const char *_format, ...) __attribute__ ((format (printf, 3, 4)));
static int vaff_txt(int line, WINDOW *window, const char *_format, va_list ap) __attribute__((format(printf, 3, 0)));
static int wmenuUpdate(WINDOW *window, const int yinfo, int y, int x, const struct MenuItem *menuItems, const unsigned int itemLength, const char *available, const int menuType, unsigned int current);
static void dir_aff_entry(WINDOW *window, file_info_t *file_info);
@@ -1079,16 +1080,6 @@ int screen_buffer_display_ext(WINDOW *window, const char *options_org, const str
return 0;
}
-void aff_CHS(const CHS_t * CHS)
-{
- wprintw(stdscr,"%5u %3u %2u ", CHS->cylinder, CHS->head, CHS->sector);
-}
-
-void aff_CHS_buffer(const CHS_t * CHS)
-{
- screen_buffer_add("%5u %3u %2u ", CHS->cylinder, CHS->head, CHS->sector);
-}
-
void aff_part(WINDOW *window,const unsigned int newline,const disk_t *disk_car,const partition_t *partition)
{
const char *msg;
@@ -1358,8 +1349,11 @@ char *ask_log_location(const char*filename)
{
static char response[LINE_LENGTH];
aff_copy(stdscr);
- wmove(stdscr,6,0);
- wprintw(stdscr,"Cannot open %s: %s\n",filename, strerror(errno));
+ if(filename!=NULL)
+ {
+ wmove(stdscr,6,0);
+ wprintw(stdscr,"Cannot open %s: %s\n",filename, strerror(errno));
+ }
wmove(stdscr,8,0);
wprintw(stdscr,"Please enter the full log filename or press ");
if(has_colors())
@@ -1383,8 +1377,8 @@ static int intrf_no_disk_ncurses(const char *prog_name)
wprintw(stdscr,"comes with ABSOLUTELY NO WARRANTY.");
wmove(stdscr,7,0);
wprintw(stdscr,"No harddisk found\n");
- wmove(stdscr,8,0);
#if defined(__CYGWIN__) || defined(__MINGW32__)
+ wmove(stdscr,8,0);
wprintw(stdscr,"You need to be administrator to use %s.\n", prog_name);
wmove(stdscr,9,0);
wprintw(stdscr,"Under Win9x, use the DOS version instead.\n");
@@ -1395,6 +1389,7 @@ static int intrf_no_disk_ncurses(const char *prog_name)
#ifdef HAVE_GETEUID
if(geteuid()!=0)
{
+ wmove(stdscr,8,0);
wprintw(stdscr,"You need to be root to use %s.\n", prog_name);
#ifdef SUDO_BIN
{
@@ -1884,7 +1879,7 @@ static int vaff_txt(int line, WINDOW *window, const char *_format, va_list ap)
return line;
}
-int aff_txt(int line, WINDOW *window, const char *_format, ...)
+static int aff_txt(int line, WINDOW *window, const char *_format, ...)
{
va_list ap;
va_start(ap,_format);
@@ -1955,21 +1950,15 @@ unsigned long long int ask_number_cli(char **current_cmd, const unsigned long lo
return tmp_val;
else
{
- {
- char res[200];
- char res2[200];
- va_list ap;
- va_start(ap,_format);
- vsnprintf(res,sizeof(res),_format,ap);
- if(val_min!=val_max)
- snprintf(res2,sizeof(res2),"(%llu-%llu) :",val_min,val_max);
- else
- res2[0]='\0';
- va_end(ap);
- log_error(res);
- log_error(res2);
- log_error("Invalid value\n");
- }
+ char res[200];
+ va_list ap;
+ va_start(ap,_format);
+ vsnprintf(res,sizeof(res),_format,ap);
+ log_error(res);
+ if(val_min!=val_max)
+ log_error("(%llu-%llu) :",val_min,val_max);
+ log_error("Invalid value\n");
+ va_end(ap);
}
}
return val_cur;
diff --git a/src/intrf.h b/src/intrf.h
index dc57d3a..708a32d 100644
--- a/src/intrf.h
+++ b/src/intrf.h
@@ -63,8 +63,6 @@ struct MenuItem
/* '\014' == ^L */
#define key_REDRAWKEY '\014'
-void aff_CHS(const CHS_t * CHS);
-void aff_CHS_buffer(const CHS_t * CHS);
void aff_LBA2CHS(const disk_t *disk_car, const unsigned long int pos_LBA);
void log_CHS_from_LBA(const disk_t *disk_car, const unsigned long int pos_LBA);
const char *aff_part_aux(const unsigned int newline, const disk_t *disk_car, const partition_t *partition);
diff --git a/src/intrfn.h b/src/intrfn.h
index 0f6f896..e72330b 100644
--- a/src/intrfn.h
+++ b/src/intrfn.h
@@ -35,7 +35,6 @@
void aff_copy(WINDOW *window);
void aff_part(WINDOW *window, const unsigned int newline, const disk_t *disk_car, const partition_t *partition);
-int aff_txt(int line, WINDOW *window, const char *_format, ...) __attribute__ ((format (printf, 3, 4)));
int ask_YN(WINDOW *window);
int check_enter_key_or_s(WINDOW *window);
void dump2(WINDOW *window, const void *dump_1, const void *dump_2, const unsigned int lng);
diff --git a/src/jfs.c b/src/jfs.c
index 8fe2655..202fa41 100644
--- a/src/jfs.c
+++ b/src/jfs.c
@@ -2,7 +2,7 @@
File: jfs.c
- Copyright (C) 2004-2007 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 2004-2008 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
@@ -38,6 +38,7 @@
#include "guid_cpy.h"
static int test_JFS(disk_t *disk_car, const struct jfs_superblock *sb,partition_t *partition,const int verbose, const int dump_ind);
+static int set_JFS_info(disk_t *disk_car, const struct jfs_superblock *sb,partition_t *partition,const int verbose, const int dump_ind);
int check_JFS(disk_t *disk_car,partition_t *partition,const int verbose)
{
@@ -57,7 +58,7 @@ int check_JFS(disk_t *disk_car,partition_t *partition,const int verbose)
return 0;
}
-int set_JFS_info(disk_t *disk_car, const struct jfs_superblock *sb,partition_t *partition,const int verbose, const int dump_ind)
+static int set_JFS_info(disk_t *disk_car, const struct jfs_superblock *sb,partition_t *partition,const int verbose, const int dump_ind)
{
snprintf(partition->info,sizeof(partition->info),"JFS %u",(unsigned int)le32(sb->s_version));
partition->fsname[0]='\0';
diff --git a/src/jfs.h b/src/jfs.h
index e5e078f..1d434fd 100644
--- a/src/jfs.h
+++ b/src/jfs.h
@@ -2,7 +2,7 @@
File: jfs.h
- Copyright (C) 2004,2006 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 2004,2006,2008 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
@@ -25,4 +25,3 @@
#define L2BPERDMAP 13 /* l2 num of blks per dmap */
int check_JFS(disk_t *disk_car,partition_t *partition,const int verbose);
int recover_JFS(disk_t *disk_car, const struct jfs_superblock *sb,partition_t *partition,const int verbose, const int dump_ind);
-int set_JFS_info(disk_t *disk_car, const struct jfs_superblock *sb,partition_t *partition,const int verbose, const int dump_ind);
diff --git a/src/lvm.c b/src/lvm.c
index cbb883a..58df7e6 100644
--- a/src/lvm.c
+++ b/src/lvm.c
@@ -2,7 +2,7 @@
File: lvm.c
- Copyright (C) 2003-2007 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 2003-2008 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
@@ -38,7 +38,10 @@
#include "guid_cpy.h"
static int set_LVM_info(partition_t *partition, const pv_disk_t *pv);
+static int test_LVM(disk_t *disk_car, const pv_disk_t *pv,partition_t *partition,const int verbose, const int dump_ind);
+
static int set_LVM2_info(partition_t*partition, const unsigned char *buf);
+static int test_LVM2(disk_t *disk_car, const struct lvm2_label_header *lh,partition_t *partition,const int verbose, const int dump_ind);
int check_LVM(disk_t *disk_car,partition_t *partition,const int verbose)
{
@@ -76,7 +79,7 @@ int recover_LVM(disk_t *disk_car, const pv_disk_t *pv,partition_t *partition,con
return 0;
}
-int test_LVM(disk_t *disk_car, const pv_disk_t *pv,partition_t *partition,const int verbose, const int dump_ind)
+static int test_LVM(disk_t *disk_car, const pv_disk_t *pv,partition_t *partition,const int verbose, const int dump_ind)
{
if ((memcmp((const char *)pv->id,LVM_ID,sizeof(pv->id)) == 0) && (le16(pv->version) == 1 || le16(pv->version) == 2))
{
@@ -163,7 +166,7 @@ int recover_LVM2(disk_t *disk_car, const unsigned char *buf,partition_t *partiti
return 0;
}
-int test_LVM2(disk_t *disk_car, const struct lvm2_label_header *lh,partition_t *partition,const int verbose, const int dump_ind)
+static int test_LVM2(disk_t *disk_car, const struct lvm2_label_header *lh,partition_t *partition,const int verbose, const int dump_ind)
{
if (memcmp((const char *)lh->type,LVM2_LABEL,sizeof(lh->type)) == 0)
{
diff --git a/src/lvm.h b/src/lvm.h
index 28819d4..0daee80 100644
--- a/src/lvm.h
+++ b/src/lvm.h
@@ -1,7 +1,7 @@
/*
File: lvm.h, TestDisk
- Copyright (C) 2003-2006 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 2003-2008 Christophe GRENIER <grenier@cgsecurity.org>
Same wunderfull license.
*/
/* gm_hmlvm.h -- gpart Linux LVM physical volume guessing module header
@@ -88,7 +88,6 @@ typedef struct {
#define pv_disk_t pv_disk_v2_t
int check_LVM(disk_t *disk_car,partition_t *partition,const int verbose);
-int test_LVM(disk_t *disk_car, const pv_disk_t *pv,partition_t *partition,const int verbose, const int dump_ind);
int recover_LVM(disk_t *disk_car, const pv_disk_t *pv,partition_t *partition,const int verbose, const int dump_ind);
#define LVM2_LABEL "LVM2 001"
@@ -117,7 +116,6 @@ struct lvm2_pv_header {
} __attribute__ ((packed));
int check_LVM2(disk_t *disk_car,partition_t *partition,const int verbose);
-int test_LVM2(disk_t *disk_car, const struct lvm2_label_header *lh,partition_t *partition,const int verbose, const int dump_ind);
int recover_LVM2(disk_t *disk_car, const unsigned char *buf,partition_t *partition,const int verbose, const int dump_ind);
#endif /* _LVM_H */
diff --git a/src/ntfs.c b/src/ntfs.c
index 2fc893a..24acab0 100644
--- a/src/ntfs.c
+++ b/src/ntfs.c
@@ -2,7 +2,7 @@
File: ntfs.c
- Copyright (C) 1998-2007 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 1998-2008 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
@@ -46,6 +46,7 @@
extern const arch_fnct_t arch_i386;
extern const arch_fnct_t arch_mac;
+static int set_NTFS_info(disk_t *disk_car, const struct ntfs_boot_sector*ntfs_header,partition_t *partition,const int verbose, const int dump_ind);
static int ntfs_read_MFT(disk_t *disk_car, partition_t *partition, const struct ntfs_boot_sector*ntfs_header,const int my_type,const int verbose, const int dump_ind);
static int ntfs_get_attr_aux(const char *attr_record, const int my_type, partition_t *partition, const char *end, const int verbose, const int dump_ind, const char*file_name_to_find);
@@ -109,7 +110,7 @@ int recover_NTFS(disk_t *disk_car, const struct ntfs_boot_sector*ntfs_header,par
return 0;
}
-int set_NTFS_info(disk_t *disk_car, const struct ntfs_boot_sector*ntfs_header,partition_t *partition,const int verbose, const int dump_ind)
+static int set_NTFS_info(disk_t *disk_car, const struct ntfs_boot_sector*ntfs_header,partition_t *partition,const int verbose, const int dump_ind)
{
partition->fsname[0]='\0';
if(partition->sb_offset==0)
diff --git a/src/ntfs.h b/src/ntfs.h
index c828e24..1fcaa0e 100644
--- a/src/ntfs.h
+++ b/src/ntfs.h
@@ -2,7 +2,7 @@
File: ntfs.h
- Copyright (C) 1998-2006 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 1998-2006,2008 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
@@ -59,7 +59,6 @@ int is_ntfs(const partition_t *partition);
int is_part_ntfs(const partition_t *partition);
int ntfs_get_attr(const char *mft_record, const int my_type, partition_t *partition, const char *end, const int verbose, const int dump_ind, const char*file_name_to_find);
int recover_NTFS(disk_t *disk_car, const struct ntfs_boot_sector*ntfs_header,partition_t *partition,const int verbose, const int dump_ind, const int backup);
-int set_NTFS_info(disk_t *disk_car, const struct ntfs_boot_sector*ntfs_header,partition_t *partition,const int verbose, const int dump_ind);
int test_NTFS(const disk_t *disk_car,const struct ntfs_boot_sector*ntfs_header, partition_t *partition,const int verbose, const int dump_ind);
#define NTFS_GETU8(p) (*(const uint8_t*)(p))
#define NTFS_GETU16(p) (le16(*(const uint16_t*)(p)))
diff --git a/src/parti386.c b/src/parti386.c
index 74f352d..b0d97a1 100644
--- a/src/parti386.c
+++ b/src/parti386.c
@@ -50,6 +50,7 @@
#include "hfsp.h"
#include "jfs_superblock.h"
#include "jfs.h"
+#include "luks.h"
#include "lvm.h"
#include "md.h"
#include "netware.h"
@@ -120,6 +121,7 @@ static const char* errmsg_i386_entry2partition(const errcode_type_t errcode);
static const char *get_partition_typename_i386(const partition_t *partition);
static const char *get_partition_typename_i386_aux(const unsigned int part_type_i386);
static unsigned int get_part_type_i386(const partition_t *partition);
+static uint64_t C_H_S2offset(const disk_t *disk_car,const unsigned int C, const unsigned int H, const unsigned int S);
static const struct systypes i386_sys_types[] = {
{P_NO_OS, "No partition"},
@@ -238,6 +240,12 @@ arch_fnct_t arch_i386= {
.get_part_type=get_part_type_i386
};
+static uint64_t C_H_S2offset(const disk_t *disk_car,const unsigned int C, const unsigned int H, const unsigned int S)
+{
+ return (((uint64_t)C * disk_car->geom.heads_per_cylinder + H) *
+ disk_car->geom.sectors_per_head + S - 1) * disk_car->sector_size;
+}
+
static unsigned int get_part_type_i386(const partition_t *partition)
{
return partition->part_type_i386;
@@ -1651,6 +1659,10 @@ static int check_part_i386(disk_t *disk_car,const int verbose,partition_t *parti
ret=check_xfs(disk_car,partition,verbose);
}
if(ret!=0)
+ {
+ ret=check_LUKS(disk_car,partition,verbose);
+ }
+ if(ret!=0)
{ screen_buffer_add("No EXT2, JFS, Reiser, cramfs or XFS marker\n"); }
break;
case P_LINSWAP:
diff --git a/src/partnone.c b/src/partnone.c
index 060c742..d9a9c99 100644
--- a/src/partnone.c
+++ b/src/partnone.c
@@ -51,6 +51,7 @@
#include "hfsp.h"
#include "jfs_superblock.h"
#include "jfs.h"
+#include "luks.h"
#include "lvm.h"
#include "md.h"
#include "netware.h"
@@ -73,6 +74,7 @@ static int test_structure_none(list_part_t *list_part);
static int is_part_known_none(const partition_t *partition);
static void init_structure_none(const disk_t *disk_car,list_part_t *list_part, const int verbose);
static const char *get_partition_typename_none_aux(const unsigned int part_type_none);
+static int set_part_type_none(partition_t *partition, unsigned int part_type);
static const struct systypes none_sys_types[] = {
{UP_BEOS, "BeFS"},
@@ -221,7 +223,7 @@ static int test_structure_none(list_part_t *list_part)
return 0;
}
-int set_part_type_none(partition_t *partition, unsigned int part_type)
+static int set_part_type_none(partition_t *partition, unsigned int part_type)
{
partition->upart_type=(upart_type_t)part_type;
return 0;
@@ -287,6 +289,9 @@ static int check_part_none(disk_t *disk_car,const int verbose,partition_t *parti
case UP_LINSWAP2:
ret=check_Linux_SWAP(disk_car,partition,verbose);
break;
+ case UP_LUKS:
+ ret=check_LUKS(disk_car, partition, verbose);
+ break;
case UP_LVM:
ret=check_LVM(disk_car,partition,verbose);
break;
diff --git a/src/partnone.h b/src/partnone.h
index 273f886..6ed9815 100644
--- a/src/partnone.h
+++ b/src/partnone.h
@@ -1,3 +1,2 @@
unsigned int get_part_type_none(const partition_t *partition);
-int set_part_type_none(partition_t *partition, unsigned int part_type);
const char *get_partition_typename_none(const partition_t *partition);
diff --git a/src/swap.c b/src/swap.c
index ea71d57..e715423 100644
--- a/src/swap.c
+++ b/src/swap.c
@@ -2,7 +2,7 @@
File: swap.c
- Copyright (C) 1998-2006 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 1998-2006,2008 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
@@ -35,6 +35,7 @@
#include "swap.h"
#include "fnctdsk.h"
static int set_Linux_SWAP_info(const union swap_header *swap_header,partition_t *partition);
+static int test_Linux_SWAP(disk_t *disk_car, const union swap_header *swap_header,partition_t *partition,const int verbose, const int dump_ind);
int check_Linux_SWAP(disk_t *disk_car,partition_t *partition,const int verbose)
{
@@ -73,7 +74,7 @@ static int set_Linux_SWAP_info(const union swap_header *swap_header,partition_t
return 0;
}
-int test_Linux_SWAP(disk_t *disk_car, const union swap_header *swap_header,partition_t *partition,const int verbose, const int dump_ind)
+static int test_Linux_SWAP(disk_t *disk_car, const union swap_header *swap_header,partition_t *partition,const int verbose, const int dump_ind)
{
if(memcmp(swap_header->magic.magic,"SWAP-SPACE",10)==0)
{
diff --git a/src/swap.h b/src/swap.h
index fe2e8d6..efb5a90 100644
--- a/src/swap.h
+++ b/src/swap.h
@@ -2,7 +2,7 @@
file: swap.h
- Copyright (C) 1998-2004,2006 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 1998-2004,2006,2008 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
@@ -42,5 +42,4 @@ union swap_header {
};
int check_Linux_SWAP(disk_t *disk_car,partition_t *partition,const int verbose);
-int test_Linux_SWAP(disk_t *disk_car, const union swap_header *swap_header,partition_t *partition,const int verbose, const int dump_ind);
int recover_Linux_SWAP(disk_t *disk_car, const union swap_header *swap_header,partition_t *partition,const int verbose, const int dump_ind);