summaryrefslogtreecommitdiffstats
path: root/src/ext2_sb.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2008-08-24 13:36:34 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2008-08-24 13:36:34 +0200
commit9a58a494f354766e1bda5ca0f72e0af60f5124de (patch)
treebfabf63ee6684f79b6f724f2cda5de8b5fadbc76 /src/ext2_sb.c
parent05241d82968e9ee7195a424091e733b43d776945 (diff)
Split the interface in several files
Initial work to handle 24 lines and more than 25
Diffstat (limited to 'src/ext2_sb.c')
-rw-r--r--src/ext2_sb.c92
1 files changed, 92 insertions, 0 deletions
diff --git a/src/ext2_sb.c b/src/ext2_sb.c
new file mode 100644
index 0000000..26b84ac
--- /dev/null
+++ b/src/ext2_sb.c
@@ -0,0 +1,92 @@
+/*
+
+ File: ext2_sb.c
+
+ Copyright (C) 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
+ 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
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#include "types.h"
+#include "common.h"
+#include "lang.h"
+#include "intrf.h"
+#ifdef HAVE_NCURSES
+#include "intrfn.h"
+#else
+#include <stdio.h>
+#endif
+#include "log.h"
+#include "guid_cmp.h"
+#include "ext2_sb.h"
+
+int interface_superblock(disk_t *disk_car,list_part_t *list_part, char**current_cmd)
+{
+ const list_part_t *parts;
+ const partition_t *old_part=NULL;
+#ifdef HAVE_NCURSES
+ struct MenuItem menuSuperblock[]=
+ {
+ { 'P', "Previous",""},
+ { 'N', "Next","" },
+ { 'Q',"Quit","Return to Advanced menu"},
+ { 0, NULL, NULL }
+ };
+#endif
+ screen_buffer_reset();
+#ifdef HAVE_NCURSES
+ aff_copy(stdscr);
+ wmove(stdscr,4,0);
+ wprintw(stdscr,"%s",disk_car->description(disk_car));
+ wmove(stdscr,5,0);
+ mvwaddstr(stdscr,6,0,msg_PART_HEADER_LONG);
+#endif
+ for(parts=list_part;parts!=NULL;parts=parts->next)
+ {
+ const partition_t *partition=parts->part;
+ if(old_part==NULL ||
+ old_part->part_offset!=partition->part_offset ||
+ old_part->part_size!=partition->part_size ||
+ guid_cmp(old_part->part_type_gpt, partition->part_type_gpt)!=0 ||
+ old_part->part_type_i386!=partition->part_type_i386 ||
+ old_part->part_type_sun!=partition->part_type_sun ||
+ old_part->part_type_mac!=partition->part_type_mac ||
+ old_part->upart_type!=partition->upart_type)
+ {
+ aff_part_buffer(AFF_PART_BASE, disk_car, partition);
+ old_part=partition;
+ }
+ if(partition->blocksize!=0)
+ screen_buffer_add("superblock %lu, blocksize=%u\n",
+ (long unsigned)(partition->sb_offset/partition->blocksize),
+ partition->blocksize);
+ }
+ screen_buffer_to_log();
+ if(*current_cmd==NULL)
+ {
+ log_flush();
+#ifdef HAVE_NCURSES
+ screen_buffer_display(stdscr,"",menuSuperblock);
+#endif
+ }
+ return 0;
+}