* path.cc (conv_path_list): Fix wild indexing into path due to conflicting

methods for setting src pointer.
* dir.cc (opendir): Only pass path_conv argument to opendir, since name is
already part of the fhandler.
* dtable.cc (dtable::build_fhandler): Accomodate new FH_CYGDRIVE type.
* fhandler.cc (fhandler_base::opendir): Nuke name argument.
* fhandler.h: Add FH_CYGDRIVE to "device" enum.
(fhandler_base::opendir): Nuke name argument.
(fhandler_disk_file::opendir): Ditto.
(fhandler_disk_file::fhandler_disk_file): Declare new method which passes
devtype through.
(fhandler_cygdrive): Add elements for tracking drives.
(fhandler_cygdrive::set_drives): Declare new method.
(fhandler_cygdrive::iscygdrive_root): Declare new method.
(fhandler_cygdrive::opendir): Declare new method.
(fhandler_cygdrive::readdir): Declare new method.
(fhandler_cygdrive::telldir): Declare new method.
(fhandler_cygdrive::seekdir): Declare new method.
(fhandler_cygdrive::rewinddir): Declare new method.
(fhandler_cygdrive::closedir): Declare new method.
(fhandler_cygdrive::fstat): Declare new method.
* fhandler_disk_file.cc (fhandler_disk_file::fhandler_disk_file): Define new
method which passes devtype through.
(fhandler_disk_file::open): Tweak debug output.
(fhandler_disk_file::opendir): Nuke first argument.  Use info from path_conv
and class rather than calling fstat.
(fhandler_cygdrive::set_drives): New method.
(fhandler_cygdrive::iscygdrive_root): New method.
(fhandler_cygdrive::opendir): New method.
(fhandler_cygdrive::readdir): New method.
(fhandler_cygdrive::telldir): New method.
(fhandler_cygdrive::seekdir): New method.
(fhandler_cygdrive::rewinddir): New method.
(fhandler_cygdrive::closedir): New method.
(fhandler_cygdrive::fstat): New method.
* path.cc (iscygdrive_device): Assume cygdriveness is already verified.
(path_conv::check): Treat FH_CYGDRIVE "method" as a special case, setting file
attributes as needed.
(mount_info::conv_to_win32_path): Allow stand-alone /cygdrive, meaning "the
directory which contains all of the drives on the system".
(fillout_mntent): Use cyg_tolower for conversions.
(mount_info::cygdrive_win32_path): Replace unused argument with unit number.
* shared_info.h (mount_info::cygdrive_win32_path): Reflect argument change.
This commit is contained in:
Christopher Faylor
2001-11-22 05:59:07 +00:00
parent 53e61a867b
commit 97a2e0756d
8 changed files with 239 additions and 50 deletions

View File

@ -67,10 +67,11 @@ enum
FH_ZERO = 0x00000014, /* is the zero device */
FH_RANDOM = 0x00000015, /* is a random device */
FH_MEM = 0x00000016, /* is a mem device */
FH_CLIPBOARD = 0x00000017, /* is a clipbaord device */
FH_CLIPBOARD = 0x00000017, /* is a clipboard device */
FH_OSS_DSP = 0x00000018, /* is a dsp audio device */
FH_CYGDRIVE= 0x00000019, /* /cygdrive/x */
FH_NDEV = 0x00000019, /* Maximum number of devices */
FH_NDEV = 0x0000001a, /* Maximum number of devices */
FH_DEVMASK = 0x00000fff, /* devices live here */
FH_BAD = 0xffffffff
};
@ -340,7 +341,7 @@ class fhandler_base
void operator delete (void *);
virtual HANDLE get_guard () const {return NULL;}
virtual void set_eof () {}
virtual DIR *opendir (const char *dirname, path_conv& pc);
virtual DIR *opendir (path_conv& pc);
virtual dirent *readdir (DIR *);
virtual off_t telldir (DIR *);
virtual void seekdir (DIR *, off_t);
@ -527,6 +528,7 @@ class fhandler_disk_file: public fhandler_base
{
public:
fhandler_disk_file ();
fhandler_disk_file (DWORD devtype);
int open (path_conv * real_path, int flags, mode_t mode);
int close ();
@ -540,7 +542,7 @@ class fhandler_disk_file: public fhandler_base
int msync (HANDLE h, caddr_t addr, size_t len, int flags);
BOOL fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset,
DWORD size, void *address);
DIR *opendir (const char *dirname, path_conv& pc);
DIR *opendir (path_conv& pc);
struct dirent *readdir (DIR *);
off_t telldir (DIR *);
void seekdir (DIR *, off_t);
@ -548,6 +550,24 @@ class fhandler_disk_file: public fhandler_base
int closedir (DIR *);
};
class fhandler_cygdrive: public fhandler_disk_file
{
int unit;
int ndrives;
const char *pdrive;
void set_drives ();
public:
bool iscygdrive_root () const { return !unit; }
fhandler_cygdrive (int unit);
DIR *opendir (path_conv& pc);
struct dirent *readdir (DIR *);
off_t telldir (DIR *);
void seekdir (DIR *, off_t);
void rewinddir (DIR *);
int closedir (DIR *);
int __stdcall fstat (struct stat *buf, path_conv *pc) __attribute__ ((regparm (3)));
};
class fhandler_serial: public fhandler_base
{
private:
@ -591,12 +611,6 @@ class fhandler_serial: public fhandler_base
select_record *select_except (select_record *s);
};
class fhandler_cygdrive: public fhandler_disk_file
{
public:
fhandler_cygdrive ();
};
#define acquire_output_mutex(ms) \
__acquire_output_mutex (__PRETTY_FUNCTION__, __LINE__, ms);