New upstream version 2.20
[debian/cpmtools] / device.h
1 #ifndef DEVICE_H
2 #define DEVICE_H
3
4 #ifdef _WIN32
5 /* The type of device the file system is on: */
6 #define CPMDRV_FILE  0 /* Regular file or Unix block device */
7 #define CPMDRV_WIN95 1 /* Windows 95 floppy drive accessed via VWIN32 */
8 #define CPMDRV_WINNT 2 /* Windows NT floppy drive accessed via CreateFile */
9 #endif
10
11 struct Device
12 {
13   int opened;
14
15   int secLength;
16   int tracks;
17   int sectrk;
18   off_t offset;
19 #if HAVE_LIBDSK_H
20   DSK_PDRIVER   dev;
21   DSK_GEOMETRY geom; 
22 #endif
23 #if HAVE_WINDOWS_H
24   int drvtype;
25   HANDLE hdisk;
26 #endif
27   int fd;
28 };
29
30 const char *Device_open(struct Device *self, const char *filename, int mode, const char *deviceOpts);
31 const char *Device_setGeometry(struct Device *self, int secLength, int sectrk, int tracks, off_t offset, const char *libdskGeometry);
32 const char *Device_close(struct Device *self);
33 const char *Device_readSector(const struct Device *self, int track, int sector, char *buf);
34 const char *Device_writeSector(const struct Device *self, int track, int sector, const char *buf);
35
36 #endif