From eba9fa9c0b647552d8a43fb6ff5ab00c2ab21402 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sat, 30 Mar 2019 14:14:56 +0100 Subject: [PATCH] ports: Drop HOOK_SETTINGS variable 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 --- src/hooks/ports/bonding | 12 ++++++------ src/hooks/ports/dummy | 6 +++--- src/hooks/ports/ethernet | 6 +++--- src/hooks/ports/ip-tunnel | 4 ++-- src/hooks/ports/vlan | 8 ++++---- src/hooks/ports/wireless-ap | 2 +- src/hooks/ports/wireless-mesh | 4 ++-- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/hooks/ports/bonding b/src/hooks/ports/bonding index 09fb74f0..a0cf5c0b 100644 --- a/src/hooks/ports/bonding +++ b/src/hooks/ports/bonding @@ -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 diff --git a/src/hooks/ports/dummy b/src/hooks/ports/dummy index 1c4b3c9f..387c88b5 100644 --- a/src/hooks/ports/dummy +++ b/src/hooks/ports/dummy @@ -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}'." diff --git a/src/hooks/ports/ethernet b/src/hooks/ports/ethernet index f3e3f9fd..5f76e158 100644 --- a/src/hooks/ports/ethernet +++ b/src/hooks/ports/ethernet @@ -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}) diff --git a/src/hooks/ports/ip-tunnel b/src/hooks/ports/ip-tunnel index b4269636..fa7193ca 100644 --- a/src/hooks/ports/ip-tunnel +++ b/src/hooks/ports/ip-tunnel @@ -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 diff --git a/src/hooks/ports/vlan b/src/hooks/ports/vlan index e9aa5454..f5119864 100644 --- a/src/hooks/ports/vlan +++ b/src/hooks/ports/vlan @@ -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}" diff --git a/src/hooks/ports/wireless-ap b/src/hooks/ports/wireless-ap index 8d495d28..e393f5f7 100644 --- a/src/hooks/ports/wireless-ap +++ b/src/hooks/ports/wireless-ap @@ -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}) diff --git a/src/hooks/ports/wireless-mesh b/src/hooks/ports/wireless-mesh index 306263dc..35f0950b 100644 --- a/src/hooks/ports/wireless-mesh +++ b/src/hooks/ports/wireless-mesh @@ -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) -- 2.39.2