summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/analyse.c67
-rw-r--r--src/common.h1
-rw-r--r--src/ewf.c9
-rw-r--r--src/godmode.c20
-rw-r--r--src/hdaccess.c11
-rw-r--r--src/hdcache.c12
-rw-r--r--src/io_redir.c9
-rw-r--r--src/msdos.c9
-rw-r--r--src/partnone.c5
-rw-r--r--src/win32.c9
10 files changed, 38 insertions, 114 deletions
diff --git a/src/analyse.c b/src/analyse.c
index f58538f..07508df 100644
--- a/src/analyse.c
+++ b/src/analyse.c
@@ -63,11 +63,10 @@
int search_NTFS_backup(unsigned char *buffer, disk_t *disk, partition_t *partition, const int verbose, const int dump_ind)
{
- void *data=disk->pread_fast(disk, buffer, DEFAULT_SECTOR_SIZE, partition->part_offset);
- if(data==NULL)
+ if(disk->pread(disk, buffer, DEFAULT_SECTOR_SIZE, partition->part_offset) != DEFAULT_SECTOR_SIZE)
return -1;
{
- const struct ntfs_boot_sector*ntfs_header=(const struct ntfs_boot_sector*)data;
+ const struct ntfs_boot_sector*ntfs_header=(const struct ntfs_boot_sector*)buffer;
/* NTFS recovery using backup sector */
if(le16(ntfs_header->marker)==0xAA55 &&
recover_NTFS(disk, ntfs_header, partition, verbose, dump_ind, 1)==0)
@@ -78,12 +77,11 @@ int search_NTFS_backup(unsigned char *buffer, disk_t *disk, partition_t *partiti
int search_HFS_backup(unsigned char *buffer, disk_t *disk, partition_t *partition, const int verbose, const int dump_ind)
{
- void *data=disk->pread_fast(disk, buffer, 0x400, partition->part_offset);
- if(data==NULL)
+ if(disk->pread(disk, buffer, 0x400, partition->part_offset)!= DEFAULT_SECTOR_SIZE)
return -1;
{
- const hfs_mdb_t *hfs_mdb=(const hfs_mdb_t *)data;
- const struct hfsp_vh *vh=(const struct hfsp_vh *)data;
+ const hfs_mdb_t *hfs_mdb=(const hfs_mdb_t *)buffer;
+ const struct hfsp_vh *vh=(const struct hfsp_vh *)buffer;
/* HFS recovery using backup sector */
if(hfs_mdb->drSigWord==be16(HFS_SUPER_MAGIC) &&
recover_HFS(disk, hfs_mdb, partition, verbose, dump_ind, 1)==0)
@@ -103,11 +101,10 @@ int search_HFS_backup(unsigned char *buffer, disk_t *disk, partition_t *partitio
int search_EXFAT_backup(unsigned char *buffer, disk_t *disk, partition_t *partition)
{
- void *data=disk->pread_fast(disk, buffer, DEFAULT_SECTOR_SIZE, partition->part_offset);
- if(data==NULL)
+ if(disk->pread(disk, buffer, DEFAULT_SECTOR_SIZE, partition->part_offset) != DEFAULT_SECTOR_SIZE)
return -1;
{
- const struct exfat_super_block *exfat_header=(const struct exfat_super_block *)data;
+ const struct exfat_super_block *exfat_header=(const struct exfat_super_block *)buffer;
/* EXFAT recovery using backup sector */
if(le16(exfat_header->signature)==0xAA55 &&
recover_EXFAT(disk, exfat_header, partition)==0)
@@ -121,11 +118,10 @@ int search_EXFAT_backup(unsigned char *buffer, disk_t *disk, partition_t *partit
int search_FAT_backup(unsigned char *buffer, disk_t *disk, partition_t *partition, const int verbose, const int dump_ind)
{
- void *data=disk->pread_fast(disk, buffer, DEFAULT_SECTOR_SIZE, partition->part_offset);
- if(data==NULL)
+ if(disk->pread(disk, buffer, DEFAULT_SECTOR_SIZE, partition->part_offset)!=DEFAULT_SECTOR_SIZE)
return -1;
{
- const struct fat_boot_sector *fat_header=(const struct fat_boot_sector *)data;
+ const struct fat_boot_sector *fat_header=(const struct fat_boot_sector *)buffer;
/* FAT32 recovery using backup sector */
if(le16(fat_header->marker)==0xAA55 &&
recover_FAT(disk, fat_header, partition, verbose, dump_ind, 1)==0)
@@ -286,19 +282,17 @@ int search_type_2(const unsigned char *buffer, disk_t *disk, partition_t *partit
int search_type_8(unsigned char *buffer, disk_t *disk,partition_t *partition,const int verbose, const int dump_ind)
{
- void *data;
if(verbose>2)
{
log_trace("search_type_8 lba=%lu\n",
(long unsigned)(partition->part_offset/disk->sector_size));
}
- data=disk->pread_fast(disk, buffer, 4096, partition->part_offset + 4096);
- if(data==NULL)
+ if(disk->pread(disk, buffer, 4096, partition->part_offset + 4096) != 4096)
return -1;
{ /* MD 1.2 */
- const struct mdp_superblock_1 *sb1=(const struct mdp_superblock_1 *)data;
+ const struct mdp_superblock_1 *sb1=(const struct mdp_superblock_1 *)buffer;
if(le32(sb1->major_version)==1 &&
- recover_MD(disk, (const struct mdp_superblock_s*)data, partition, verbose, dump_ind)==0)
+ recover_MD(disk, (const struct mdp_superblock_s*)buffer, partition, verbose, dump_ind)==0)
{
partition->part_offset-=(uint64_t)le64(sb1->super_offset)*512-4096;
return 1;
@@ -309,19 +303,17 @@ int search_type_8(unsigned char *buffer, disk_t *disk,partition_t *partition,con
int search_type_16(unsigned char *buffer, disk_t *disk,partition_t *partition,const int verbose, const int dump_ind)
{
- void *data;
if(verbose>2)
{
log_trace("search_type_16 lba=%lu\n",
(long unsigned)(partition->part_offset/disk->sector_size));
}
/* 8k offset */
- data=disk->pread_fast(disk, buffer, 3 * DEFAULT_SECTOR_SIZE, partition->part_offset + 16 * 512);
- if(data==NULL)
+ if(disk->pread(disk, buffer, 3 * DEFAULT_SECTOR_SIZE, partition->part_offset + 16 * 512) != 3 * DEFAULT_SECTOR_SIZE)
return -1;
{
- const struct ufs_super_block *ufs=(const struct ufs_super_block *)data;
- const struct vdev_boot_header *zfs=(const struct vdev_boot_header*)data;
+ const struct ufs_super_block *ufs=(const struct ufs_super_block *)buffer;
+ const struct vdev_boot_header *zfs=(const struct vdev_boot_header*)buffer;
/* Test UFS */
if((le32(ufs->fs_magic)==UFS_MAGIC || be32(ufs->fs_magic)==UFS_MAGIC ||
le32(ufs->fs_magic)==UFS2_MAGIC || be32(ufs->fs_magic)==UFS2_MAGIC) &&
@@ -336,19 +328,16 @@ int search_type_16(unsigned char *buffer, disk_t *disk,partition_t *partition,co
int search_type_64(unsigned char *buffer, disk_t *disk,partition_t *partition,const int verbose, const int dump_ind)
{
- void *data;
if(verbose>2)
{
log_trace("search_type_64 lba=%lu\n",
(long unsigned)(partition->part_offset/disk->sector_size));
}
/* 32k offset */
- data=disk->pread_fast(disk, buffer, 3 * DEFAULT_SECTOR_SIZE, partition->part_offset + 63 * 512);
- if(data==NULL)
+ if(disk->pread(disk, buffer, 3 * DEFAULT_SECTOR_SIZE, partition->part_offset + 63 * 512) != 3 * DEFAULT_SECTOR_SIZE)
return -1;
- data=(char*)data+0x200;
{
- const struct jfs_superblock* jfs=(const struct jfs_superblock*)data;
+ const struct jfs_superblock* jfs=(const struct jfs_superblock*)(buffer+0x200);
/* Test JFS */
if(memcmp(jfs->s_magic,"JFS1",4)==0 &&
recover_JFS(disk, jfs, partition, verbose, dump_ind)==0)
@@ -359,22 +348,20 @@ int search_type_64(unsigned char *buffer, disk_t *disk,partition_t *partition,co
int search_type_128(unsigned char *buffer, disk_t *disk, partition_t *partition, const int verbose, const int dump_ind)
{
- void *data;
if(verbose>2)
{
log_trace("search_type_128 lba=%lu\n",
(long unsigned)(partition->part_offset/disk->sector_size));
}
- data=disk->pread_fast(disk, buffer, 11 * DEFAULT_SECTOR_SIZE, partition->part_offset + 126 * 512);
- if(data==NULL)
+ if(disk->pread(disk, buffer, 11 * DEFAULT_SECTOR_SIZE, partition->part_offset + 126 * 512) != 11 * DEFAULT_SECTOR_SIZE)
return -1;
- data=(char*)data+0x400;
+ buffer=buffer+0x400;
{
- 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;
- const struct gfs2_sb *gfs2=(const struct gfs2_sb *)data;
+ const struct reiserfs_super_block *rfs=(const struct reiserfs_super_block *)buffer;
+ const struct reiser4_master_sb *rfs4=(const struct reiser4_master_sb *)buffer;
+ const struct ufs_super_block *ufs=(const struct ufs_super_block *)buffer;
+ const struct btrfs_super_block *btrfs=(const struct btrfs_super_block*)buffer;
+ const struct gfs2_sb *gfs2=(const struct gfs2_sb *)buffer;
/* 64k offset */
/* Test ReiserFS */
if((memcmp(rfs->s_magic,"ReIs",4) == 0 ||
@@ -398,17 +385,15 @@ int search_type_128(unsigned char *buffer, disk_t *disk, partition_t *partition,
int search_type_2048(unsigned char *buffer, disk_t *disk, partition_t *partition, const int verbose, const int dump_ind)
{
- void *data;
if(verbose>2)
{
log_trace("search_type_2048 lba=%lu\n",
(long unsigned)(partition->part_offset/disk->sector_size));
}
- data=disk->pread_fast(disk, buffer, 2*DEFAULT_SECTOR_SIZE, partition->part_offset + 2048 * 512);
- if(data==NULL)
+ if(disk->pread(disk, buffer, 2*DEFAULT_SECTOR_SIZE, partition->part_offset + 2048 * 512) != 2*DEFAULT_SECTOR_SIZE)
return -1;
{
- const struct vmfs_volume *sb_vmfs=(const struct vmfs_volume *)data;
+ const struct vmfs_volume *sb_vmfs=(const struct vmfs_volume *)buffer;
if(le32(sb_vmfs->magic)==0xc001d00d &&
recover_VMFS(disk, sb_vmfs, partition, verbose, dump_ind)==0)
return 1;
diff --git a/src/common.h b/src/common.h
index 93bb565..31794d8 100644
--- a/src/common.h
+++ b/src/common.h
@@ -362,7 +362,6 @@ struct param_disk_struct
char *fw_rev;
const char *(*description)(disk_t *disk);
const char *(*description_short)(disk_t *disk);
- void *(*pread_fast)(disk_t *disk, void *buf, const unsigned int count, const uint64_t offset);
int (*pread)(disk_t *disk, void *buf, const unsigned int count, const uint64_t offset);
int (*pwrite)(disk_t *disk, const void *buf, const unsigned int count, const uint64_t offset);
int (*sync)(disk_t *disk);
diff --git a/src/ewf.c b/src/ewf.c
index e301d79..e68debc 100644
--- a/src/ewf.c
+++ b/src/ewf.c
@@ -77,7 +77,6 @@ extern const arch_fnct_t arch_none;
static const char *fewf_description(disk_t *disk);
static const char *fewf_description_short(disk_t *disk);
static void fewf_clean(disk_t *disk);
-static void *fewf_pread_fast(disk_t *disk, void *buffer, const unsigned int count, const uint64_t offset);
static int fewf_pread(disk_t *disk, void *buffer, const unsigned int count, const uint64_t offset);
static int fewf_nopwrite(disk_t *disk, const void *buffer, const unsigned int count, const uint64_t offset);
static int fewf_pwrite(disk_t *disk, const void *buffer, const unsigned int count, const uint64_t offset);
@@ -266,7 +265,6 @@ disk_t *fewf_init(const char *device, const int mode)
disk->data=data;
disk->description=fewf_description;
disk->description_short=fewf_description_short;
- disk->pread_fast=fewf_pread_fast;
disk->pread=fewf_pread;
disk->pwrite=(data->mode&TESTDISK_O_RDWR?fewf_pwrite:fewf_nopwrite);
disk->sync=fewf_sync;
@@ -455,13 +453,6 @@ static int fewf_pwrite(disk_t *disk, const void *buffer, const unsigned int coun
return taille;
}
-static void *fewf_pread_fast(disk_t *disk, void *buf, const unsigned int count, const uint64_t offset)
-{
- if(fewf_pread(disk, buf, count, offset)==offset)
- return buf;
- return NULL;
-}
-
static int fewf_nopwrite(disk_t *disk, const void *buffer, const unsigned int count, const uint64_t offset)
{
log_error("fewf_nopwrite(xx,%u,buffer,%lu(%u/%u/%u)) write refused\n",
diff --git a/src/godmode.c b/src/godmode.c
index adb0aab..617ae49 100644
--- a/src/godmode.c
+++ b/src/godmode.c
@@ -573,12 +573,11 @@ static list_part_t *search_part(disk_t *disk_car, const list_part_t *list_part_o
{
if(search_now_raid>0 || fast_mode>1)
{ /* Search Linux software RAID */
- void *data=disk_car->pread_fast(disk_car, buffer_disk, 8 * DEFAULT_SECTOR_SIZE, search_location);
- if(data!=NULL)
+ if(disk_car->pread(disk_car, buffer_disk, 8 * DEFAULT_SECTOR_SIZE, search_location) == 8 *DEFAULT_SECTOR_SIZE)
{
- if(recover_MD(disk_car, (const struct mdp_superblock_s*)data, partition, verbose, dump_ind)==0)
+ if(recover_MD(disk_car, (const struct mdp_superblock_s*)buffer_disk, partition, verbose, dump_ind)==0)
{
- const struct mdp_superblock_1 *sb1=(const struct mdp_superblock_1 *)data;
+ const struct mdp_superblock_1 *sb1=(const struct mdp_superblock_1 *)buffer_disk;
if(le32(sb1->md_magic)==(unsigned int)MD_SB_MAGIC)
{
if(le32(sb1->major_version)==0)
@@ -666,10 +665,9 @@ static list_part_t *search_part(disk_t *disk_car, const list_part_t *list_part_o
if((disk_car->arch==&arch_i386 && start_ext2.sector==1 && (start_ext2.head<=2 || fast_mode>1)) ||
(disk_car->arch!=&arch_i386 && search_location%location_boundary==0))
{
- void *data=disk_car->pread_fast(disk_car, buffer_disk, 1024, search_location);
- if(data!=NULL)
+ if(disk_car->pread(disk_car, buffer_disk, 1024, search_location)==1024)
{
- const struct ext2_super_block *sb=(const struct ext2_super_block*)data;
+ const struct ext2_super_block *sb=(const struct ext2_super_block*)buffer_disk;
if(le16(sb->s_block_group_nr)>0)
{
if(le16(sb->s_magic)==EXT2_SUPER_MAGIC &&
@@ -726,7 +724,7 @@ static list_part_t *search_part(disk_t *disk_car, const list_part_t *list_part_o
if(res<=0 && test_nbr==12)
{
/* read to fill the cache */
- disk_car->pread_fast(disk_car, buffer_disk, 8 * DEFAULT_SECTOR_SIZE,
+ disk_car->pread(disk_car, buffer_disk, 8 * DEFAULT_SECTOR_SIZE,
partition->part_offset + (63 + 16) * 512);
/* Try to catch disklabel before BSD FFS partition */
res=search_type_128(buffer_disk,disk_car,partition,verbose,dump_ind);
@@ -898,13 +896,11 @@ static list_part_t *search_part(disk_t *disk_car, const list_part_t *list_part_o
unsigned int i;
for(i=32;i>0;i--)
{
- void *data;
partition->part_size=(uint64_t)0;
partition->part_offset=element->part->part_offset - i * disk_car->sector_size;
- data=disk_car->pread_fast(disk_car, buffer_disk, DEFAULT_SECTOR_SIZE, partition->part_offset);
- if(data!=NULL)
+ if(disk_car->pread(disk_car, buffer_disk, DEFAULT_SECTOR_SIZE, partition->part_offset)==DEFAULT_SECTOR_SIZE)
{
- if(recover_NTFS(disk_car, (const struct ntfs_boot_sector*)data, partition, verbose, dump_ind, 0)==0)
+ if(recover_NTFS(disk_car, (const struct ntfs_boot_sector*)buffer_disk, partition, verbose, dump_ind, 0)==0)
{
partition->status=STATUS_DELETED;
if(disk_car->arch->is_part_known(partition)!=0 && partition->part_size>1 &&
diff --git a/src/hdaccess.c b/src/hdaccess.c
index 74afa9e..60eeb49 100644
--- a/src/hdaccess.c
+++ b/src/hdaccess.c
@@ -151,7 +151,6 @@ struct info_file_struct
static void autoset_geometry(disk_t * disk_car, const unsigned char *buffer, const int verbose);
static void file_clean(disk_t *disk);
static int file_pread(disk_t *disk_car, void *buf, const unsigned int count, const uint64_t offset);
-static void *file_pread_fast(disk_t *disk, void *buf, const unsigned int count, const uint64_t offset);
static int file_pwrite(disk_t *disk_car, const void *buf, const unsigned int count, const uint64_t offset);
static int file_nopwrite(disk_t *disk_car, const void *buf, const unsigned int count, const uint64_t offset);
static int file_sync(disk_t *disk_car);
@@ -1244,13 +1243,6 @@ static int file_pread(disk_t *disk_car, void *buf, const unsigned int count, con
return align_pread(&file_pread_aux, disk_car, buf, count, offset);
}
-static void *file_pread_fast(disk_t *disk, void *buf, const unsigned int count, const uint64_t offset)
-{
- if(file_pread(disk, buf, count, offset)==offset)
- return buf;
- return NULL;
-}
-
static int file_pwrite_aux(disk_t *disk_car, const void *buf, const unsigned int count, const uint64_t offset)
{
int fd=((struct info_file_struct *)disk_car->data)->handle;
@@ -1476,7 +1468,6 @@ disk_t *file_test_availability(const char *device, const int verbose, int testdi
disk_car->data=data;
disk_car->description=file_description;
disk_car->description_short=file_description_short;
- disk_car->pread_fast=file_pread_fast;
disk_car->pread=file_pread;
disk_car->pwrite=((mode&O_RDWR)==O_RDWR?file_pwrite:file_nopwrite);
disk_car->sync=file_sync;
@@ -1554,11 +1545,13 @@ disk_t *file_test_availability(const char *device, const int verbose, int testdi
disk_car->geom.cylinders=0;
disk_car->geom.heads_per_cylinder=255;
disk_car->geom.sectors_per_head=63;
+#if 0
if((uint64_t)stat_rec.st_size > disk_car->offset)
{
disk_car->disk_real_size=((uint64_t)stat_rec.st_size-disk_car->offset+disk_car->sector_size-1)/disk_car->sector_size*disk_car->sector_size;
}
else
+#endif
{
off_t pos;
pos=lseek(hd_h,0,SEEK_END);
diff --git a/src/hdcache.c b/src/hdcache.c
index c7b5742..aab1c0a 100644
--- a/src/hdcache.c
+++ b/src/hdcache.c
@@ -64,7 +64,6 @@ struct cache_struct
static int cache_pread_aux(disk_t *disk_car, void *buffer, const unsigned int count, const uint64_t offset, const unsigned int read_ahead);
static int cache_pread(disk_t *disk_car, void *buffer, const unsigned int count, const uint64_t offset);
-static void *cache_pread_fast(disk_t *disk, void *buffer, const unsigned int count, const uint64_t offset);
static int cache_pwrite(disk_t *disk_car, const void *buffer, const unsigned int count, const uint64_t offset);
static int cache_sync(disk_t *disk);
static void cache_clean(disk_t *disk);
@@ -100,16 +99,6 @@ static void *cache_get_data_p(disk_t *disk, const unsigned int count, const uint
return NULL;
}
-static void* cache_pread_fast(disk_t *disk, void *buffer, const unsigned int count, const uint64_t offset)
-{
- void*data=cache_get_data_p(disk, count, offset);
- if(data!=NULL)
- return data;
- if(cache_pread(disk, buffer, count, offset) == count)
- return buffer;
- return NULL;
-}
-
static int cache_pread(disk_t *disk_car, void *buffer, const unsigned int count, const uint64_t offset)
{
const struct cache_struct *data=(const struct cache_struct *)disk_car->data;
@@ -304,7 +293,6 @@ disk_t *new_diskcache(disk_t *disk_car, const unsigned int testdisk_mode)
new_disk_car->disk_real_size=disk_car->disk_real_size;
new_disk_car->write_used=0;
new_disk_car->data=data;
- new_disk_car->pread_fast=cache_pread_fast;
new_disk_car->pread=cache_pread;
new_disk_car->pwrite=cache_pwrite;
new_disk_car->sync=cache_sync;
diff --git a/src/io_redir.c b/src/io_redir.c
index 449a3e8..a8f85ca 100644
--- a/src/io_redir.c
+++ b/src/io_redir.c
@@ -55,7 +55,6 @@ struct info_io_redir
list_redir_t *list_redir;
};
-static void *io_redir_pread_fast(disk_t *disk_car, void *buffer, const unsigned int count, const uint64_t offset);
static int io_redir_pread(disk_t *disk_car, void *buffer, const unsigned int count, const uint64_t offset);
static int io_redir_clean(disk_t *clean);
@@ -79,7 +78,6 @@ int io_redir_add_redir(disk_t *disk_car, const uint64_t org_offset, const unsign
disk_car->data=data;
disk_car->description=old_disk_car->description;
disk_car->pwrite=old_disk_car->pwrite;
- disk_car->pread_fast=io_redir_pread_fast;
disk_car->pread=io_redir_pread;
disk_car->clean=io_redir_clean;
}
@@ -219,13 +217,6 @@ static int io_redir_pread(disk_t *disk_car, void *buffer, const unsigned int cou
return count;
}
-static void *io_redir_pread_fast(disk_t *disk, void *buffer, const unsigned int count, const uint64_t offset)
-{
- if(io_redir_pread(disk, buffer, count, offset)==count)
- return buffer;
- return NULL;
-}
-
static int io_redir_clean(disk_t *disk_car)
{
if(disk_car->data)
diff --git a/src/msdos.c b/src/msdos.c
index 30565e6..d9abafc 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -55,7 +55,6 @@ static int hd_identify_enh_bios(disk_t *param_disk,const int verbose);
static int check_enh_bios(const unsigned int disk, const int verbose);
static int hd_report_error(disk_t *disk_car, const uint64_t hd_offset, const unsigned int count, const int rc);
static const char *disk_description_short(disk_t *disk_car);
-static void *disk_pread_fast(disk_t *disk, void *buf, const unsigned int count, const uint64_t offset);
static int disk_pread(disk_t *disk_car, void *buf, const unsigned int count, const uint64_t hd_offset);
static int disk_pwrite(disk_t *disk_car, const void *buf, const unsigned int count, const uint64_t hd_offset);
static int disk_nopwrite(disk_t *disk_car, const void *buf, const unsigned int count, const uint64_t offset);
@@ -380,7 +379,6 @@ disk_t *hd_identify(const int verbose, const unsigned int disk, const int testdi
disk_car->sector_size=DEFAULT_SECTOR_SIZE;
disk_car->description=disk_description;
disk_car->description_short=disk_description_short;
- disk_car->pread_fast=disk_pread_fast;
disk_car->pread=disk_pread;
disk_car->pwrite=((testdisk_mode&TESTDISK_O_RDWR)==TESTDISK_O_RDWR?disk_pwrite:disk_nopwrite);
disk_car->sync=disk_sync;
@@ -496,13 +494,6 @@ static int disk_pread(disk_t *disk_car, void *buf, const unsigned int count, con
return align_pread(&disk_pread_aux, disk_car, buf, count, offset);
}
-static void *disk_pread_fast(disk_t *disk, void *buf, const unsigned int count, const uint64_t offset)
-{
- if(disk_pread(disk, buf, count, offset)==offset)
- return buf;
- return NULL;
-}
-
static int disk_pwrite_aux(disk_t *disk_car, const void *buf, const unsigned int count, const uint64_t hd_offset)
{
int i=0;
diff --git a/src/partnone.c b/src/partnone.c
index 5b0763d..f7d506b 100644
--- a/src/partnone.c
+++ b/src/partnone.c
@@ -267,10 +267,9 @@ static list_part_t *read_part_none(disk_t *disk, const int verbose, const int sa
/* sparse superblock feature: The groups chosen are 0, 1 and powers of 3, 5 and 7. */
/* Checking group 3 */
const uint64_t hd_offset=3*(EXT2_MIN_BLOCK_SIZE<<s_log_block_size)*8*(EXT2_MIN_BLOCK_SIZE<<s_log_block_size)+(s_log_block_size==0?2*DEFAULT_SECTOR_SIZE:0);
- void *data=disk->pread_fast(disk, buffer_disk, 1024, hd_offset);
- if(data!=NULL)
+ if(disk->pread(disk, buffer_disk, 1024, hd_offset)==1024)
{
- const struct ext2_super_block *sb=(const struct ext2_super_block*)data;
+ const struct ext2_super_block *sb=(const struct ext2_super_block*)buffer_disk;
partition->part_offset = hd_offset;
if(le16(sb->s_block_group_nr)>0 &&
le16(sb->s_magic)==EXT2_SUPER_MAGIC &&
diff --git a/src/win32.c b/src/win32.c
index fa93b6f..a6a5165 100644
--- a/src/win32.c
+++ b/src/win32.c
@@ -60,7 +60,6 @@ static uint64_t filewin32_getfilesize(HANDLE handle, const char *device);
static const char *file_win32_description(disk_t *disk_car);
static const char *file_win32_description_short(disk_t *disk_car);
static void file_win32_clean(disk_t *disk_car);
-static void *file_win32_pread_fast(disk_t *disk, void *buf, const unsigned int count, const uint64_t offset);
static int file_win32_pread(disk_t *disk_car, void *buf, const unsigned int count, const uint64_t offset);
static int file_win32_pwrite(disk_t *disk_car, const void *buf, const unsigned int count, const uint64_t offset);
static int file_win32_nopwrite(disk_t *disk_car, const void *buf, const unsigned int count, const uint64_t offset);
@@ -324,7 +323,6 @@ disk_t *file_test_availability_win32(const char *device, const int verbose, int
disk_car->data=data;
disk_car->description=file_win32_description;
disk_car->description_short=file_win32_description_short;
- disk_car->pread_fast=file_win32_pread_fast;
disk_car->pread=file_win32_pread;
disk_car->pwrite=((data->mode&FILE_WRITE_DATA)==FILE_WRITE_DATA?file_win32_pwrite:file_win32_nopwrite);
disk_car->sync=file_win32_sync;
@@ -496,13 +494,6 @@ static int file_win32_pread(disk_t *disk_car, void *buf, const unsigned int coun
return align_pread(&file_win32_pread_aux, disk_car, buf, count, offset);
}
-static void *file_win32_pread_fast(disk_t *disk, void *buf, const unsigned int count, const uint64_t offset)
-{
- if(file_win32_pread(disk, buf, count, offset)==offset)
- return buf;
- return NULL;
-}
-
static int file_win32_pwrite_aux(disk_t *disk_car, const void *buf, const unsigned int count, const uint64_t offset)
{
long int ret;