void
devkit_disks_device_local_set_unmounted (DevkitDisksDevice *device,
+ const char *given_mount_path,
gboolean emit_changed_signal)
{
char *mount_path;
gboolean remove_dir_on_unmount;
- mount_path = g_strdup (device->priv->info.device_mount_path);
+ if (given_mount_path != NULL)
+ mount_path = g_strdup (given_mount_path);
+ else
+ mount_path = g_strdup (device->priv->info.device_mount_path);
/* make sure we clean up directories created by ourselves in /media */
if (!mounts_file_has_device (device, NULL, &remove_dir_on_unmount)) {
remove_dir_on_unmount = FALSE;
}
+ g_warning ("mount_path=%s remove_dir_on_unmount=%d", mount_path, remove_dir_on_unmount);
+
g_free (device->priv->info.device_mount_path);
device->priv->info.device_mount_path = NULL;
device->priv->info.device_is_mounted = FALSE;
if (emit_changed_signal)
emit_changed (device);
-
g_free (mount_path);
}
char *mount_path = user_data;
if (WEXITSTATUS (status) == 0 && !job_was_cancelled) {
- devkit_disks_device_local_set_unmounted (device, TRUE);
+ devkit_disks_device_local_set_unmounted (device, mount_path, TRUE);
if (mount_path != NULL) /* can be NULL when unmounting /etc/fstab mounts */
mounts_file_remove (device, mount_path);
dbus_g_method_return (context);
if (WEXITSTATUS (status) == 0 && !job_was_cancelled) {
g_warning ("Successfully force unmounted device %s", device->priv->info.device_file);
- devkit_disks_device_local_set_unmounted (device, TRUE);
+ devkit_disks_device_local_set_unmounted (device, NULL, TRUE);
mounts_file_remove (device, data->mount_path);
/* TODO: when we add polling, this can probably be removed. I have no idea why hal's
{
struct stat statbuf;
if (stat (device_path, &statbuf) == 0) {
- g_warning ("major=%d minor=%d", major (statbuf.st_rdev), minor (statbuf.st_rdev));
if (major (statbuf.st_rdev) == 253) {
+ /* TODO: should check that /dev/dm-%d exists and has same major/minor */
return g_strdup_printf ("/dev/dm-%d", minor (statbuf.st_rdev));
}
}
if (mounted_by_uid != NULL)
*mounted_by_uid = atoi (tokens[MOUNTS_FILE_MOUNTED_BY_UID]);
if (remove_dir_on_unmount != NULL)
- if (strcmp (tokens[MOUNTS_FILE_MOUNTED_BY_UID], "1") == 0)
+ if (strcmp (tokens[MOUNTS_FILE_REMOVE_DIR_ON_UNMOUNT], "1") == 0)
*remove_dir_on_unmount = TRUE;
g_strfreev (lines);