[PATCH] dbus: shuffle property description struct members

Dan Williams dcbw at redhat.com
Fri Jul 29 16:01:29 EDT 2011


So we can put the access permissions before the getters/setters
and make it look prettier.

Signed-off-by: Dan Williams <dcbw at redhat.com>
---
 wpa_supplicant/dbus/dbus_new.c         |  226 ++++++++++++++------------------
 wpa_supplicant/dbus/dbus_new_helpers.h |    4 +-
 2 files changed, 102 insertions(+), 128 deletions(-)

diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index d233b90..3a5e358 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -1660,32 +1660,27 @@ static const struct wpa_dbus_method_desc wpas_dbus_global_methods[] = {
 };
 
 static const struct wpa_dbus_property_desc wpas_dbus_global_properties[] = {
-	{ "DebugLevel", WPAS_DBUS_NEW_INTERFACE, "s",
+	{ "DebugLevel", WPAS_DBUS_NEW_INTERFACE, "s", RW,
 	  wpas_dbus_getter_debug_level,
-	  wpas_dbus_setter_debug_level,
-	  RW
+	  wpas_dbus_setter_debug_level
 	},
-	{ "DebugTimestamp", WPAS_DBUS_NEW_INTERFACE, "b",
+	{ "DebugTimestamp", WPAS_DBUS_NEW_INTERFACE, "b", RW,
 	  wpas_dbus_getter_debug_timestamp,
-	  wpas_dbus_setter_debug_timestamp,
-	  RW
+	  wpas_dbus_setter_debug_timestamp
 	},
-	{ "DebugShowKeys", WPAS_DBUS_NEW_INTERFACE, "b",
+	{ "DebugShowKeys", WPAS_DBUS_NEW_INTERFACE, "b", RW,
 	  wpas_dbus_getter_debug_show_keys,
-	  wpas_dbus_setter_debug_show_keys,
-	  RW
+	  wpas_dbus_setter_debug_show_keys
 	},
-	{ "Interfaces", WPAS_DBUS_NEW_INTERFACE, "ao",
+	{ "Interfaces", WPAS_DBUS_NEW_INTERFACE, "ao", R,
 	  wpas_dbus_getter_interfaces,
-	  NULL,
-	  R
+	  NULL
 	},
-	{ "EapMethods", WPAS_DBUS_NEW_INTERFACE, "as",
+	{ "EapMethods", WPAS_DBUS_NEW_INTERFACE, "as", R,
 	  wpas_dbus_getter_eap_methods,
-	  NULL,
-	  R
+	  NULL
 	},
-	{ NULL, NULL, NULL, NULL, NULL, 0 }
+	{ NULL, NULL, NULL, 0, NULL, NULL }
 };
 
 static const struct wpa_dbus_signal_desc wpas_dbus_global_signals[] = {
@@ -1777,17 +1772,15 @@ static void wpa_dbus_free(void *ptr)
 
 
 static const struct wpa_dbus_property_desc wpas_dbus_network_properties[] = {
-	{ "Properties", WPAS_DBUS_NEW_IFACE_NETWORK, "a{sv}",
+	{ "Properties", WPAS_DBUS_NEW_IFACE_NETWORK, "a{sv}", RW,
 	  wpas_dbus_getter_network_properties,
-	  wpas_dbus_setter_network_properties,
-	  RW
+	  wpas_dbus_setter_network_properties
 	},
-	{ "Enabled", WPAS_DBUS_NEW_IFACE_NETWORK, "b",
+	{ "Enabled", WPAS_DBUS_NEW_IFACE_NETWORK, "b", RW,
 	  wpas_dbus_getter_enabled,
-	  wpas_dbus_setter_enabled,
-	  RW
+	  wpas_dbus_setter_enabled
 	},
-	{ NULL, NULL, NULL, NULL, NULL, 0 }
+	{ NULL, NULL, NULL, 0, NULL, NULL }
 };
 
 
@@ -1924,57 +1917,47 @@ int wpas_dbus_unregister_network(struct wpa_supplicant *wpa_s, int nid)
 
 
 static const struct wpa_dbus_property_desc wpas_dbus_bss_properties[] = {
-	{ "SSID", WPAS_DBUS_NEW_IFACE_BSS, "ay",
+	{ "SSID", WPAS_DBUS_NEW_IFACE_BSS, "ay", R,
 	  wpas_dbus_getter_bss_ssid,
-	  NULL,
-	  R
+	  NULL
 	},
-	{ "BSSID", WPAS_DBUS_NEW_IFACE_BSS, "ay",
+	{ "BSSID", WPAS_DBUS_NEW_IFACE_BSS, "ay", R,
 	  wpas_dbus_getter_bss_bssid,
-	  NULL,
-	  R
+	  NULL
 	},
-	{ "Privacy", WPAS_DBUS_NEW_IFACE_BSS, "b",
+	{ "Privacy", WPAS_DBUS_NEW_IFACE_BSS, "b", R,
 	  wpas_dbus_getter_bss_privacy,
-	  NULL,
-	  R
+	  NULL
 	},
-	{ "Mode", WPAS_DBUS_NEW_IFACE_BSS, "s",
+	{ "Mode", WPAS_DBUS_NEW_IFACE_BSS, "s", R,
 	  wpas_dbus_getter_bss_mode,
-	  NULL,
-	  R
+	  NULL
 	},
-	{ "Signal", WPAS_DBUS_NEW_IFACE_BSS, "n",
+	{ "Signal", WPAS_DBUS_NEW_IFACE_BSS, "n", R,
 	  wpas_dbus_getter_bss_signal,
-	  NULL,
-	  R
+	  NULL
 	},
-	{ "Frequency", WPAS_DBUS_NEW_IFACE_BSS, "q",
+	{ "Frequency", WPAS_DBUS_NEW_IFACE_BSS, "q", R,
 	  wpas_dbus_getter_bss_frequency,
-	  NULL,
-	  R
+	  NULL
 	},
-	{ "Rates", WPAS_DBUS_NEW_IFACE_BSS, "au",
+	{ "Rates", WPAS_DBUS_NEW_IFACE_BSS, "au", R,
 	  wpas_dbus_getter_bss_rates,
-	  NULL,
-	  R
+	  NULL
 	},
-	{ "WPA", WPAS_DBUS_NEW_IFACE_BSS, "a{sv}",
+	{ "WPA", WPAS_DBUS_NEW_IFACE_BSS, "a{sv}", R,
 	  wpas_dbus_getter_bss_wpa,
-	  NULL,
-	  R
+	  NULL
 	},
-	{ "RSN", WPAS_DBUS_NEW_IFACE_BSS, "a{sv}",
+	{ "RSN", WPAS_DBUS_NEW_IFACE_BSS, "a{sv}", R,
 	  wpas_dbus_getter_bss_rsn,
-	  NULL,
-	  R
+	  NULL
 	},
-	{ "IEs", WPAS_DBUS_NEW_IFACE_BSS, "ay",
+	{ "IEs", WPAS_DBUS_NEW_IFACE_BSS, "ay", R,
 	  wpas_dbus_getter_bss_ies,
-	  NULL,
-	  R
+	  NULL
 	},
-	{ NULL, NULL, NULL, NULL, NULL, 0 }
+	{ NULL, NULL, NULL, 0, NULL, NULL }
 };
 
 
@@ -2353,109 +2336,103 @@ static const struct wpa_dbus_method_desc wpas_dbus_interface_methods[] = {
 };
 
 static const struct wpa_dbus_property_desc wpas_dbus_interface_properties[] = {
-	{ "Capabilities", WPAS_DBUS_NEW_IFACE_INTERFACE, "a{sv}",
+	{ "Capabilities", WPAS_DBUS_NEW_IFACE_INTERFACE, "a{sv}", R,
 	  wpas_dbus_getter_capabilities,
-	  NULL, R
+	  NULL
 	},
-	{ "State", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
+	{ "State", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", R,
 	  wpas_dbus_getter_state,
-	  NULL, R
+	  NULL
 	},
-	{ "Scanning", WPAS_DBUS_NEW_IFACE_INTERFACE, "b",
+	{ "Scanning", WPAS_DBUS_NEW_IFACE_INTERFACE, "b", R,
 	  wpas_dbus_getter_scanning,
-	  NULL, R
+	  NULL
 	},
-	{ "ApScan", WPAS_DBUS_NEW_IFACE_INTERFACE, "u",
+	{ "ApScan", WPAS_DBUS_NEW_IFACE_INTERFACE, "u", RW,
 	  wpas_dbus_getter_ap_scan,
-	  wpas_dbus_setter_ap_scan,
-	  RW
+	  wpas_dbus_setter_ap_scan
 	},
-	{ "BSSExpireAge", WPAS_DBUS_NEW_IFACE_INTERFACE, "u",
+	{ "BSSExpireAge", WPAS_DBUS_NEW_IFACE_INTERFACE, "u", RW,
 	  wpas_dbus_getter_bss_expire_age,
-	  wpas_dbus_setter_bss_expire_age,
-	  RW
+	  wpas_dbus_setter_bss_expire_age
 	},
-	{ "BSSExpireCount", WPAS_DBUS_NEW_IFACE_INTERFACE, "u",
+	{ "BSSExpireCount", WPAS_DBUS_NEW_IFACE_INTERFACE, "u", RW,
 	  wpas_dbus_getter_bss_expire_count,
-	  wpas_dbus_setter_bss_expire_count,
-	  RW
+	  wpas_dbus_setter_bss_expire_count
 	},
-	{ "Country", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
+	{ "Country", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", RW,
 	  wpas_dbus_getter_country,
-	  wpas_dbus_setter_country,
-	  RW
+	  wpas_dbus_setter_country
 	},
-	{ "Ifname", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
+	{ "Ifname", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", R,
 	  wpas_dbus_getter_ifname,
-	  NULL, R
+	  NULL
 	},
-	{ "Driver", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
+	{ "Driver", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", R,
 	  wpas_dbus_getter_driver,
-	  NULL, R
+	  NULL
 	},
-	{ "BridgeIfname", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
+	{ "BridgeIfname", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", R,
 	  wpas_dbus_getter_bridge_ifname,
-	  NULL, R
+	  NULL
 	},
-	{ "CurrentBSS", WPAS_DBUS_NEW_IFACE_INTERFACE, "o",
+	{ "CurrentBSS", WPAS_DBUS_NEW_IFACE_INTERFACE, "o", R,
 	  wpas_dbus_getter_current_bss,
-	  NULL, R
+	  NULL
 	},
-	{ "CurrentNetwork", WPAS_DBUS_NEW_IFACE_INTERFACE, "o",
+	{ "CurrentNetwork", WPAS_DBUS_NEW_IFACE_INTERFACE, "o", R,
 	  wpas_dbus_getter_current_network,
-	  NULL, R
+	  NULL
 	},
-	{ "CurrentAuthMode", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
+	{ "CurrentAuthMode", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", R,
 	  wpas_dbus_getter_current_auth_mode,
-	  NULL, R
+	  NULL
 	},
-	{ "Blobs", WPAS_DBUS_NEW_IFACE_INTERFACE, "a{say}",
+	{ "Blobs", WPAS_DBUS_NEW_IFACE_INTERFACE, "a{say}", R,
 	  wpas_dbus_getter_blobs,
-	  NULL, R
+	  NULL
 	},
-	{ "BSSs", WPAS_DBUS_NEW_IFACE_INTERFACE, "ao",
+	{ "BSSs", WPAS_DBUS_NEW_IFACE_INTERFACE, "ao", R,
 	  wpas_dbus_getter_bsss,
-	  NULL, R
+	  NULL
 	},
-	{ "Networks", WPAS_DBUS_NEW_IFACE_INTERFACE, "ao",
+	{ "Networks", WPAS_DBUS_NEW_IFACE_INTERFACE, "ao", R,
 	  wpas_dbus_getter_networks,
-	  NULL, R
+	  NULL
 	},
 #ifdef CONFIG_WPS
-	{ "ProcessCredentials", WPAS_DBUS_NEW_IFACE_WPS, "b",
+	{ "ProcessCredentials", WPAS_DBUS_NEW_IFACE_WPS, "b", RW,
 	  wpas_dbus_getter_process_credentials,
-	  wpas_dbus_setter_process_credentials,
-	  RW
+	  wpas_dbus_setter_process_credentials
 	},
 #endif /* CONFIG_WPS */
 #ifdef CONFIG_P2P
-	{ "P2PDeviceProperties", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "a{sv}",
+	{ "P2PDeviceProperties", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "a{sv}", RW,
 	  wpas_dbus_getter_p2p_device_properties,
-	  wpas_dbus_setter_p2p_device_properties,
-	  RW
+	  wpas_dbus_setter_p2p_device_properties
 	},
-	{ "Peers", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "ao",
+	{ "Peers", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "ao", R,
 	  wpas_dbus_getter_p2p_peers,
-	  NULL, R
+	  NULL
 	},
-	{ "Role", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "s",
+	{ "Role", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "s", R,
 	  wpas_dbus_getter_p2p_role,
-	  NULL, R
+	  NULL
 	},
-	{ "Group", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "o",
+	{ "Group", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "o", R,
 	  wpas_dbus_getter_p2p_group,
-	  NULL, R
+	  NULL
 	},
-	{ "PeerGO", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "o",
+	{ "PeerGO", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "o", R,
 	  wpas_dbus_getter_p2p_peergo,
-	  NULL, R
+	  NULL
 	},
-	{ "PersistentGroups", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "ao",
+	{ "PersistentGroups", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "ao", R,
 	  wpas_dbus_getter_persistent_groups,
-	  NULL, R
+	  NULL
 	},
 #endif /* CONFIG_P2P */
-	{ NULL, NULL, NULL, NULL, NULL, 0 }
+	{ NULL, NULL, NULL, 0, NULL, NULL }
 };
 
 static const struct wpa_dbus_signal_desc wpas_dbus_interface_signals[] = {
@@ -2759,15 +2736,15 @@ int wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s)
 #ifdef CONFIG_P2P
 
 static const struct wpa_dbus_property_desc wpas_dbus_p2p_peer_properties[] = {
-	{ "Properties", WPAS_DBUS_NEW_IFACE_P2P_PEER, "a{sv}",
+	{ "Properties", WPAS_DBUS_NEW_IFACE_P2P_PEER, "a{sv}", R,
 	  wpas_dbus_getter_p2p_peer_properties,
-	  NULL, R
+	  NULL
 	},
-	{ "IEs", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay",
+	{ "IEs", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay", R,
 	  wpas_dbus_getter_p2p_peer_ies,
-	  NULL, R
+	  NULL
 	},
-	{ NULL, NULL, NULL, NULL, NULL, 0 }
+	{ NULL, NULL, NULL, 0, NULL, NULL }
 };
 
 static const struct wpa_dbus_signal_desc wpas_dbus_p2p_peer_signals[] = {
@@ -2956,17 +2933,15 @@ int wpas_dbus_unregister_peer(struct wpa_supplicant *wpa_s,
 
 
 static const struct wpa_dbus_property_desc wpas_dbus_p2p_group_properties[] = {
-	{ "Members", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "ao",
+	{ "Members", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "ao", R,
 	  wpas_dbus_getter_p2p_group_members,
-	  NULL, R
+	  NULL
 	},
-	{ "Properties",
-	  WPAS_DBUS_NEW_IFACE_P2P_GROUP, "a{sv}",
+	{ "Properties", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "a{sv}", RW,
 	  wpas_dbus_getter_p2p_group_properties,
-	  wpas_dbus_setter_p2p_group_properties,
-	  RW
+	  wpas_dbus_setter_p2p_group_properties
 	},
-	{ NULL, NULL, NULL, NULL, NULL, 0 }
+	{ NULL, NULL, NULL, 0, NULL, NULL }
 };
 
 static const struct wpa_dbus_signal_desc wpas_dbus_p2p_group_signals[] = {
@@ -3086,11 +3061,11 @@ void wpas_dbus_unregister_p2p_group(struct wpa_supplicant *wpa_s,
 
 static const struct wpa_dbus_property_desc
 wpas_dbus_p2p_groupmember_properties[] = {
-	{ "Properties", WPAS_DBUS_NEW_IFACE_P2P_GROUPMEMBER, "a{sv}",
+	{ "Properties", WPAS_DBUS_NEW_IFACE_P2P_GROUPMEMBER, "a{sv}", R,
 	  wpas_dbus_getter_p2p_group_properties,
-	  NULL, R
+	  NULL
 	},
-	{ NULL, NULL, NULL, NULL, NULL, 0 }
+	{ NULL, NULL, NULL, 0, NULL, NULL }
 };
 
 /**
@@ -3193,12 +3168,11 @@ void wpas_dbus_unregister_p2p_groupmember(struct wpa_supplicant *wpa_s,
 
 static const struct wpa_dbus_property_desc
 	wpas_dbus_persistent_group_properties[] = {
-	{ "Properties", WPAS_DBUS_NEW_IFACE_PERSISTENT_GROUP, "a{sv}",
+	{ "Properties", WPAS_DBUS_NEW_IFACE_PERSISTENT_GROUP, "a{sv}", RW,
 	  wpas_dbus_getter_persistent_group_properties,
-	  wpas_dbus_setter_persistent_group_properties,
-	  RW
+	  wpas_dbus_setter_persistent_group_properties
 	},
-	{ NULL, NULL, NULL, NULL, NULL, 0 }
+	{ NULL, NULL, NULL, 0, NULL, NULL }
 };
 
 /* No signals intended for persistent group objects */
diff --git a/wpa_supplicant/dbus/dbus_new_helpers.h b/wpa_supplicant/dbus/dbus_new_helpers.h
index d33df20..1b346ca 100644
--- a/wpa_supplicant/dbus/dbus_new_helpers.h
+++ b/wpa_supplicant/dbus/dbus_new_helpers.h
@@ -93,12 +93,12 @@ struct wpa_dbus_property_desc {
 	const char *dbus_interface;
 	/* property type signature in DBus type notation */
 	const char *type;
+	/* property access permissions */
+	enum dbus_prop_access access;
 	/* property getter function */
 	WPADBusPropertyAccessor getter;
 	/* property setter function */
 	WPADBusPropertyAccessor setter;
-	/* property access permissions */
-	enum dbus_prop_access access;
 };
 
 
-- 
1.7.4.4




More information about the HostAP mailing list