Module: wine Branch: refs/heads/master Commit: 34d9d5a346fb26a68a933add2352ad7f020a299c URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=34d9d5a346fb26a68a933add...
Author: Pavel Roskin proski@gnu.org Date: Fri Jun 9 22:33:42 2006 -0400
winecfg: Allow and prefer using A: and B: for floppies.
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.
---
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 7a98d77..0b985cb 100644 --- a/programs/winecfg/drivedetect.c +++ b/programs/winecfg/drivedetect.c @@ -113,11 +113,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; @@ -303,8 +308,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); @@ -317,15 +331,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);