#include <ext4.h>
#include <ext4_mbr.h>
-#include "../blockdev/linux/ext4_filedev.h"
-#include "../blockdev/windows/io_raw.h"
+#include "../blockdev/linux/file_dev.h"
+#include "../blockdev/windows/file_windows.h"
/**@brief Input stream name.*/
const char *input_name = NULL;
static bool open_linux(void)
{
- ext4_filedev_filename(input_name);
- bd = ext4_filedev_get();
+ file_dev_name_set(input_name);
+ bd = file_dev_get();
if (!bd) {
printf("open_filedev: fail\n");
return false;
static bool open_windows(void)
{
#ifdef WIN32
- ext4_io_raw_filename(input_name);
- bd = ext4_io_raw_dev_get();
+ file_windows_name_set(input_name);
+ bd = file_windows_dev_get();
if (!bd) {
printf("open_winpartition: fail\n");
return false;
static bool open_filedev(void)
{
- if (winpart) {
- if (!open_windows())
- return false;
- } else {
- if (!open_linux())
- return false;
- }
-
- return true;
+ return winpart ? open_windows() : open_linux();
}
static bool parse_opt(int argc, char **argv)
{"input", required_argument, 0, 'i'},
{"wpart", no_argument, 0, 'w'},
{"verbose", no_argument, 0, 'v'},
+ {"version", no_argument, 0, 'x'},
{0, 0, 0, 0}};
- while (-1 != (c = getopt_long(argc, argv, "i:wv",
+ while (-1 != (c = getopt_long(argc, argv, "i:wvx",
long_options, &option_index))) {
switch (c) {
case 'v':
verbose = true;
break;
+ case 'x':
+ puts(VERSION);
+ exit(0);
+ break;
default:
printf("%s", usage);
return false;
continue;
}
- printf("\toffeset: 0x%llx, %lluMB\n",
+ printf("\toffeset: 0x%"PRIx64", %"PRIu64"MB\n",
bdevs.partitions[i].part_offset,
bdevs.partitions[i].part_offset / (1024 * 1024));
- printf("\tsize: 0x%llx, %lluMB\n",
+ printf("\tsize: 0x%"PRIx64", %"PRIu64"MB\n",
bdevs.partitions[i].part_size,
bdevs.partitions[i].part_size / (1024 * 1024));
}