[PATCH] Allow and prefer using A: and B: for floppies
Pavel Roskin
proski at gnu.org
Fri Jun 9 21:33:42 CDT 2006
From: Pavel Roskin <proski at gnu.org>
Pass drive type to allocate_letter(). Start search from 'A' for
floppies.
Fix missing parentheses in the DRIVE_MASK_BIT definition. It's a bug
that is triggered by non-sequential drive allocation.
Signed-off-by: Pavel Roskin <proski at gnu.org>
---
programs/winecfg/drivedetect.c | 31 ++++++++++++++++++-------------
programs/winecfg/winecfg.h | 2 +-
2 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/programs/winecfg/drivedetect.c b/programs/winecfg/drivedetect.c
index c094fce..9927043 100644
--- a/programs/winecfg/drivedetect.c
+++ b/programs/winecfg/drivedetect.c
@@ -132,11 +132,16 @@ static BOOL is_drive_defined(char *path)
}
/* returns Z + 1 if there are no more available letters */
-static char allocate_letter(void)
+static char allocate_letter(int type)
{
- char letter;
+ char letter, start;
- for (letter = 'C'; letter <= 'Z'; letter++)
+ if (type == DRIVE_REMOVABLE)
+ start = 'A';
+ else
+ start = 'C';
+
+ for (letter = start; letter <= 'Z'; letter++)
if ((DRIVE_MASK_BIT(letter) & working_mask) != 0) break;
return letter;
@@ -322,8 +327,17 @@ #ifdef HAVE_MNTENT_H
if (should_ignore_mnt_dir(ent->mnt_dir)) continue;
if (is_drive_defined(ent->mnt_dir)) continue;
+ if (!strcmp(ent->mnt_type, "nfs")) type = DRIVE_REMOTE;
+ else if (!strcmp(ent->mnt_type, "nfs4")) type = DRIVE_REMOTE;
+ else if (!strcmp(ent->mnt_type, "smbfs")) type = DRIVE_REMOTE;
+ else if (!strcmp(ent->mnt_type, "cifs")) type = DRIVE_REMOTE;
+ else if (!strcmp(ent->mnt_type, "coda")) type = DRIVE_REMOTE;
+ else if (!strcmp(ent->mnt_type, "iso9660")) type = DRIVE_CDROM;
+ else if (!strcmp(ent->mnt_type, "ramfs")) type = DRIVE_RAMDISK;
+ else type = try_dev_node(ent->mnt_fsname);
+
/* allocate a drive for it */
- letter = allocate_letter();
+ letter = allocate_letter(type);
if (letter == ']')
{
report_error(NO_MORE_LETTERS);
@@ -336,15 +350,6 @@ #ifdef HAVE_MNTENT_H
WINE_TRACE("adding drive %c for %s, type %s with label %s\n", letter, ent->mnt_dir, ent->mnt_type,label);
- if (!strcmp(ent->mnt_type, "nfs")) type = DRIVE_REMOTE;
- else if (!strcmp(ent->mnt_type, "nfs4")) type = DRIVE_REMOTE;
- else if (!strcmp(ent->mnt_type, "smbfs")) type = DRIVE_REMOTE;
- else if (!strcmp(ent->mnt_type, "cifs")) type = DRIVE_REMOTE;
- else if (!strcmp(ent->mnt_type, "coda")) type = DRIVE_REMOTE;
- else if (!strcmp(ent->mnt_type, "iso9660")) type = DRIVE_CDROM;
- else if (!strcmp(ent->mnt_type, "ramfs")) type = DRIVE_RAMDISK;
- else type = try_dev_node(ent->mnt_fsname);
-
add_drive(letter, ent->mnt_dir, label, "0", type);
/* working_mask is a map of the drive letters still available. */
diff --git a/programs/winecfg/winecfg.h b/programs/winecfg/winecfg.h
index 5075690..53fe9ee 100644
--- a/programs/winecfg/winecfg.h
+++ b/programs/winecfg/winecfg.h
@@ -95,7 +95,7 @@ struct drive
BOOL in_use;
};
-#define DRIVE_MASK_BIT(B) 1 << (toupper(B) - 'A')
+#define DRIVE_MASK_BIT(B) (1 << (toupper(B) - 'A'))
long drive_available_mask(char letter);
BOOL add_drive(const char letter, const char *targetpath, const char *label, const char *serial, unsigned int type);
More information about the wine-patches
mailing list