* path.cc (fs_info::update): Set and use is_cdrom.
* path.cc (fillout_mntent): Set ret.mnt_type to something more Linux-like, based on data from fs_info. Move "system" and "user" strings from mnt_type to mnt_opts. * path.h (struct fs_info): Add is_cdrom field. * path.h (fs_info::clear): Initialize is_cdrom. * path.h (struct fs_info): Add IMPLEMENT_STATUS_FLAG(bool,is_cdrom). * path.h (class path_conv): Add fs_is_cdrom method. Add missing fs_is_netapp method.
This commit is contained in:
parent
22ed94e503
commit
90c2ba7806
|
@ -1,3 +1,15 @@
|
||||||
|
007-03-19 Ryan C. Gordon <icculus@icculus.org>
|
||||||
|
|
||||||
|
* path.cc (fs_info::update): Set and use is_cdrom.
|
||||||
|
* path.cc (fillout_mntent): Set ret.mnt_type to something more
|
||||||
|
Linux-like, based on data from fs_info. Move "system" and "user"
|
||||||
|
strings from mnt_type to mnt_opts.
|
||||||
|
* path.h (struct fs_info): Add is_cdrom field.
|
||||||
|
* path.h (fs_info::clear): Initialize is_cdrom.
|
||||||
|
* path.h (struct fs_info): Add IMPLEMENT_STATUS_FLAG(bool,is_cdrom).
|
||||||
|
* path.h (class path_conv): Add fs_is_cdrom method. Add missing
|
||||||
|
fs_is_netapp method.
|
||||||
|
|
||||||
007-05-14 Eric Blake <ebb9@byu.net>
|
007-05-14 Eric Blake <ebb9@byu.net>
|
||||||
|
|
||||||
* cygwin.din (asnprintf, dprint, _Exit, vasnprintf, vdprintf): Export.
|
* cygwin.din (asnprintf, dprint, _Exit, vasnprintf, vdprintf): Export.
|
||||||
|
|
|
@ -461,6 +461,7 @@ fs_info::update (const char *win32_path)
|
||||||
&& FS_IS_NETAPP_DATAONTAP);
|
&& FS_IS_NETAPP_DATAONTAP);
|
||||||
is_ntfs (strcmp (fsname, "NTFS") == 0 && !is_samba () && !is_netapp ());
|
is_ntfs (strcmp (fsname, "NTFS") == 0 && !is_samba () && !is_netapp ());
|
||||||
is_nfs (strcmp (fsname, "NFS") == 0);
|
is_nfs (strcmp (fsname, "NFS") == 0);
|
||||||
|
is_cdrom (drive_type () == DRIVE_CDROM);
|
||||||
|
|
||||||
has_ea (is_ntfs ());
|
has_ea (is_ntfs ());
|
||||||
has_acls ((flags () & FS_PERSISTENT_ACLS)
|
has_acls ((flags () & FS_PERSISTENT_ACLS)
|
||||||
|
@ -474,8 +475,7 @@ fs_info::update (const char *win32_path)
|
||||||
has_buggy_open (!strcmp (fsname, "SUNWNFS"));
|
has_buggy_open (!strcmp (fsname, "SUNWNFS"));
|
||||||
|
|
||||||
/* Only append non-removable drives to the global fsinfo storage */
|
/* Only append non-removable drives to the global fsinfo storage */
|
||||||
if (drive_type () != DRIVE_REMOVABLE && drive_type () != DRIVE_CDROM
|
if (drive_type () != DRIVE_REMOVABLE && !is_cdrom () && idx < MAX_FS_INFO_CNT)
|
||||||
&& idx < MAX_FS_INFO_CNT)
|
|
||||||
{
|
{
|
||||||
LONG exc_cnt;
|
LONG exc_cnt;
|
||||||
while ((exc_cnt = InterlockedExchange (&fsinfo_cnt, -1)) == -1)
|
while ((exc_cnt = InterlockedExchange (&fsinfo_cnt, -1)) == -1)
|
||||||
|
@ -2552,10 +2552,27 @@ fillout_mntent (const char *native_path, const char *posix_path, unsigned flags)
|
||||||
strcpy (_my_tls.locals.mnt_dir, posix_path);
|
strcpy (_my_tls.locals.mnt_dir, posix_path);
|
||||||
ret.mnt_dir = _my_tls.locals.mnt_dir;
|
ret.mnt_dir = _my_tls.locals.mnt_dir;
|
||||||
|
|
||||||
if (!(flags & MOUNT_SYSTEM)) /* user mount */
|
/* Try to give a filesystem type that matches what a Linux application might
|
||||||
strcpy (_my_tls.locals.mnt_type, (char *) "user");
|
expect. Naturally, this is a moving target, but we can make some
|
||||||
else /* system mount */
|
reasonable guesses for popular types. */
|
||||||
strcpy (_my_tls.locals.mnt_type, (char *) "system");
|
|
||||||
|
fs_info mntinfo;
|
||||||
|
mntinfo.update (native_path); /* this pulls from a cache, usually. */
|
||||||
|
|
||||||
|
if (mntinfo.is_samba())
|
||||||
|
strcpy (_my_tls.locals.mnt_type, (char *) "smbfs");
|
||||||
|
else if (mntinfo.is_nfs ())
|
||||||
|
strcpy (_my_tls.locals.mnt_type, (char *) "nfs");
|
||||||
|
else if (mntinfo.is_fat ())
|
||||||
|
strcpy (_my_tls.locals.mnt_type, (char *) "vfat");
|
||||||
|
else if (mntinfo.is_ntfs ())
|
||||||
|
strcpy (_my_tls.locals.mnt_type, (char *) "ntfs");
|
||||||
|
else if (mntinfo.is_netapp ())
|
||||||
|
strcpy (_my_tls.locals.mnt_type, (char *) "netapp");
|
||||||
|
else if (mntinfo.is_cdrom ())
|
||||||
|
strcpy (_my_tls.locals.mnt_type, (char *) "iso9660");
|
||||||
|
else
|
||||||
|
strcpy (_my_tls.locals.mnt_type, (char *) "unknown");
|
||||||
|
|
||||||
ret.mnt_type = _my_tls.locals.mnt_type;
|
ret.mnt_type = _my_tls.locals.mnt_type;
|
||||||
|
|
||||||
|
@ -2579,6 +2596,12 @@ fillout_mntent (const char *native_path, const char *posix_path, unsigned flags)
|
||||||
|
|
||||||
if ((flags & MOUNT_CYGDRIVE)) /* cygdrive */
|
if ((flags & MOUNT_CYGDRIVE)) /* cygdrive */
|
||||||
strcat (_my_tls.locals.mnt_opts, (char *) ",noumount");
|
strcat (_my_tls.locals.mnt_opts, (char *) ",noumount");
|
||||||
|
|
||||||
|
if (!(flags & MOUNT_SYSTEM)) /* user mount */
|
||||||
|
strcat (_my_tls.locals.mnt_opts, (char *) ",user");
|
||||||
|
else /* system mount */
|
||||||
|
strcat (_my_tls.locals.mnt_opts, (char *) ",system");
|
||||||
|
|
||||||
ret.mnt_opts = _my_tls.locals.mnt_opts;
|
ret.mnt_opts = _my_tls.locals.mnt_opts;
|
||||||
|
|
||||||
ret.mnt_freq = 1;
|
ret.mnt_freq = 1;
|
||||||
|
@ -4206,13 +4229,13 @@ cwdstuff::set (const char *win32_cwd, const char *posix_cwd, bool doit)
|
||||||
{
|
{
|
||||||
/* We utilize the user parameter block. The directory is
|
/* We utilize the user parameter block. The directory is
|
||||||
stored manually there. Why the hassle?
|
stored manually there. Why the hassle?
|
||||||
|
|
||||||
- SetCurrentDirectory fails for directories with strict
|
- SetCurrentDirectory fails for directories with strict
|
||||||
permissions even for processes with the SE_BACKUP_NAME
|
permissions even for processes with the SE_BACKUP_NAME
|
||||||
privilege enabled. The reason is apparently that
|
privilege enabled. The reason is apparently that
|
||||||
SetCurrentDirectory calls NtOpenFile without the
|
SetCurrentDirectory calls NtOpenFile without the
|
||||||
FILE_OPEN_FOR_BACKUP_INTENT flag set.
|
FILE_OPEN_FOR_BACKUP_INTENT flag set.
|
||||||
|
|
||||||
- Unlinking a cwd fails because SetCurrentDirectory seems to
|
- Unlinking a cwd fails because SetCurrentDirectory seems to
|
||||||
open directories so that deleting the directory is disallowed.
|
open directories so that deleting the directory is disallowed.
|
||||||
The below code opens with *all* sharing flags set. */
|
The below code opens with *all* sharing flags set. */
|
||||||
|
|
|
@ -102,15 +102,16 @@ struct fs_info
|
||||||
DWORD serial; /* Volume serial number */
|
DWORD serial; /* Volume serial number */
|
||||||
unsigned is_remote_drive : 1;
|
unsigned is_remote_drive : 1;
|
||||||
unsigned has_buggy_open : 1;
|
unsigned has_buggy_open : 1;
|
||||||
unsigned has_ea : 1;
|
unsigned has_ea : 1;
|
||||||
unsigned has_acls : 1;
|
unsigned has_acls : 1;
|
||||||
unsigned hasgood_inode : 1;
|
unsigned hasgood_inode : 1;
|
||||||
unsigned drive_type : 3;
|
unsigned drive_type : 3;
|
||||||
unsigned is_fat : 1;
|
unsigned is_fat : 1;
|
||||||
unsigned is_ntfs : 1;
|
unsigned is_ntfs : 1;
|
||||||
unsigned is_samba : 1;
|
unsigned is_samba : 1;
|
||||||
unsigned is_nfs : 1;
|
unsigned is_nfs : 1;
|
||||||
unsigned is_netapp : 1;
|
unsigned is_netapp : 1;
|
||||||
|
unsigned is_cdrom : 1;
|
||||||
} status;
|
} status;
|
||||||
public:
|
public:
|
||||||
void clear ()
|
void clear ()
|
||||||
|
@ -129,6 +130,7 @@ struct fs_info
|
||||||
is_samba (false);
|
is_samba (false);
|
||||||
is_nfs (false);
|
is_nfs (false);
|
||||||
is_netapp (false);
|
is_netapp (false);
|
||||||
|
is_cdrom (false);
|
||||||
}
|
}
|
||||||
inline DWORD& flags () {return status.flags;};
|
inline DWORD& flags () {return status.flags;};
|
||||||
inline DWORD& serial () {return status.serial;};
|
inline DWORD& serial () {return status.serial;};
|
||||||
|
@ -145,6 +147,7 @@ struct fs_info
|
||||||
IMPLEMENT_STATUS_FLAG (bool, is_samba)
|
IMPLEMENT_STATUS_FLAG (bool, is_samba)
|
||||||
IMPLEMENT_STATUS_FLAG (bool, is_nfs)
|
IMPLEMENT_STATUS_FLAG (bool, is_nfs)
|
||||||
IMPLEMENT_STATUS_FLAG (bool, is_netapp)
|
IMPLEMENT_STATUS_FLAG (bool, is_netapp)
|
||||||
|
IMPLEMENT_STATUS_FLAG (bool, is_cdrom)
|
||||||
|
|
||||||
bool update (const char *);
|
bool update (const char *);
|
||||||
};
|
};
|
||||||
|
@ -274,6 +277,8 @@ class path_conv
|
||||||
bool fs_is_ntfs () const {return fs.is_ntfs ();}
|
bool fs_is_ntfs () const {return fs.is_ntfs ();}
|
||||||
bool fs_is_samba () const {return fs.is_samba ();}
|
bool fs_is_samba () const {return fs.is_samba ();}
|
||||||
bool fs_is_nfs () const {return fs.is_nfs ();}
|
bool fs_is_nfs () const {return fs.is_nfs ();}
|
||||||
|
bool fs_is_netapp () const {return fs.is_netapp ();}
|
||||||
|
bool fs_is_cdrom () const {return fs.is_cdrom ();}
|
||||||
void set_path (const char *p) {strcpy (path, p);}
|
void set_path (const char *p) {strcpy (path, p);}
|
||||||
DWORD volser () { return fs.serial (); }
|
DWORD volser () { return fs.serial (); }
|
||||||
void fillin (HANDLE h);
|
void fillin (HANDLE h);
|
||||||
|
|
Loading…
Reference in New Issue