summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEudyptula <eitan@mosenkis.net>2009-07-21 16:02:48 -0400
committerEudyptula <eitan@mosenkis.net>2009-07-21 16:02:48 -0400
commit34b01fa4d3614698ac2b1af74a7f56b986fd97c4 (patch)
treec85a7c34256db034a676c683875a405a361bca9b /lib/bkisofs/bkIoWrappers.c
parentFixes/hacks so backend still works with non-execution logging (diff)
downloadingenue-34b01fa4d3614698ac2b1af74a7f56b986fd97c4.tar.gz
ingenue-34b01fa4d3614698ac2b1af74a7f56b986fd97c4.tar.bz2
ingenue-34b01fa4d3614698ac2b1af74a7f56b986fd97c4.zip
Added bkisofs ISO manipulation library and wrote CLI wrapper for it
Diffstat (limited to 'lib/bkisofs/bkIoWrappers.c')
-rw-r--r--lib/bkisofs/bkIoWrappers.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/lib/bkisofs/bkIoWrappers.c b/lib/bkisofs/bkIoWrappers.c
new file mode 100644
index 0000000..67ca41d
--- /dev/null
+++ b/lib/bkisofs/bkIoWrappers.c
@@ -0,0 +1,84 @@
+/******************************* LICENCE **************************************
+* Any code in this file may be redistributed or modified under the terms of
+* the GNU General Public Licence as published by the Free Software
+* Foundation; version 2 of the licence.
+****************************** END LICENCE ***********************************/
+
+/******************************************************************************
+* Author:
+* Andrew Smith, http://littlesvr.ca/misc/contactandrew.php
+*
+* Contributors:
+*
+******************************************************************************/
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "bkInternal.h"
+#include "bkIoWrappers.h"
+
+void bkClose(int file)
+{
+ close(file);
+}
+
+int bkFstat(int file, BkStatStruct* statStruct)
+{
+ return fstat(file, statStruct);
+}
+
+size_t bkRead(int file, void* dest, size_t numBytes)
+{
+ return read(file, dest, numBytes);
+}
+
+/******************************************************************************
+* bkSeekSet()
+* */
+bk_off_t bkSeekSet(int file, bk_off_t offset, int origin)
+{
+ return lseek(file, offset, origin);
+}
+
+/******************************************************************************
+* bkSeekTell()
+* */
+bk_off_t bkSeekTell(int file)
+{
+ return lseek(file, 0, SEEK_CUR);
+}
+
+int bkStat(const char* pathAndName, BkStatStruct* statStruct)
+{
+ return stat(pathAndName, statStruct);
+}
+
+size_t bkWrite(int file, const void* src, size_t numBytes)
+{
+ return write(file, src, numBytes);
+}
+
+size_t readRead(VolInfo* volInfo, void* dest, size_t numBytes)
+{
+ return read(volInfo->imageForReading, dest, numBytes);
+}
+
+/******************************************************************************
+* readSeekSet()
+* Seek set for reading from the iso
+* */
+bk_off_t readSeekSet(VolInfo* volInfo, bk_off_t offset, int origin)
+{
+ return lseek(volInfo->imageForReading, offset, origin);
+}
+
+/******************************************************************************
+* readSeekTell()
+* Seek tell for reading from the iso
+* */
+bk_off_t readSeekTell(VolInfo* volInfo)
+{
+ return lseek(volInfo->imageForReading, 0, SEEK_CUR);
+}