static gboolean device_local_is_busy (Device *device,
gboolean check_partitions,
- gboolean check_mounted,
GError **error);
static gboolean device_local_partitions_are_busy (Device *device);
* device_local_is_busy:
* @device: A #Device.
* @check_partitions: Whether to check if partitions is busy if @device is a partition table
- * @check_mounted: Whether to check if device has mounted file systems
* @error: Either %NULL or a #GError to set to #ERROR_BUSY and an appropriate
* message, e.g. "Device is busy" or "A partition on the device is busy" if the device is busy.
*
static gboolean
device_local_is_busy (Device *device,
gboolean check_partitions,
- gboolean check_mounted,
GError **error)
{
gboolean ret;
}
/* or if we're mounted */
- if (check_mounted && device->priv->device_is_mounted)
+ if (device->priv->device_is_mounted)
{
g_set_error (error, ERROR, ERROR_BUSY, "%s is mounted", device->priv->device_file);
goto out;
== 0)
{
- if (device_local_is_busy (d, FALSE, TRUE, NULL))
+ if (device_local_is_busy (d, FALSE, NULL))
{
ret = TRUE;
break;
== 0 && g_strcmp0 (d->priv->partition_scheme, "mbr") == 0 && d->priv->partition_number >= 5)
{
- if (device_local_is_busy (d, FALSE, TRUE, NULL))
+ if (device_local_is_busy (d, FALSE, NULL))
{
ret = TRUE;
break;
}
}
- if (device_local_is_busy (device, FALSE, TRUE, &error))
+ if (device_local_is_busy (device, FALSE, &error))
{
dbus_g_method_return_error (context, error);
g_error_free (error);
int n;
char *argv[16];
GError *error;
- gboolean unmount = FALSE;
error = NULL;
goto out;
}
- for (n = 0; options[n] != NULL; n++)
+ if (device_local_is_busy (device, TRUE, &error))
{
- const char *option = options[n];
- if (strcmp ("unmount", option) == 0)
- {
- unmount = TRUE;
- }
- else
- {
- throw_error (context, ERROR_INVALID_OPTION, "Unknown option %s", option);
- goto out;
- }
+ throw_error (context, ERROR_BUSY, error->message);
+ g_error_free (error);
+ goto out;
}
- /* If we specify the unmount option, don't check if the device is mounted */
- if (device_local_is_busy (device, TRUE, !unmount, &error))
+ for (n = 0; options[n] != NULL; n++)
{
- throw_error (context, ERROR_BUSY, error->message);
- g_error_free (error);
+ const char *option = options[n];
+ throw_error (context, ERROR_INVALID_OPTION, "Unknown option %s", option);
goto out;
}
- /* eject already unmounts the file systems on the ejected drive, so we do not
- * need any particular handling of the unmount flag here */
n = 0;
argv[n++] = "eject";
argv[n++] = device->priv->device_file;
goto out;
}
- if (device_local_is_busy (device, TRUE, TRUE, &error))
+ if (device_local_is_busy (device, TRUE, &error))
{
dbus_g_method_return_error (context, error);
g_error_free (error);
part_number_as_string = NULL;
error = NULL;
- if (device_local_is_busy (device, FALSE, TRUE, &error))
+ if (device_local_is_busy (device, FALSE, &error))
{
dbus_g_method_return_error (context, error);
g_error_free (error);
goto out;
}
- if (device_local_is_busy (enclosing_device, FALSE, TRUE, &error))
+ if (device_local_is_busy (enclosing_device, FALSE, &error))
{
dbus_g_method_return_error (context, error);
g_error_free (error);
passphrase_stdin = NULL;
error = NULL;
- if (device_local_is_busy (device, TRUE, TRUE, &error))
+ if (device_local_is_busy (device, TRUE, &error))
{
dbus_g_method_return_error (context, error);
g_error_free (error);
goto out;
}
- if (device_local_is_busy (device, FALSE, TRUE, &error))
+ if (device_local_is_busy (device, FALSE, &error))
{
dbus_g_method_return_error (context, error);
g_error_free (error);
goto out;
}
- if (device_local_is_busy (enclosing_device, FALSE, TRUE, &error))
+ if (device_local_is_busy (enclosing_device, FALSE, &error))
{
dbus_g_method_return_error (context, error);
g_error_free (error);
error = NULL;
- if (device_local_is_busy (device, TRUE, TRUE, &error))
+ if (device_local_is_busy (device, TRUE, &error))
{
dbus_g_method_return_error (context, error);
g_error_free (error);
daemon_local_get_uid (device->priv->daemon, &uid, context);
- if (device_local_is_busy (device, FALSE, TRUE, &error))
+ if (device_local_is_busy (device, FALSE, &error))
{
dbus_g_method_return_error (context, error);
g_error_free (error);
if (!fs_details->supports_online_label_rename)
{
- if (device_local_is_busy (device, FALSE, TRUE, &error))
+ if (device_local_is_busy (device, FALSE, &error))
{
dbus_g_method_return_error (context, error);
g_error_free (error);
if (!fs_details->supports_online_label_rename)
{
- if (device_local_is_busy (device, FALSE, TRUE, &error))
+ if (device_local_is_busy (device, FALSE, &error))
{
dbus_g_method_return_error (context, error);
g_error_free (error);
* hot adding a new disk if an old one failed
*/
- if (device_local_is_busy (slave, TRUE, TRUE, &error))
+ if (device_local_is_busy (slave, TRUE, &error))
{
dbus_g_method_return_error (context, error);
g_error_free (error);
goto out;
}
- if (device_local_is_busy (slave, TRUE, TRUE, &error))
+ if (device_local_is_busy (slave, TRUE, &error))
{
dbus_g_method_return_error (context, error);
g_error_free (error);
if (device == data->slave)
{
- if (device_local_is_busy (data->slave, FALSE, TRUE, &error))
+ if (device_local_is_busy (data->slave, FALSE, &error))
{
dbus_g_method_return_error (data->context, error);
g_error_free (error);
}
}
- if (device_local_is_busy (slave, FALSE, TRUE, &error))
+ if (device_local_is_busy (slave, FALSE, &error))
{
dbus_g_method_return_error (context, error);
g_error_free (error);
goto out;
}
- if (device_local_is_busy (slave, FALSE, TRUE, &error))
+ if (device_local_is_busy (slave, FALSE, &error))
{
dbus_g_method_return_error (context, error);
g_error_free (error);
}
error = NULL;
- if (device_local_is_busy (pv, TRUE, TRUE, &error))
+ if (device_local_is_busy (pv, TRUE, &error))
{
dbus_g_method_return_error (context, error);
g_error_free (error);
}
error = NULL;
- if (device_local_is_busy (pv, TRUE, TRUE, &error))
+ if (device_local_is_busy (pv, TRUE, &error))
{
dbus_g_method_return_error (context, error);
g_error_free (error);