Commit 974f21ec authored by Beniamino Galvani's avatar Beniamino Galvani

checkpoint: don't include unrealized devices

Don't include unrealized devices in checkpoint because, as the name
says, they are not real.

While at it, remove nm_manager_get_device_paths() as it is no longer
used.
parent 66d04802
......@@ -153,7 +153,23 @@ nm_checkpoint_manager_create (NMCheckpointManager *self,
manager = GET_MANAGER (self);
if (!device_paths || !device_paths[0]) {
device_paths_free = nm_manager_get_device_paths (manager);
const char *device_path;
const GSList *iter;
GPtrArray *paths;
paths = g_ptr_array_new ();
for (iter = nm_manager_get_devices (manager);
iter;
iter = g_slist_next (iter)) {
device = NM_DEVICE (iter->data);
if (!nm_device_is_real (device))
continue;
device_path = nm_exported_object_get_path (NM_EXPORTED_OBJECT (device));
if (device_path)
g_ptr_array_add (paths, (gpointer) device_path);
}
g_ptr_array_add (paths, NULL);
device_paths_free = (const char **) g_ptr_array_free (paths, FALSE);
device_paths = (const char *const *) device_paths_free;
} else if (NM_FLAGS_HAS (flags, NM_CHECKPOINT_CREATE_FLAG_DISCONNECT_NEW_DEVICES)) {
g_set_error_literal (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_INVALID_ARGUMENTS,
......
......@@ -2589,28 +2589,6 @@ nm_manager_get_devices (NMManager *manager)
return NM_MANAGER_GET_PRIVATE (manager)->devices;
}
const char **
nm_manager_get_device_paths (NMManager *self)
{
const GSList *devices, *iter;
GPtrArray *paths;
const char *path;
g_return_val_if_fail (NM_IS_MANAGER (self), NULL);
devices = NM_MANAGER_GET_PRIVATE (self)->devices;
paths = g_ptr_array_new ();
for (iter = devices; iter; iter = g_slist_next (iter)) {
path = nm_exported_object_get_path (NM_EXPORTED_OBJECT (iter->data));
if (path)
g_ptr_array_add (paths, (gpointer) path);
}
g_ptr_array_add (paths, NULL);
return (const char **) g_ptr_array_free (paths, FALSE);
}
static NMDevice *
nm_manager_get_best_device_for_connection (NMManager *self,
NMConnection *connection,
......
......@@ -95,7 +95,6 @@ void nm_manager_write_device_state (NMManager *manager);
/* Device handling */
const GSList * nm_manager_get_devices (NMManager *manager);
const char ** nm_manager_get_device_paths (NMManager *self);
NMDevice * nm_manager_get_device_by_ifindex (NMManager *manager,
int ifindex);
......
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