revert between 56095 -> 55830 in arch
[AROS.git] / arch / all-unix / devs / hostdisk / hostdisk_host.h
blob1b4befc4724a4e242cd33fb7cd46bfeedc9bb885
1 /*
2 * avoid conflicts between our __unused define and the ones that might come in
3 * via sys/stat.h
4 */
5 #undef __unused
7 #ifdef HOST_LONG_ALIGNED
8 #pragma pack(4)
9 #endif
11 #define timeval sys_timeval
13 #include <sys/stat.h>
14 #include <sys/types.h>
16 #undef timeval
18 #pragma pack()
20 typedef int file_t;
22 #define INVALID_HANDLE_VALUE -1
24 /* Android is not a true Linux ;-) */
25 #ifdef HOST_OS_android
26 #undef HOST_OS_linux
27 #endif
29 #ifdef HOST_OS_linux
30 #define LIBC_NAME "libc.so.6"
31 #else
32 #endif
34 #ifdef HOST_OS_darwin
35 #define LIBC_NAME "libSystem.dylib"
36 #define DISK_DEVICE "/dev/disk%ld"
37 #define DISK_BASE 0
38 #endif
40 #ifndef LIBC_NAME
41 #define LIBC_NAME "libc.so"
42 #endif
44 #ifndef DISK_DEVICE
45 #define DISK_DEVICE "/dev/hd%lc"
46 #define DISK_BASE 'a'
47 #endif
49 /* AROS includes don't define struct stat64, this shuts up warning when compiling host-independent part */
50 struct stat64;
52 struct HostInterface
54 int (*open)(char *path, int oflag, ...);
55 int (*close)(int filedes);
56 ssize_t (*read)(int fildes, void *buf, size_t nbyte);
57 ssize_t (*write)(int fildes, const void *buf, size_t nbyte);
58 int (*ioctl)(int d, int request, ...);
59 #ifdef HOST_LONG_ALIGNED
60 off_t (*lseek)(int fildes, unsigned long offset_l, unsigned long offset_h, int whence);
61 #else
62 off_t (*lseek)(int fildes, off_t offset, int whence);
63 #endif
64 int *(*__error)(void);
65 #ifdef HOST_OS_linux
66 int (*__fxstat64)(int ver, int fd, struct stat64 *buf);
67 #define fstat64(fd, buf) __fxstat64(_STAT_VER, fd, buf)
68 #else
69 int (*fstat64)(int fd, struct stat64 *buf);
70 #endif
71 int (*stat64)(const char *path, struct stat64 *buf);
74 #ifdef HOST_LONG_ALIGNED
76 * Somewhat dirty hack to adjust data packing to iOS ARM ABI.
77 * Perhaps this can be done in a cleaner and more CPU-abstract way.
78 * FIXME: Always assuming little-endian CPU
80 #define LSeek(fildes, offset, offset_high, whence) hdskBase->iface->lseek(fildes, offset, offset_high, whence)
81 #else
82 #define LSeek(fildes, offset, offset_high, whence) hdskBase->iface->lseek(fildes, (UQUAD)offset | (UQUAD)offset_high << 32, whence)
83 #endif
85 struct HostDiskBase;
87 /* This routine is specific to a particular UNIX variant */
88 ULONG Host_DeviceGeometry(int file, struct DriveGeometry *dg, struct HostDiskBase *hdskBase);