mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
fixed opening of the device
svn path=/trunk/; revision=16833
This commit is contained in:
parent
fea82752a1
commit
1aa3ba72f9
2 changed files with 26 additions and 21 deletions
|
@ -1,16 +1,5 @@
|
|||
/* 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"
|
||||
|
|
|
@ -53,21 +53,43 @@ static int fd,did_change = 0;
|
|||
|
||||
unsigned device_no;
|
||||
|
||||
static int WIN32open(const char *path, int oflag, ...);
|
||||
#define open WIN32open
|
||||
static int WIN32close(int fd);
|
||||
#define close WIN32close
|
||||
static int WIN32read(int fd, void *buf, unsigned int len);
|
||||
#define read WIN32read
|
||||
static int WIN32write(int fd, void *buf, unsigned int len);
|
||||
#define write WIN32write
|
||||
static loff_t WIN32llseek(int fd, loff_t offset, int whence);
|
||||
#define llseek WIN32llseek
|
||||
|
||||
static int is_device = 0;
|
||||
|
||||
void fs_open(char *path,int rw)
|
||||
{
|
||||
//#ifdef _WIN32
|
||||
// static char dev_buf[] = "\\\\.\\X:";
|
||||
//#else
|
||||
#ifdef _WIN32
|
||||
static char dev_buf[] = "\\\\.\\X:";
|
||||
#else
|
||||
struct stat stbuf;
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
if (path[1] == ':' && path[2] == '\0') {
|
||||
dev_buf[4] = path[0];
|
||||
path = dev_buf;
|
||||
// is_device = 1;
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
|
@ -176,12 +198,6 @@ int fs_changed(void)
|
|||
/* tab-width: 8 */
|
||||
/* End: */
|
||||
|
||||
|
||||
#define open WIN32open
|
||||
#define close WIN32close
|
||||
#define read WIN32read
|
||||
#define write WIN32write
|
||||
#define llseek WIN32llseek
|
||||
|
||||
#define O_SHORT_LIVED _O_SHORT_LIVED
|
||||
#define O_ACCMODE 3
|
||||
|
|
Loading…
Reference in a new issue