Module: wine Branch: master Commit: 7b7ac02e1516effc47e1839299792b81ca3ffbd0 URL: http://source.winehq.org/git/wine.git/?a=commit;h=7b7ac02e1516effc47e1839299...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Jul 22 19:21:22 2009 +0200
mountmgr: Better reuse of existing devices.
---
dlls/mountmgr.sys/device.c | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c index 42eb0cd..3753c96 100644 --- a/dlls/mountmgr.sys/device.c +++ b/dlls/mountmgr.sys/device.c @@ -630,22 +630,23 @@ NTSTATUS add_dos_device( int letter, const char *udi, const char *device, status = STATUS_OBJECT_NAME_COLLISION; goto done; } + + LIST_FOR_EACH_ENTRY_SAFE( drive, next, &drives_list, struct dos_drive, entry ) + { + if (drive->volume->udi && !strcmp( udi, drive->volume->udi )) goto found; + if (drive->drive == letter) delete_dos_device( drive ); + } } else /* simply reset the device symlink */ { *p = 'a' + letter; - update_symlink( path, device, NULL ); - } - - LIST_FOR_EACH_ENTRY_SAFE( drive, next, &drives_list, struct dos_drive, entry ) - { - if (udi && drive->volume->udi && !strcmp( udi, drive->volume->udi )) + LIST_FOR_EACH_ENTRY( drive, &drives_list, struct dos_drive, entry ) { - if (type == drive->volume->device->type) goto found; - delete_dos_device( drive ); - continue; + if (drive->drive != letter) continue; + update_symlink( path, device, drive->volume->device->unix_device ); + goto found; } - if (drive->drive == letter) delete_dos_device( drive ); + update_symlink( path, device, NULL ); }
if ((status = create_dos_device( udi, letter, type, &drive ))) goto done;