device: cleanup handling master/slave relationships in NMDevice
I found the handling of the master-device very confusing because it was unclear who sets priv->master, and when it should be set. Now: - Setting priv->master (in a slave) always goes together with adding the master to priv->slaves (in the master). Previously, this was done at separate places, so it was not clear if master and slave always agree on their relationship -- in fact, they did not. - There are now three basic functions which do the enslaving/releasing: (1) nm_device_master_add_slave() (2) nm_device_master_enslave_slave() (3) nm_device_master_release_one_slave() Step 3/release basically undoes the 1/add and 2/enslave steps. - completing the enslaving/releasing is now done by (1) nm_device_slave_notify_enslave() (2) nm_device_slave_notify_release() These functions also emit signals like NM_DEVICE_MASTER. - Derived classes no longer emit NM_DEVICE_SLAVES notification. Instead the notification is emited together with NM_DEVICE_MASTER, whenever a slaves changes state. Also, NM_DEVICE_SLAVES list now only exposes slaves that are actually @is_enslaved.
Showing with 118 additions and 89 deletions