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

This commit is contained in:
Alexandre Julliard 2009-07-21 20:33:17 +02:00
parent 22f58341dc
commit 19e2d0cd5d
2 changed files with 18 additions and 17 deletions

View File

@ -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 );
}

View File

@ -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 */