/* #includes */ /*{{{C}}}*//*{{{*/
-#undef _POSIX_SOURCE
-#define _POSIX_SOURCE 1
-#undef _POSIX_C_SOURCE
-#define _POSIX_C_SOURCE 2
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
+#include "config.h"
#include <assert.h>
#include <errno.h>
-#include "config.h"
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "device.h"
+
+#ifdef USE_DMALLOC
+#include <dmalloc.h>
+#endif
/*}}}*/
/* Device_open -- Open an image file */ /*{{{*/
}
/*}}}*/
/* Device_setGeometry -- Set disk geometry */ /*{{{*/
-void Device_setGeometry(struct Device *this, int secLength, int sectrk, int tracks)
+const char *Device_setGeometry(struct Device *this, int secLength, int sectrk, int tracks, off_t offset, const char *libdskGeometry)
{
this->secLength=secLength;
this->sectrk=sectrk;
this->tracks=tracks;
+ this->offset=offset;
+ return NULL;
}
/*}}}*/
/* Device_close -- Close an image file */ /*{{{*/
{
int res;
+ assert(this);
assert(sector>=0);
assert(sector<this->sectrk);
assert(track>=0);
assert(track<this->tracks);
- if (lseek(this->fd,(off_t)(sector+track*this->sectrk)*this->secLength,SEEK_SET)==-1)
+ assert(buf);
+ if (lseek(this->fd,(off_t)(((sector+track*this->sectrk)*this->secLength)+this->offset),SEEK_SET)==-1)
{
return strerror(errno);
}
assert(sector<this->sectrk);
assert(track>=0);
assert(track<this->tracks);
- if (lseek(this->fd,(off_t)(sector+track*this->sectrk)*this->secLength, SEEK_SET)==-1)
+ if (lseek(this->fd,(off_t)(((sector+track*this->sectrk)*this->secLength)+this->offset),SEEK_SET)==-1)
{
return strerror(errno);
}