summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-05-15 13:41:20 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2013-05-15 13:41:20 +0200
commitfd9c697a03a5501e326479192dad98e2d6fdb64e (patch)
tree7c5862a7d2408640a11425922f32b66e313cc48f
parent38084f56e0fea23249b010f0fc37c20c33871840 (diff)
Split change_geometry() into change_geometry_cli() and change_geometry_ncurses()
-rw-r--r--src/Makefile.am12
-rw-r--r--src/geometry.c169
-rw-r--r--src/geometry.h4
-rw-r--r--src/geometryn.c188
-rw-r--r--src/geometryn.h30
-rw-r--r--src/ppartsel.c5
-rw-r--r--src/tdiskop.c5
7 files changed, 240 insertions, 173 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 4dc6024..f56dcb7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,8 +19,8 @@ base_H = alignio.h autoset.h common.h crc.h ewf.h fnctdsk.h hdaccess.h hdwin32
fs_C = analyse.c bfs.c bsd.c btrfs.c cramfs.c exfat.c fat.c fatx.c ext2.c jfs.c gfs2.c hfs.c hfsp.c hpfs.c luks.c lvm.c md.c netware.c ntfs.c rfs.c savehdr.c sun.c swap.c sysv.c ufs.c vmfs.c wbfs.c xfs.c zfs.c
fs_H = analyse.h bfs.h bsd.h btrfs.h cramfs.h exfat.h fat.h fatx.h ext2.h jfs_superblock.h jfs.h gfs2.h hfs.h hfsp.h hpfs.h luks.h lvm.h md.h netware.h ntfs.h rfs.h savehdr.h sun.h swap.h sysv.h ufs.h vmfs.h wbfs.h xfs.h zfs.h
-testdisk_ncurses_C = addpart.c adv.c askloc.c chgtype.c chgtypen.c dimage.c dirn.c dirpart.c diskacc.c diskcapa.c edit.c ext2_sb.c ext2_sbn.c fat1x.c fat32.c fat_adv.c fat_cluster.c fatn.c geometry.c godmode.c hiddenn.c intrface.c intrfn.c nodisk.c ntfs_adv.c ntfs_fix.c ntfs_udl.c parti386n.c partgptn.c partmacn.c partsunn.c partxboxn.c tanalyse.c tbanner.c tdelete.c tdiskop.c tdisksel.c testdisk.c texfat.c thfs.c tload.c tlog.c tmbrcode.c tntfs.c toptions.c tpartwr.c
-testdisk_ncurses_H = addpart.h adv.h askloc.h chgtype.h chgtypen.h dimage.h dirn.h dirpart.h diskacc.h diskcapa.h edit.h ext2_sb.h ext2_sbn.h fat1x.h fat32.h fat_adv.h fat_cluster.h fatn.h geometry.h godmode.h hiddenn.h intrface.h intrfn.h nodisk.h ntfs_fix.h ntfs_udl.h partgptn.h parti386n.h partmacn.h partsunn.h partxboxn.h tanalyse.h tdelete.h tdiskop.h tdisksel.h texfat.h thfs.h tload.h tlog.h tmbrcode.h tntfs.h toptions.h tpartwr.h
+testdisk_ncurses_C = addpart.c adv.c askloc.c chgtype.c chgtypen.c dimage.c dirn.c dirpart.c diskacc.c diskcapa.c edit.c ext2_sb.c ext2_sbn.c fat1x.c fat32.c fat_adv.c fat_cluster.c fatn.c geometry.c geometryn.c godmode.c hiddenn.c intrface.c intrfn.c nodisk.c ntfs_adv.c ntfs_fix.c ntfs_udl.c parti386n.c partgptn.c partmacn.c partsunn.c partxboxn.c tanalyse.c tbanner.c tdelete.c tdiskop.c tdisksel.c testdisk.c texfat.c thfs.c tload.c tlog.c tmbrcode.c tntfs.c toptions.c tpartwr.c
+testdisk_ncurses_H = addpart.h adv.h askloc.h chgtype.h chgtypen.h dimage.h dirn.h dirpart.h diskacc.h diskcapa.h edit.h ext2_sb.h ext2_sbn.h fat1x.h fat32.h fat_adv.h fat_cluster.h fatn.h geometry.h geometryn.h godmode.h hiddenn.h intrface.h intrfn.h nodisk.h ntfs_fix.h ntfs_udl.h partgptn.h parti386n.h partmacn.h partsunn.h partxboxn.h tanalyse.h tdelete.h tdiskop.h tdisksel.h texfat.h thfs.h tload.h tlog.h tmbrcode.h tntfs.h toptions.h tpartwr.h
testdisk_SOURCES = $(base_C) $(base_H) $(fs_C) $(fs_H) $(testdisk_ncurses_C) $(testdisk_ncurses_H) dir.c dir.h exfat_dir.c exfat_dir.h ext2_dir.c ext2_dir.h ext2_inc.h fat_dir.c fat_dir.h ntfs_dir.c ntfs_dir.h ntfs_inc.h partgptw.c rfs_dir.c rfs_dir.h setdate.c setdate.h $(ICON_TESTDISK) next.c next.h
@@ -290,12 +290,12 @@ file_C = filegen.c \
file_H = ext2.h filegen.h file_jpg.h file_sp3.h file_tar.h file_tiff.h file_txt.h ole.h pe.h suspend.h
-photorec_C = photorec.c phcfg.c dir.c exfatp.c ext2grp.c ext2_dir.c ext2p.c fat_dir.c fatp.c file_found.c ntfs_dir.c ntfsp.c poptions.c sessionp.c setdate.c dfxml.c list.c
+photorec_C = photorec.c phcfg.c dir.c exfatp.c ext2grp.c ext2_dir.c ext2p.c fat_dir.c fatp.c file_found.c geometry.c ntfs_dir.c ntfsp.c poptions.c sessionp.c setdate.c dfxml.c list.c
-photorec_H = photorec.h phcfg.h dir.h exfatp.h ext2grp.h ext2p.h ext2_dir.h ext2_inc.h fat_dir.h fatp.h file_found.h memmem.h ntfs_dir.h ntfsp.h ntfs_inc.h poptions.h sessionp.h setdate.h dfxml.h
+photorec_H = photorec.h phcfg.h dir.h exfatp.h ext2grp.h ext2p.h ext2_dir.h ext2_inc.h fat_dir.h fatp.h file_found.h geometry.h memmem.h ntfs_dir.h ntfsp.h ntfs_inc.h poptions.h sessionp.h setdate.h dfxml.h
-photorec_ncurses_C = addpart.c askloc.c chgtype.c chgtypen.c fat_cluster.c fat_unformat.c geometry.c hiddenn.c intrfn.c nodisk.c parti386n.c partgptn.c partmacn.c partsunn.c partxboxn.c pbanner.c pblocksize.c pdisksel.c pfree_whole.c phbf.c phbs.c phnc.c phrecn.c ppartsel.c
-photorec_ncurses_H = addpart.h askloc.h chgtype.h chgtypen.h fat_cluster.h fat_unformat.h geometry.h hiddenn.h intrfn.h nodisk.h parti386n.h partgptn.h partmacn.h partsunn.h partxboxn.h pblocksize.h pdisksel.h pfree_whole.h pnext.h phbf.h phbs.h phnc.h phrecn.h ppartsel.h
+photorec_ncurses_C = addpart.c askloc.c chgtype.c chgtypen.c fat_cluster.c fat_unformat.c geometryn.c hiddenn.c intrfn.c nodisk.c parti386n.c partgptn.c partmacn.c partsunn.c partxboxn.c pbanner.c pblocksize.c pdisksel.c pfree_whole.c phbf.c phbs.c phnc.c phrecn.c ppartsel.c
+photorec_ncurses_H = addpart.h askloc.h chgtype.h chgtypen.h fat_cluster.h fat_unformat.h geometryn.h hiddenn.h intrfn.h nodisk.h parti386n.h partgptn.h partmacn.h partsunn.h partxboxn.h pblocksize.h pdisksel.h pfree_whole.h pnext.h phbf.h phbs.h phnc.h phrecn.h ppartsel.h
photorec_SOURCES = phmain.c $(photorec_C) $(photorec_H) $(photorec_ncurses_C) $(photorec_ncurses_H) $(file_C) $(file_H) $(base_C) $(base_H) partgptro.c $(fs_C) $(fs_H) $(ICON_PHOTOREC) suspend_no.c
diff --git a/src/geometry.c b/src/geometry.c
index 749f3a4..52eef51 100644
--- a/src/geometry.c
+++ b/src/geometry.c
@@ -43,14 +43,14 @@
#define MAX_HEADS 255u
-static inline void set_cylinders_from_size_up(disk_t *disk_car)
+void set_cylinders_from_size_up(disk_t *disk_car)
{
disk_car->geom.cylinders=(disk_car->disk_size / disk_car->sector_size +
(uint64_t)disk_car->geom.sectors_per_head * disk_car->geom.heads_per_cylinder - 1) /
((uint64_t)disk_car->geom.sectors_per_head * disk_car->geom.heads_per_cylinder);
}
-static int change_sector_size(disk_t *disk, const int cyl_modified, const unsigned int sector_size)
+int change_sector_size(disk_t *disk, const int cyl_modified, const unsigned int sector_size)
{
/* Using 3*512=1536 as sector size and */
/* 63/3=21 for number of sectors is an easy way to test */
@@ -74,12 +74,14 @@ static int change_sector_size(disk_t *disk, const int cyl_modified, const unsign
}
}
-static int change_geometry_cli(disk_t *disk_car, char ** current_cmd)
+int change_geometry_cli(disk_t *disk_car, char ** current_cmd)
{
int done = 0;
int tmp_val=0;
int cyl_modified=0;
int geo_modified=0;
+ if(*current_cmd==NULL)
+ return 0;
log_info("Current geometry\n%s sector_size=%u\n", disk_car->description(disk_car), disk_car->sector_size);
while (done==0)
{
@@ -160,168 +162,11 @@ static int change_geometry_cli(disk_t *disk_car, char ** current_cmd)
disk_car->disk_real_size=disk_car->disk_size;
#endif
log_info("New geometry\n%s sector_size=%u\n", disk_car->description(disk_car), disk_car->sector_size);
+ autoset_unit(disk_car);
if(geo_modified==2)
- return 1;
- }
- return 0;
-}
-
-#ifdef HAVE_NCURSES
-static int change_geometry_ncurses(disk_t *disk_car)
-{
- int done = 0;
- char def[128];
- char response[128];
- long int tmp_val=0;
- int command;
- int default_option=4;
- int cyl_modified=0;
- int geo_modified=0;
- while (done==0)
- {
- static struct MenuItem menuGeometry[]=
{
- { 'c', "Cylinders", "Change cylinder geometry" },
- { 'h', "Heads", "Change head geometry" },
- { 's', "Sectors", "Change sector geometry" },
- { 'n', "Sector Size", "Change sector size (WARNING: VERY DANGEROUS!)" },
- { 'q', "Ok", "Done with changing geometry" },
- { 0, NULL, NULL }
- };
- aff_copy(stdscr);
- wmove(stdscr,5,0);
- wprintw(stdscr,"%s, sector size=%u\n",disk_car->description(disk_car),disk_car->sector_size);
- wmove(stdscr,7,0);
- wprintw(stdscr,"Because these numbers change the way that TestDisk looks for partitions");
- wmove(stdscr,8,0);
- wprintw(stdscr,"and calculates their sizes, it's important to have the correct disk geometry.");
- wmove(stdscr,9,0);
- wprintw(stdscr,"PC partitioning programs often make partitions end on cylinder boundaries.");
- wmove(stdscr,11,0);
- wprintw(stdscr,"A partition's CHS values are based on disk translations which make them");
- wmove(stdscr,12,0);
- wprintw(stdscr,"different than its physical geometry. The most common CHS head values");
- wmove(stdscr,13,0);
- wprintw(stdscr,"are: 255, 240 and sometimes 16.");
- wmove(stdscr,INTER_GEOM_Y, INTER_GEOM_X);
- wclrtoeol(stdscr);
- wrefresh(stdscr);
- command=wmenuSimple(stdscr,menuGeometry, default_option);
- switch (command) {
- case 'c':
- case 'C':
- {
- sprintf(def, "%lu", disk_car->geom.cylinders);
- mvwaddstr(stdscr,INTER_GEOM_Y, INTER_GEOM_X, "Enter the number of cylinders: ");
- wclrtoeol(stdscr);
- if (get_string(stdscr, response, sizeof(response), def) > 0) {
- tmp_val = atol(response);
- if (tmp_val > 0) {
- disk_car->geom.cylinders = tmp_val;
- cyl_modified=1;
- if(geo_modified==0)
- geo_modified=1;
- } else
- wprintw(stdscr,"Illegal cylinders value");
- }
- }
- default_option=1;
- break;
- case 'h':
- case 'H':
- {
- sprintf(def, "%u", disk_car->geom.heads_per_cylinder);
- mvwaddstr(stdscr,INTER_GEOM_Y, INTER_GEOM_X, "Enter the number of heads (1-255): ");
- wclrtoeol(stdscr);
- if (get_string(stdscr, response, sizeof(response), def) > 0) {
- tmp_val = atoi(response);
- if (tmp_val > 0 && tmp_val <= MAX_HEADS) {
- disk_car->geom.heads_per_cylinder = tmp_val;
- if(geo_modified==0)
- geo_modified=1;
- if(cyl_modified==0)
- set_cylinders_from_size_up(disk_car);
- } else
- wprintw(stdscr,"Illegal heads value");
- }
- }
- default_option=2;
- break;
- case 's':
- case 'S':
- {
- sprintf(def, "%u", disk_car->geom.sectors_per_head);
- /* FIXME SUN partition can have more than 63 sectors */
- mvwaddstr(stdscr,INTER_GEOM_Y, INTER_GEOM_X, "Enter the number of sectors per track (1-63): ");
- wclrtoeol(stdscr);
- if (get_string(stdscr, response, sizeof(response), def) > 0)
- {
- tmp_val = atoi(response);
- /* TODO Check for the maximum value */
- if (tmp_val > 0) {
- disk_car->geom.sectors_per_head = tmp_val;
- if(geo_modified==0)
- geo_modified=1;
- if(cyl_modified==0)
- set_cylinders_from_size_up(disk_car);
- } else
- wprintw(stdscr,"Illegal sectors value");
- }
- }
- default_option=3;
- break;
- case 'n':
- case 'N':
- {
- sprintf(def, "%u", disk_car->sector_size);
- mvwaddstr(stdscr,INTER_GEOM_Y, INTER_GEOM_X, "Enter the sector size (512, 1024, 2048, 4096, 8192): ");
- wclrtoeol(stdscr);
- if (get_string(stdscr, response, sizeof(response), def) > 0) {
- tmp_val = atoi(response);
- if(change_sector_size(disk_car, cyl_modified, tmp_val))
- wprintw(stdscr,"Illegal sector size");
- else
- geo_modified=2;
- }
- }
- default_option=4;
- break;
- case key_ESC:
- case 'q':
- case 'Q':
- done = 1;
- break;
- }
- if(cyl_modified!=0)
- disk_car->disk_size=(uint64_t)disk_car->geom.cylinders*disk_car->geom.heads_per_cylinder*disk_car->geom.sectors_per_head*disk_car->sector_size;
- }
- if(geo_modified!=0)
- {
- disk_car->disk_size=(uint64_t)disk_car->geom.cylinders*disk_car->geom.heads_per_cylinder*disk_car->geom.sectors_per_head*disk_car->sector_size;
-#ifdef __APPLE__
- /* On MacOSX if HD contains some bad sectors, the disk size may not be correctly detected */
- disk_car->disk_real_size=disk_car->disk_size;
-#endif
- log_info("New geometry\n%s sector_size=%u\n", disk_car->description(disk_car), disk_car->sector_size);
- if(geo_modified==2)
return 1;
+ }
}
return 0;
}
-#endif
-
-int change_geometry(disk_t *disk_car, char ** current_cmd)
-{
- int res=0;
- if(*current_cmd!=NULL)
- {
- res=change_geometry_cli(disk_car, current_cmd);
- autoset_unit(disk_car);
- return res;
- }
-#ifdef HAVE_NCURSES
- res=change_geometry_ncurses(disk_car);
-#endif
- autoset_unit(disk_car);
- return res;
-}
diff --git a/src/geometry.h b/src/geometry.h
index 778df3d..98993c2 100644
--- a/src/geometry.h
+++ b/src/geometry.h
@@ -23,7 +23,9 @@
extern "C" {
#endif
-int change_geometry(disk_t *disk_car, char **current_cmd);
+void set_cylinders_from_size_up(disk_t *disk);
+int change_sector_size(disk_t *disk, const int cyl_modified, const unsigned int sector_size);
+int change_geometry_cli(disk_t *disk, char **current_cmd);
#ifdef __cplusplus
} /* closing brace for extern "C" */
diff --git a/src/geometryn.c b/src/geometryn.c
new file mode 100644
index 0000000..c80c6b7
--- /dev/null
+++ b/src/geometryn.c
@@ -0,0 +1,188 @@
+/*
+
+ File: geometryn.c
+
+ Copyright (C) 1998-2013 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write the Free Software Foundation, Inc., 51
+ Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#include "types.h"
+#include "common.h"
+#include "intrf.h"
+#ifdef HAVE_NCURSES
+#include "intrfn.h"
+#endif
+#include "log.h"
+#include "hdaccess.h"
+#include "autoset.h"
+#include "geometry.h"
+#include "geometryn.h"
+
+#define MAX_HEADS 255u
+
+int change_geometry_ncurses(disk_t *disk_car)
+{
+ int done = 0;
+ char def[128];
+ char response[128];
+ long int tmp_val=0;
+ int command;
+ int default_option=4;
+ int cyl_modified=0;
+ int geo_modified=0;
+ while (done==0)
+ {
+ static struct MenuItem menuGeometry[]=
+ {
+ { 'c', "Cylinders", "Change cylinder geometry" },
+ { 'h', "Heads", "Change head geometry" },
+ { 's', "Sectors", "Change sector geometry" },
+ { 'n', "Sector Size", "Change sector size (WARNING: VERY DANGEROUS!)" },
+ { 'q', "Ok", "Done with changing geometry" },
+ { 0, NULL, NULL }
+ };
+ aff_copy(stdscr);
+ wmove(stdscr,5,0);
+ wprintw(stdscr,"%s, sector size=%u\n",disk_car->description(disk_car),disk_car->sector_size);
+ wmove(stdscr,7,0);
+ wprintw(stdscr,"Because these numbers change the way that TestDisk looks for partitions");
+ wmove(stdscr,8,0);
+ wprintw(stdscr,"and calculates their sizes, it's important to have the correct disk geometry.");
+ wmove(stdscr,9,0);
+ wprintw(stdscr,"PC partitioning programs often make partitions end on cylinder boundaries.");
+ wmove(stdscr,11,0);
+ wprintw(stdscr,"A partition's CHS values are based on disk translations which make them");
+ wmove(stdscr,12,0);
+ wprintw(stdscr,"different than its physical geometry. The most common CHS head values");
+ wmove(stdscr,13,0);
+ wprintw(stdscr,"are: 255, 240 and sometimes 16.");
+ wmove(stdscr,INTER_GEOM_Y, INTER_GEOM_X);
+ wclrtoeol(stdscr);
+ wrefresh(stdscr);
+ command=wmenuSimple(stdscr,menuGeometry, default_option);
+ switch (command) {
+ case 'c':
+ case 'C':
+ {
+ sprintf(def, "%lu", disk_car->geom.cylinders);
+ mvwaddstr(stdscr,INTER_GEOM_Y, INTER_GEOM_X, "Enter the number of cylinders: ");
+ wclrtoeol(stdscr);
+ if (get_string(stdscr, response, sizeof(response), def) > 0) {
+ tmp_val = atol(response);
+ if (tmp_val > 0) {
+ disk_car->geom.cylinders = tmp_val;
+ cyl_modified=1;
+ if(geo_modified==0)
+ geo_modified=1;
+ } else
+ wprintw(stdscr,"Illegal cylinders value");
+ }
+ }
+ default_option=1;
+ break;
+ case 'h':
+ case 'H':
+ {
+ sprintf(def, "%u", disk_car->geom.heads_per_cylinder);
+ mvwaddstr(stdscr,INTER_GEOM_Y, INTER_GEOM_X, "Enter the number of heads (1-255): ");
+ wclrtoeol(stdscr);
+ if (get_string(stdscr, response, sizeof(response), def) > 0) {
+ tmp_val = atoi(response);
+ if (tmp_val > 0 && tmp_val <= MAX_HEADS) {
+ disk_car->geom.heads_per_cylinder = tmp_val;
+ if(geo_modified==0)
+ geo_modified=1;
+ if(cyl_modified==0)
+ set_cylinders_from_size_up(disk_car);
+ } else
+ wprintw(stdscr,"Illegal heads value");
+ }
+ }
+ default_option=2;
+ break;
+ case 's':
+ case 'S':
+ {
+ sprintf(def, "%u", disk_car->geom.sectors_per_head);
+ /* FIXME SUN partition can have more than 63 sectors */
+ mvwaddstr(stdscr,INTER_GEOM_Y, INTER_GEOM_X, "Enter the number of sectors per track (1-63): ");
+ wclrtoeol(stdscr);
+ if (get_string(stdscr, response, sizeof(response), def) > 0)
+ {
+ tmp_val = atoi(response);
+ /* TODO Check for the maximum value */
+ if (tmp_val > 0) {
+ disk_car->geom.sectors_per_head = tmp_val;
+ if(geo_modified==0)
+ geo_modified=1;
+ if(cyl_modified==0)
+ set_cylinders_from_size_up(disk_car);
+ } else
+ wprintw(stdscr,"Illegal sectors value");
+ }
+ }
+ default_option=3;
+ break;
+ case 'n':
+ case 'N':
+ {
+ sprintf(def, "%u", disk_car->sector_size);
+ mvwaddstr(stdscr,INTER_GEOM_Y, INTER_GEOM_X, "Enter the sector size (512, 1024, 2048, 4096, 8192): ");
+ wclrtoeol(stdscr);
+ if (get_string(stdscr, response, sizeof(response), def) > 0) {
+ tmp_val = atoi(response);
+ if(change_sector_size(disk_car, cyl_modified, tmp_val))
+ wprintw(stdscr,"Illegal sector size");
+ else
+ geo_modified=2;
+ }
+ }
+ default_option=4;
+ break;
+ case key_ESC:
+ case 'q':
+ case 'Q':
+ done = 1;
+ break;
+ }
+ if(cyl_modified!=0)
+ disk_car->disk_size=(uint64_t)disk_car->geom.cylinders*disk_car->geom.heads_per_cylinder*disk_car->geom.sectors_per_head*disk_car->sector_size;
+ }
+ if(geo_modified!=0)
+ {
+ disk_car->disk_size=(uint64_t)disk_car->geom.cylinders*disk_car->geom.heads_per_cylinder*disk_car->geom.sectors_per_head*disk_car->sector_size;
+#ifdef __APPLE__
+ /* On MacOSX if HD contains some bad sectors, the disk size may not be correctly detected */
+ disk_car->disk_real_size=disk_car->disk_size;
+#endif
+ log_info("New geometry\n%s sector_size=%u\n", disk_car->description(disk_car), disk_car->sector_size);
+ autoset_unit(disk_car);
+ if(geo_modified==2)
+ return 1;
+ }
+ return 0;
+}
diff --git a/src/geometryn.h b/src/geometryn.h
new file mode 100644
index 0000000..4440aa9
--- /dev/null
+++ b/src/geometryn.h
@@ -0,0 +1,30 @@
+/*
+
+ File: geometryn.h
+
+ Copyright (C) 1998-2013 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write the Free Software Foundation, Inc., 51
+ Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int change_geometry_ncurses(disk_t *disk);
+
+#ifdef __cplusplus
+} /* closing brace for extern "C" */
+#endif
diff --git a/src/ppartsel.c b/src/ppartsel.c
index ae8720f..7a6a1c7 100644
--- a/src/ppartsel.c
+++ b/src/ppartsel.c
@@ -50,6 +50,7 @@
#include "ppartsel.h"
#include "askloc.h"
#include "geometry.h"
+#include "geometryn.h"
#include "addpart.h"
#include "intrfn.h"
#include "poptions.h"
@@ -207,7 +208,7 @@ void menu_photorec(struct ph_param *params, struct ph_options *options, alloc_da
else if(strncmp(params->cmd_run,"geometry,",9)==0)
{
params->cmd_run+=9;
- change_geometry(params->disk, &params->cmd_run);
+ change_geometry_cli(params->disk, &params->cmd_run);
}
else if(strncmp(params->cmd_run,"inter",5)==0)
{ /* Start interactive mode */
@@ -440,7 +441,7 @@ void menu_photorec(struct ph_param *params, struct ph_options *options, alloc_da
case 'g':
case 'G':
if(options->expert!=0)
- if(change_geometry(params->disk, &params->cmd_run))
+ if(change_geometry_ncurses(params->disk))
done=1;
break;
case 'a':
diff --git a/src/tdiskop.c b/src/tdiskop.c
index 2df38bb..091520b 100644
--- a/src/tdiskop.c
+++ b/src/tdiskop.c
@@ -45,6 +45,7 @@
#include "tdelete.h"
#include "tdiskop.h"
#include "geometry.h"
+#include "geometryn.h"
extern const arch_fnct_t arch_i386;
extern const arch_fnct_t arch_none;
@@ -76,7 +77,7 @@ static int menu_disk_cli(disk_t *disk_car, const int verbose,int dump_ind, const
else if(strncmp(*current_cmd,"geometry,",9)==0)
{
(*current_cmd)+=9;
- change_geometry(disk_car, current_cmd);
+ change_geometry_cli(disk_car, current_cmd);
}
else if(strncmp(*current_cmd,"advanced",8)==0)
{
@@ -172,7 +173,7 @@ static int menu_disk_ncurses(disk_t *disk, const int verbose,int dump_ind, const
break;
case 'g':
case 'G':
- change_geometry(disk, current_cmd);
+ change_geometry_ncurses(disk);
break;
case 'o':
case 'O':