/* common.h - Common functions */
-/* Written 1993 by Werner Almesberger */
-#if 0
-#include <linux/version.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
-# define __KERNEL__
-# include <asm/types.h>
-# undef __KERNEL__
-# define MSDOS_FAT12 4084 /* maximum number of clusters in a 12 bit FAT */
-#endif
-#endif
-
# define MSDOS_FAT12 4084 /* maximum number of clusters in a 12 bit FAT */
#include "version.h"
unsigned device_no;
+static int WIN32open(const char *path, int oflag, ...);
+#define open WIN32open
+static int WIN32close(int fd);\r
+#define close WIN32close
+static int WIN32read(int fd, void *buf, unsigned int len);\r
+#define read WIN32read
+static int WIN32write(int fd, void *buf, unsigned int len);\r
+#define write WIN32write
+static loff_t WIN32llseek(int fd, loff_t offset, int whence);\r
+#define llseek WIN32llseek\r
+
+static int is_device = 0;
+
void fs_open(char *path,int rw)
{
-//#ifdef _WIN32\r
-// static char dev_buf[] = "\\\\.\\X:";\r
-//#else
+#ifdef _WIN32\r
+ static char dev_buf[] = "\\\\.\\X:";\r
+#else
struct stat stbuf;
-//#endif
+#endif
+
+ if (path[1] == ':' && path[2] == '\0') {\r
+ dev_buf[4] = path[0];\r
+ path = dev_buf;\r
+// is_device = 1;\r
+ }\r
+
if ((fd = open(path,rw ? O_RDWR : O_RDONLY)) < 0)
pdie("open %s",path);
changes = last = NULL;
did_change = 0;
+#if 0
if (fstat(fd,&stbuf) < 0)
pdie("fstat %s",path);
device_no = S_ISBLK(stbuf.st_mode) ? (stbuf.st_rdev >> 8) & 0xff : 0;
+#endif
}
/* tab-width: 8 */
/* End: */
-
-#define open WIN32open\r
-#define close WIN32close\r
-#define read WIN32read\r
-#define write WIN32write\r
-#define llseek WIN32llseek\r
\r
#define O_SHORT_LIVED _O_SHORT_LIVED\r
#define O_ACCMODE 3\r