summaryrefslogtreecommitdiffstats
path: root/src/hdaccess.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-05-24 08:51:29 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2013-05-24 08:51:29 +0200
commiteb3b555b50e2c82f67559472bdf0a1d54325550f (patch)
treef3aaea1d3c9cd8e8423d69eeda0fba794bed7eb0 /src/hdaccess.c
parent91c44757340fd6f598e2708f8e20038158766c8e (diff)
Get rid of pread_fast(), it's too error prone
Diffstat (limited to 'src/hdaccess.c')
-rw-r--r--src/hdaccess.c11
1 files changed, 2 insertions, 9 deletions
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);