Commit 19e2d0cd authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent 22f58341
...@@ -47,10 +47,6 @@ static void appeared_callback( DADiskRef disk, void *context ) ...@@ -47,10 +47,6 @@ static void appeared_callback( DADiskRef disk, void *context )
if (!dict) return; if (!dict) return;
/* ignore non-removable devices */
if (!(ref = CFDictionaryGetValue( dict, CFSTR("DAMediaRemovable") )) ||
!CFBooleanGetValue( ref )) goto done;
if ((ref = CFDictionaryGetValue( dict, CFSTR("DAVolumeUUID") ))) if ((ref = CFDictionaryGetValue( dict, CFSTR("DAVolumeUUID") )))
{ {
CFUUIDBytes bytes = CFUUIDGetUUIDBytes( ref ); CFUUIDBytes bytes = CFUUIDGetUUIDBytes( ref );
...@@ -78,7 +74,11 @@ static void appeared_callback( DADiskRef disk, void *context ) ...@@ -78,7 +74,11 @@ static void appeared_callback( DADiskRef disk, void *context )
TRACE( "got mount notification for '%s' on '%s' uuid %s\n", TRACE( "got mount notification for '%s' on '%s' uuid %s\n",
device, mount_point, wine_dbgstr_guid(guid_ptr) ); 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: done:
CFRelease( dict ); CFRelease( dict );
} }
...@@ -96,10 +96,6 @@ static void disappeared_callback( DADiskRef disk, void *context ) ...@@ -96,10 +96,6 @@ static void disappeared_callback( DADiskRef disk, void *context )
if (!dict) return; if (!dict) return;
/* ignore non-removable devices */
if (!(ref = CFDictionaryGetValue( dict, CFSTR("DAMediaRemovable") )) ||
!CFBooleanGetValue( ref )) goto done;
/* get device name */ /* get device name */
if (!(ref = CFDictionaryGetValue( dict, CFSTR("DAMediaBSDName") ))) goto done; if (!(ref = CFDictionaryGetValue( dict, CFSTR("DAMediaBSDName") ))) goto done;
strcpy( device, "/dev/r" ); strcpy( device, "/dev/r" );
...@@ -107,7 +103,11 @@ static void disappeared_callback( DADiskRef disk, void *context ) ...@@ -107,7 +103,11 @@ static void disappeared_callback( DADiskRef disk, void *context )
TRACE( "got unmount notification for '%s'\n", device ); 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: done:
CFRelease( dict ); CFRelease( dict );
} }
......
...@@ -156,9 +156,6 @@ static void new_device( LibHalContext *ctx, const char *udi ) ...@@ -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 ))) if (!(parent = p_libhal_device_get_property_string( ctx, udi, "info.parent", &error )))
goto done; 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 ))) if (!(uuid_str = p_libhal_device_get_property_string( ctx, udi, "volume.uuid", &error )))
p_dbus_error_free( &error ); /* ignore error */ p_dbus_error_free( &error ); /* ignore error */
else else
...@@ -171,10 +168,13 @@ static void new_device( LibHalContext *ctx, const char *udi ) ...@@ -171,10 +168,13 @@ static void new_device( LibHalContext *ctx, const char *udi )
else if (type && !strcmp( type, "floppy" )) drive_type = DEVICE_FLOPPY; else if (type && !strcmp( type, "floppy" )) drive_type = DEVICE_FLOPPY;
else drive_type = DEVICE_UNKNOWN; else drive_type = DEVICE_UNKNOWN;
add_dos_device( -1, udi, device, mount_point, drive_type, guid_ptr ); if (p_libhal_device_get_property_bool( ctx, parent, "storage.removable", &error ))
{
/* add property watch for mount point */ add_dos_device( -1, udi, device, mount_point, drive_type, guid_ptr );
p_libhal_device_add_property_watch( ctx, udi, &error ); /* 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: done:
if (type) p_libhal_free_string( type ); if (type) p_libhal_free_string( type );
...@@ -198,6 +198,7 @@ static void removed_device( LibHalContext *ctx, const char *udi ) ...@@ -198,6 +198,7 @@ static void removed_device( LibHalContext *ctx, const char *udi )
p_libhal_device_remove_property_watch( ctx, udi, &error ); p_libhal_device_remove_property_watch( ctx, udi, &error );
p_dbus_error_free( &error ); p_dbus_error_free( &error );
} }
else remove_volume( udi );
} }
/* HAL callback for property changes */ /* HAL callback for property changes */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment