Alexandre Julliard : mountmgr: Create volumes for non-removable volumes reported by HAL/Disk Arbitration.

Alexandre Julliard julliard at winehq.org
Wed Jul 22 09:33:24 CDT 2009


Module: wine
Branch: master
Commit: 19e2d0cd5d244569827b8604f42dc031a6f4409a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=19e2d0cd5d244569827b8604f42dc031a6f4409a

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jul 21 20:33:17 2009 +0200

mountmgr: Create volumes for non-removable volumes reported by HAL/Disk Arbitration.

---

 dlls/mountmgr.sys/diskarb.c |   20 ++++++++++----------
 dlls/mountmgr.sys/hal.c     |   15 ++++++++-------
 2 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/dlls/mountmgr.sys/diskarb.c b/dlls/mountmgr.sys/diskarb.c
index 2e5c121..0c188ff 100644
--- a/dlls/mountmgr.sys/diskarb.c
+++ b/dlls/mountmgr.sys/diskarb.c
@@ -47,10 +47,6 @@ static void appeared_callback( DADiskRef disk, void *context )
 
     if (!dict) return;
 
-    /* ignore non-removable devices */
-    if (!(ref = CFDictionaryGetValue( dict, CFSTR("DAMediaRemovable") )) ||
-        !CFBooleanGetValue( ref )) goto done;
-
     if ((ref = CFDictionaryGetValue( dict, CFSTR("DAVolumeUUID") )))
     {
         CFUUIDBytes bytes = CFUUIDGetUUIDBytes( ref );
@@ -78,7 +74,11 @@ static void appeared_callback( DADiskRef disk, void *context )
     TRACE( "got mount notification for '%s' on '%s' uuid %s\n",
            device, mount_point, wine_dbgstr_guid(guid_ptr) );
 
-    add_dos_device( -1, device, device, mount_point, type, guid_ptr );
+    if ((ref = CFDictionaryGetValue( dict, CFSTR("DAMediaRemovable") )) && CFBooleanGetValue( ref ))
+        add_dos_device( -1, device, device, mount_point, type, guid_ptr );
+    else
+        if (guid_ptr) add_volume( device, device, mount_point, DEVICE_HARDDISK_VOL, guid_ptr );
+
 done:
     CFRelease( dict );
 }
@@ -96,10 +96,6 @@ static void disappeared_callback( DADiskRef disk, void *context )
 
     if (!dict) return;
 
-    /* ignore non-removable devices */
-    if (!(ref = CFDictionaryGetValue( dict, CFSTR("DAMediaRemovable") )) ||
-        !CFBooleanGetValue( ref )) goto done;
-
     /* get device name */
     if (!(ref = CFDictionaryGetValue( dict, CFSTR("DAMediaBSDName") ))) goto done;
     strcpy( device, "/dev/r" );
@@ -107,7 +103,11 @@ static void disappeared_callback( DADiskRef disk, void *context )
 
     TRACE( "got unmount notification for '%s'\n", device );
 
-    remove_dos_device( -1, device );
+    if ((ref = CFDictionaryGetValue( dict, CFSTR("DAMediaRemovable") )) && CFBooleanGetValue( ref ))
+        remove_dos_device( -1, device );
+    else
+        remove_volume( device );
+
 done:
     CFRelease( dict );
 }
diff --git a/dlls/mountmgr.sys/hal.c b/dlls/mountmgr.sys/hal.c
index 5ccb95d..82a70e9 100644
--- a/dlls/mountmgr.sys/hal.c
+++ b/dlls/mountmgr.sys/hal.c
@@ -156,9 +156,6 @@ static void new_device( LibHalContext *ctx, const char *udi )
     if (!(parent = p_libhal_device_get_property_string( ctx, udi, "info.parent", &error )))
         goto done;
 
-    if (!p_libhal_device_get_property_bool( ctx, parent, "storage.removable", &error ))
-        goto done;
-
     if (!(uuid_str = p_libhal_device_get_property_string( ctx, udi, "volume.uuid", &error )))
         p_dbus_error_free( &error );  /* ignore error */
     else
@@ -171,10 +168,13 @@ static void new_device( LibHalContext *ctx, const char *udi )
     else if (type && !strcmp( type, "floppy" )) drive_type = DEVICE_FLOPPY;
     else drive_type = DEVICE_UNKNOWN;
 
-    add_dos_device( -1, udi, device, mount_point, drive_type, guid_ptr );
-
-    /* add property watch for mount point */
-    p_libhal_device_add_property_watch( ctx, udi, &error );
+    if (p_libhal_device_get_property_bool( ctx, parent, "storage.removable", &error ))
+    {
+        add_dos_device( -1, udi, device, mount_point, drive_type, guid_ptr );
+        /* add property watch for mount point */
+        p_libhal_device_add_property_watch( ctx, udi, &error );
+    }
+    else if (guid_ptr) add_volume( udi, device, mount_point, DEVICE_HARDDISK_VOL, guid_ptr );
 
 done:
     if (type) p_libhal_free_string( type );
@@ -198,6 +198,7 @@ static void removed_device( LibHalContext *ctx, const char *udi )
         p_libhal_device_remove_property_watch( ctx, udi, &error );
         p_dbus_error_free( &error );
     }
+    else remove_volume( udi );
 }
 
 /* HAL callback for property changes */




More information about the wine-cvs mailing list