diff options
author | Christophe Grenier <grenier@cgsecurity.org> | 2010-11-05 09:00:22 +0100 |
---|---|---|
committer | Christophe Grenier <grenier@cgsecurity.org> | 2010-11-05 09:00:22 +0100 |
commit | 377144c3a7062b44cdd607c91e86c24cd7fc0f61 (patch) | |
tree | f7d7db52476407e8592e046f49763bde31bc2b34 /src/io_redir.c | |
parent | 173e66e1bc9e04d171097eb57d42692fd4440126 (diff) |
Introduce pread_fast(), a function that can return a pointer to the data in cache
instead of using memcpy to fill the buffer with a copy of the data
Diffstat (limited to 'src/io_redir.c')
-rw-r--r-- | src/io_redir.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/io_redir.c b/src/io_redir.c index a8f85ca..449a3e8 100644 --- a/src/io_redir.c +++ b/src/io_redir.c @@ -55,6 +55,7 @@ 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); @@ -78,6 +79,7 @@ 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; } @@ -217,6 +219,13 @@ 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) |