summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2016-01-15 12:47:10 +0100
committerJakub Hrozek <jhrozek@redhat.com>2016-06-20 14:48:46 +0200
commit397bc52dd09a8c032abc7ea47a6d81dba5957464 (patch)
treedcccfd8e300eea2468f4a5ecb8f57e48393d63c0
parentcc2d77d5218c188119fa954c856e858cbde76947 (diff)
downloadsssd-397bc52dd09a8c032abc7ea47a6d81dba5957464.tar.gz
sssd-397bc52dd09a8c032abc7ea47a6d81dba5957464.tar.xz
sssd-397bc52dd09a8c032abc7ea47a6d81dba5957464.zip
SBUS: Add sbus_conn_register_iface_map
Reviewed-by: Sumit Bose <sbose@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
-rw-r--r--src/responder/ifp/ifp_iface.c20
-rw-r--r--src/sbus/sssd_dbus.h9
-rw-r--r--src/sbus/sssd_dbus_interface.c18
3 files changed, 29 insertions, 18 deletions
diff --git a/src/responder/ifp/ifp_iface.c b/src/responder/ifp/ifp_iface.c
index 86d8d338c..d062e6c8f 100644
--- a/src/responder/ifp/ifp_iface.c
+++ b/src/responder/ifp/ifp_iface.c
@@ -141,12 +141,7 @@ struct iface_ifp_cache_object iface_ifp_cache_object_group = {
.Remove = ifp_cache_object_remove_group
};
-struct iface_map {
- const char *path;
- struct sbus_vtable *vtable;
-};
-
-static struct iface_map iface_map[] = {
+static struct sbus_iface_map iface_map[] = {
{ IFP_PATH, &iface_ifp.vtable },
{ IFP_PATH_DOMAINS_TREE, &iface_ifp_domains.vtable },
{ IFP_PATH_COMPONENTS_TREE, &iface_ifp_components.vtable },
@@ -163,16 +158,5 @@ static struct iface_map iface_map[] = {
errno_t ifp_register_sbus_interface(struct sbus_connection *conn, void *pvt)
{
- errno_t ret;
- int i;
-
- for (i = 0; iface_map[i].path != NULL; i++) {
- ret = sbus_conn_register_iface(conn, iface_map[i].vtable,
- iface_map[i].path, pvt);
- if (ret != EOK) {
- return ret;
- }
- }
-
- return EOK;
+ return sbus_conn_register_iface_map(conn, iface_map, pvt);
}
diff --git a/src/sbus/sssd_dbus.h b/src/sbus/sssd_dbus.h
index c1e27746e..2fc8e36d8 100644
--- a/src/sbus/sssd_dbus.h
+++ b/src/sbus/sssd_dbus.h
@@ -181,6 +181,15 @@ int sbus_conn_register_iface(struct sbus_connection *conn,
const char *object_path,
void *handler_data);
+struct sbus_iface_map {
+ const char *path;
+ struct sbus_vtable *vtable;
+};
+
+errno_t sbus_conn_register_iface_map(struct sbus_connection *conn,
+ struct sbus_iface_map *map,
+ void *pvt);
+
void
sbus_conn_register_nodes(struct sbus_connection *conn,
const char *path,
diff --git a/src/sbus/sssd_dbus_interface.c b/src/sbus/sssd_dbus_interface.c
index f8046c7c1..e96e29b79 100644
--- a/src/sbus/sssd_dbus_interface.c
+++ b/src/sbus/sssd_dbus_interface.c
@@ -970,6 +970,24 @@ sbus_conn_register_iface(struct sbus_connection *conn,
return ret;
}
+errno_t
+sbus_conn_register_iface_map(struct sbus_connection *conn,
+ struct sbus_iface_map *map,
+ void *pvt)
+{
+ errno_t ret;
+ int i;
+
+ for (i = 0; map[i].path != NULL; i++) {
+ ret = sbus_conn_register_iface(conn, map[i].vtable, map[i].path, pvt);
+ if (ret != EOK) {
+ return ret;
+ }
+ }
+
+ return EOK;
+}
+
void
sbus_conn_register_nodes(struct sbus_connection *conn,
const char *path,