ports: Drop HOOK_SETTINGS variable
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 30 Mar 2019 13:14:56 +0000 (14:14 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 30 Mar 2019 13:14:56 +0000 (14:14 +0100)
This does not need to be passed to the port_settings_* functions
any more which makes them more easy to use

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/hooks/ports/bonding
src/hooks/ports/dummy
src/hooks/ports/ethernet
src/hooks/ports/ip-tunnel
src/hooks/ports/vlan
src/hooks/ports/wireless-ap
src/hooks/ports/wireless-mesh

index 09fb74f..a0cf5c0 100644 (file)
@@ -116,7 +116,7 @@ hook_new() {
        assert isset port
 
        # Save configuration
-       if port_settings_write "${port}" ${HOOK_SETTINGS[*]}; then
+       if port_settings_write "${port}"; then
                log INFO "New port ${port} has been created"
        else
                error "Could not save configuration for ${port}"
@@ -168,7 +168,7 @@ hook_create() {
        # Exit silently if the device already exists
        device_exists "${port}" && exit ${EXIT_OK}
 
-       port_settings_read "${port}" ${HOOK_SETTINGS[*]}
+       port_settings_read "${port}"
 
        # Create the bonding devices
        bonding_create "${port}" \
@@ -184,7 +184,7 @@ hook_remove() {
        local port="${1}"
        assert isset port
 
-       port_settings_read "${port}" ${HOOK_SETTINGS[*]}
+       port_settings_read "${port}"
 
        # Remove the bonding device
        if device_exists "${port}"; then
@@ -196,7 +196,7 @@ hook_up() {
        local port="${1}"
        assert isset port
 
-       port_settings_read "${port}" ${HOOK_SETTINGS[*]}
+       port_settings_read "${port}"
 
        # Auto-enable or disable hardware offloading
        if ! isset OFFLOADING || enabled OFFLOADING; then
@@ -219,7 +219,7 @@ hook_down() {
        local port="${1}"
        assert isset port
 
-       port_settings_read "${port}" ${HOOK_SETTINGS[*]}
+       port_settings_read "${port}"
 
        # Bring down all slaves
        local slave
@@ -240,7 +240,7 @@ hook_hotplug() {
                        # Handle events of the same interface
                        if hotplug_event_port_is_interface "${port}"; then
                                # Read configuration
-                               port_settings_read "${port}" ${HOOK_SETTINGS[*]}
+                               port_settings_read "${port}"
 
                                # Bring up all slaves
                                # Attach those which already exist and try to create
index 1c4b3c9..387c88b 100644 (file)
@@ -62,7 +62,7 @@ hook_new() {
        local port=$(port_find_free ${DUMMY_PORT_PATTERN})
        assert isset port
 
-       if port_settings_write "${port}" ${HOOK_SETTINGS[*]}; then
+       if port_settings_write "${port}"; then
                log INFO "New dummy port '${port}' has been created"
        fi
 
@@ -74,7 +74,7 @@ hook_create() {
        assert isset port
 
        # Read configuration
-       port_settings_read "${port}" ${HOOK_SETTINGS[*]}
+       port_settings_read "${port}"
 
        # Create the dummy device
        dummy_create "${port}" "${ADDRESS}"
@@ -117,7 +117,7 @@ hook_hotplug_rename() {
        local device=${2}
        assert isset device
 
-       port_settings_read "${port}" ${HOOK_SETTINGS[*]}
+       port_settings_read "${port}"
 
        if [ "${ADDRESS}" = "$(device_get_address ${device})" ]; then
                log DEBUG "Device '${device}' equals port '${port}'."
index f3e3f9f..5f76e15 100644 (file)
@@ -117,7 +117,7 @@ hook_new() {
 
        local DEVICE="$(device_get_address "${device}")"
 
-       if ! port_settings_write "${port}" ${HOOK_SETTINGS[*]}; then
+       if ! port_settings_write "${port}"; then
                log ERROR "Could not write settings for port ${port}"
                return ${EXIT_ERROR}
        fi
@@ -133,7 +133,7 @@ hook_up() {
        local port="${1}"
 
        local ${HOOK_SETTINGS[*]}
-       if ! port_settings_read "${port}" ${HOOK_SETTINGS[*]}; then
+       if ! port_settings_read "${port}"; then
                log ERROR "Could not read settings for port ${port}"
                return ${EXIT_ERROR}
        fi
@@ -180,7 +180,7 @@ hook_hotplug_rename() {
        assert isset device
 
        # Read in the conifguration file.
-       port_settings_read "${port}" ${HOOK_SETTINGS[*]}
+       port_settings_read "${port}"
 
        # Get the current MAC address of the device.
        local address=$(device_get_address ${device})
index b426963..fa7193c 100644 (file)
@@ -115,7 +115,7 @@ hook_create() {
        assert isset port
 
        local ${HOOK_SETTINGS[*]}
-       if ! port_settings_read "${port}" ${HOOK_SETTINGS[*]}; then
+       if ! port_settings_read "${port}"; then
                log ERROR "Could not read settings for port ${port}"
                return ${EXIT_ERROR}
        fi
@@ -153,7 +153,7 @@ hook_hotplug_rename() {
        assert isset device
 
        local ${HOOK_SETTINGS[*]}
-       if ! port_settings_read "${port}" ${HOOK_SETTINGS[*]}; then
+       if ! port_settings_read "${port}"; then
                log ERROR "Could not read settings for port ${port}"
                return ${EXIT_ERROR}
        fi
index e9aa545..f511986 100644 (file)
@@ -72,7 +72,7 @@ hook_new() {
 
        local port="${PARENT_DEVICE}${VLAN_PORT_INTERFIX}${TAG}"
 
-       port_settings_write "${port}" ${HOOK_SETTINGS[*]}
+       port_settings_write "${port}"
 
        exit ${EXIT_OK}
 }
@@ -82,7 +82,7 @@ hook_edit() {
        assert isset port
        shift
 
-       port_settings_read "${port}" ${HOOK_SETTINGS[*]}
+       port_settings_read "${port}"
 
        while [ $# -gt 0 ]; do
                case "${1}" in
@@ -96,7 +96,7 @@ hook_edit() {
                shift
        done
 
-       port_settings_write "${port}" ${HOOK_SETTINGS[*]}
+       port_settings_write "${port}"
 
        exit ${EXIT_OK} 
 }
@@ -108,7 +108,7 @@ hook_create() {
        device_exists "${port}" && exit ${EXIT_OK}
 
        # Read configruation
-       port_settings_read "${port}" ${HOOK_SETTINGS[*]}
+       port_settings_read "${port}"
 
        # Create the VLAN device
        vlan_create "${port}" "${PARENT_DEVICE}" "${TAG}" "${ADDRESS}"
index 8d495d2..e393f5f 100644 (file)
@@ -197,7 +197,7 @@ hook_create() {
 
        device_exists "${port}" && exit ${EXIT_OK}
 
-       port_settings_read "${port}" ${HOOK_SETTINGS[*]}
+       port_settings_read "${port}"
 
        # Check if the PHY is present.
        local phy=$(phy_get ${PHY})
index 306263d..35f0950 100644 (file)
@@ -90,7 +90,7 @@ hook_create() {
        assert isset port
 
        # Read settings
-       port_settings_read "${port}" ${HOOK_SETTINGS[*]}
+       port_settings_read "${port}"
 
        # Check if the PHY is present.
        local phy="$(phy_get "${PHY}")"
@@ -149,7 +149,7 @@ hook_hotplug() {
        local port="${1}"
        assert isset port
 
-       port_settings_read "${port}" ${HOOK_SETTINGS[*]}
+       port_settings_read "${port}"
 
        case "$(hotplug_action)" in
                add)