From 6cf1b31d25c2d4e99b3916872fde32ab8bf28ab5 Mon Sep 17 00:00:00 2001 From: Paul van Schayck Date: Fri, 25 Feb 2005 13:58:45 +0000 Subject: [PATCH] As last option for drive type detection we try the device node name. --- programs/winecfg/drivedetect.c | 27 ++++++++++++++++++++++++--- programs/winecfg/properties.h | 6 ++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/programs/winecfg/drivedetect.c b/programs/winecfg/drivedetect.c index fc95b03ee80..b3dabb4eac2 100644 --- a/programs/winecfg/drivedetect.c +++ b/programs/winecfg/drivedetect.c @@ -43,6 +43,13 @@ BOOL gui_mode = TRUE; static long working_mask = 0; #ifdef HAVE_MNTENT_H + +static DEV_NODES sDeviceNodes[] = { + {"/dev/fd", DRIVE_REMOVABLE}, + {"/dev/cdrom", DRIVE_CDROM}, + {"",0} +}; + static char *ignored_fstypes[] = { "devpts", "tmpfs", @@ -59,6 +66,20 @@ static char *ignored_mnt_dirs[] = { NULL }; +static int try_dev_node(char *dev) +{ + const DEV_NODES *pDevNodes = sDeviceNodes; + + while(pDevNodes->szNode[0]) + { + if(!strncmp(dev,pDevNodes->szNode,strlen(pDevNodes->szNode))) + return pDevNodes->nType; + ++pDevNodes; + } + + return DRIVE_FIXED; +} + static BOOL should_ignore_fstype(char *type) { char **s; @@ -288,11 +309,11 @@ int autodetect_drives() fclose(fstab); return FALSE; } - - WINE_TRACE("adding drive %c for %s, type %s\n", letter, ent->mnt_dir, ent->mnt_type); strncpy(label, "Drive X", 8); label[6] = letter; + + 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; @@ -301,7 +322,7 @@ int autodetect_drives() 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 = DRIVE_FIXED; + else type = try_dev_node(ent->mnt_fsname); add_drive(letter, ent->mnt_dir, label, "0", type); diff --git a/programs/winecfg/properties.h b/programs/winecfg/properties.h index 3a93a6cba76..7851472c494 100644 --- a/programs/winecfg/properties.h +++ b/programs/winecfg/properties.h @@ -87,6 +87,12 @@ typedef struct int nSynchronous; } X11DRV_DESC; +typedef struct +{ + char szNode[MAX_NAME_LENGTH]; + int nType; +} DEV_NODES; + VERSION_DESC *getWinVersions(void); VERSION_DESC *getDOSVersions(void); DLL_DESC *getDLLDefaults(void);