platform: remove nm_platform_delete_device_by_name()

This commit is contained in:
Pavel Šimerda 2013-07-26 14:56:38 +02:00
parent ad5b0a8e67
commit 1c88de0488
6 changed files with 9 additions and 46 deletions

View file

@ -384,7 +384,6 @@ nm_platform_link_delete (int ifindex)
reset_error ();
g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (klass->link_delete, FALSE);
name = nm_platform_link_get_name (ifindex);
@ -396,23 +395,6 @@ nm_platform_link_delete (int ifindex)
return klass->link_delete (platform, ifindex);
}
/**
* nm_platform_link_delete_by_name:
* @name: Interface name
*
* Delete a software interface.
*/
gboolean
nm_platform_link_delete_by_name (const char *name)
{
int ifindex = nm_platform_link_get_ifindex (name);
if (!ifindex)
return FALSE;
return nm_platform_link_delete (ifindex);
}
/**
* nm_platform_link_get_index:
* @name: Interface name
@ -454,7 +436,6 @@ nm_platform_link_get_name (int ifindex)
reset_error ();
g_return_val_if_fail (ifindex > 0, NULL);
g_return_val_if_fail (klass->link_get_name, NULL);
name = klass->link_get_name (platform, ifindex);

View file

@ -327,7 +327,6 @@ gboolean nm_platform_bond_add (const char *name);
gboolean nm_platform_team_add (const char *name);
gboolean nm_platform_link_exists (const char *name);
gboolean nm_platform_link_delete (int ifindex);
gboolean nm_platform_link_delete_by_name (const char *ifindex);
int nm_platform_link_get_ifindex (const char *name);
const char *nm_platform_link_get_name (int ifindex);
NMLinkType nm_platform_link_get_type (int ifindex);

View file

@ -221,7 +221,7 @@ test_ip6_address_external (void)
void
setup_tests (void)
{
nm_platform_link_delete_by_name (DEVICE_NAME);
nm_platform_link_delete (nm_platform_link_get_ifindex (DEVICE_NAME));
g_assert (!nm_platform_link_exists (DEVICE_NAME));
nm_platform_dummy_add (DEVICE_NAME);

View file

@ -81,7 +81,7 @@ test_cleanup_internal ()
void
setup_tests (void)
{
nm_platform_link_delete_by_name (DEVICE_NAME);
nm_platform_link_delete (nm_platform_link_get_ifindex (DEVICE_NAME));
g_assert (!nm_platform_link_exists (DEVICE_NAME));
g_test_add_func ("/internal", test_cleanup_internal);

View file

@ -70,8 +70,6 @@ test_bogus(void)
no_error ();
g_assert (!nm_platform_link_delete (BOGUS_IFINDEX));
error (NM_PLATFORM_ERROR_NOT_FOUND);
g_assert (!nm_platform_link_delete_by_name (BOGUS_NAME));
error (NM_PLATFORM_ERROR_NOT_FOUND);
g_assert (!nm_platform_link_get_ifindex (BOGUS_NAME));
error (NM_PLATFORM_ERROR_NOT_FOUND);
g_assert (!nm_platform_link_get_name (BOGUS_IFINDEX));
@ -359,7 +357,7 @@ test_software (NMLinkType link_type, const char *link_typename)
}
/* Delete */
g_assert (nm_platform_link_delete_by_name (DEVICE_NAME));
g_assert (nm_platform_link_delete (ifindex));
no_error ();
g_assert (!nm_platform_link_exists (DEVICE_NAME)); no_error ();
g_assert_cmpint (nm_platform_link_get_type (ifindex), ==, NM_LINK_TYPE_NONE);
@ -369,12 +367,12 @@ test_software (NMLinkType link_type, const char *link_typename)
accept_signal (link_removed);
/* Delete again */
g_assert (!nm_platform_link_delete_by_name (DEVICE_NAME));
g_assert (!nm_platform_link_delete (nm_platform_link_get_ifindex (DEVICE_NAME)));
error (NM_PLATFORM_ERROR_NOT_FOUND);
/* VLAN: Delete parent */
if (link_type == NM_LINK_TYPE_VLAN) {
g_assert (nm_platform_link_delete_by_name (PARENT_NAME));
g_assert (nm_platform_link_delete (vlan_parent));
accept_signal (link_removed);
}
@ -490,21 +488,6 @@ test_internal (void)
g_assert (!nm_platform_link_delete (ifindex));
error (NM_PLATFORM_ERROR_NOT_FOUND);
/* Add back */
g_assert_cmpstr (link_added->ifname, ==, DEVICE_NAME);
g_assert (nm_platform_dummy_add (DEVICE_NAME));
no_error ();
wait_signal (link_added);
/* Delete device by name */
g_assert (nm_platform_link_delete_by_name (DEVICE_NAME));
no_error ();
accept_signal (link_removed);
/* Try to delete again */
g_assert (!nm_platform_link_delete_by_name (DEVICE_NAME));
error (NM_PLATFORM_ERROR_NOT_FOUND);
free_signal (link_added);
free_signal (link_changed);
free_signal (link_removed);
@ -567,9 +550,9 @@ test_external (void)
void
setup_tests (void)
{
nm_platform_link_delete_by_name (DEVICE_NAME);
nm_platform_link_delete_by_name (SLAVE_NAME);
nm_platform_link_delete_by_name (PARENT_NAME);
nm_platform_link_delete (nm_platform_link_get_ifindex (DEVICE_NAME));
nm_platform_link_delete (nm_platform_link_get_ifindex (SLAVE_NAME));
nm_platform_link_delete (nm_platform_link_get_ifindex (PARENT_NAME));
g_assert (!nm_platform_link_exists (DEVICE_NAME));
g_assert (!nm_platform_link_exists (SLAVE_NAME));
g_assert (!nm_platform_link_exists (PARENT_NAME));

View file

@ -199,7 +199,7 @@ test_ip6_route ()
void
setup_tests (void)
{
nm_platform_link_delete_by_name (DEVICE_NAME);
nm_platform_link_delete (nm_platform_link_get_ifindex (DEVICE_NAME));
g_assert (!nm_platform_link_exists (DEVICE_NAME));
g_assert (nm_platform_dummy_add (DEVICE_NAME));
g_assert (nm_platform_link_set_up (nm_platform_link_get_ifindex (DEVICE_NAME)));