[2/5] fd passing: include fd list in gdbus open function 52/160852/1
authorSegwon <segwon.han@samsung.com>
Mon, 20 Nov 2017 08:39:44 +0000 (17:39 +0900)
committerSegwon <segwon.han@samsung.com>
Mon, 20 Nov 2017 08:39:44 +0000 (17:39 +0900)
Change-Id: I6a5b6c42940f4dd903bd0479fe1ed287923c5348
Signed-off-by: Segwon <segwon.han@samsung.com>
src/daemon/include/peripheral_bus_gdbus_gpio.h
src/daemon/include/peripheral_bus_gdbus_i2c.h
src/daemon/include/peripheral_bus_gdbus_pwm.h
src/daemon/include/peripheral_bus_gdbus_spi.h
src/daemon/include/peripheral_bus_gdbus_uart.h
src/daemon/peripheral_bus_gdbus_gpio.c
src/daemon/peripheral_bus_gdbus_i2c.c
src/daemon/peripheral_bus_gdbus_pwm.c
src/daemon/peripheral_bus_gdbus_spi.c
src/daemon/peripheral_bus_gdbus_uart.c
src/daemon/peripheral_io.xml

index 4eb59df..6036c99 100644 (file)
@@ -22,6 +22,7 @@
 gboolean handle_gpio_open(
                PeripheralIoGdbusGpio *gpio,
                GDBusMethodInvocation *invocation,
+               GUnixFDList *fd_list,
                gint pin,
                gpointer user_data);
 
index 9a40a9b..b098b04 100644 (file)
@@ -22,6 +22,7 @@
 gboolean handle_i2c_open(
                PeripheralIoGdbusI2c *i2c,
                GDBusMethodInvocation *invocation,
+               GUnixFDList *fd_list,
                gint bus,
                gint address,
                gpointer user_data);
index 1694123..650e7d6 100644 (file)
@@ -22,6 +22,7 @@
 gboolean handle_pwm_open(
                PeripheralIoGdbusPwm *pwm,
                GDBusMethodInvocation *invocation,
+               GUnixFDList *fd_list,
                gint chip,
                gint pin,
                gpointer user_data);
index 54a02e5..199e632 100644 (file)
@@ -22,6 +22,7 @@
 gboolean handle_spi_open(
                PeripheralIoGdbusSpi *spi,
                GDBusMethodInvocation *invocation,
+               GUnixFDList *fd_list,
                gint bus,
                gint cs,
                gpointer user_data);
index 639caa0..7cfbfa0 100644 (file)
@@ -22,6 +22,7 @@
 gboolean handle_uart_open(
                PeripheralIoGdbusUart *uart,
                GDBusMethodInvocation *invocation,
+               GUnixFDList *fd_list,
                gint port,
                gpointer user_data);
 
index baf6f56..778f2c6 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 #include <peripheral_io.h>
+#include <gio/gunixfdlist.h>
 
 #include "peripheral_io_gdbus.h"
 #include "peripheral_bus.h"
@@ -37,6 +38,7 @@ static void __gpio_on_name_vanished(GDBusConnection *connection,
 gboolean handle_gpio_open(
                PeripheralIoGdbusGpio *gpio,
                GDBusMethodInvocation *invocation,
+               GUnixFDList *fd_list,
                gint pin,
                gpointer user_data)
 {
@@ -44,6 +46,8 @@ gboolean handle_gpio_open(
        peripheral_bus_s *pb_data = (peripheral_bus_s*)user_data;
        pb_data_h gpio_handle = NULL;
 
+       GUnixFDList *gpio_fd_list = NULL;
+
        if ((ret = peripheral_bus_gpio_open(pin, &gpio_handle, user_data)) < PERIPHERAL_ERROR_NONE)
                goto out;
 
@@ -63,7 +67,7 @@ gboolean handle_gpio_open(
        _D("gpio : %d, id = %s", gpio_handle->dev.gpio.pin, gpio_handle->client_info.id);
 
 out:
-       peripheral_io_gdbus_gpio_complete_open(gpio, invocation, GPOINTER_TO_UINT(gpio_handle), ret);
+       peripheral_io_gdbus_gpio_complete_open(gpio, invocation, gpio_fd_list, GPOINTER_TO_UINT(gpio_handle), ret);
 
        return true;
 }
\ No newline at end of file
index e162031..8b21ac3 100644 (file)
@@ -37,6 +37,7 @@ static void __i2c_on_name_vanished(GDBusConnection *connection,
 gboolean handle_i2c_open(
                PeripheralIoGdbusI2c *i2c,
                GDBusMethodInvocation *invocation,
+               GUnixFDList *fd_list,
                gint bus,
                gint address,
                gpointer user_data)
@@ -45,6 +46,8 @@ gboolean handle_i2c_open(
        peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
        pb_data_h i2c_handle = NULL;
 
+       GUnixFDList *i2c_fd_list = NULL;
+
        if ((ret = peripheral_bus_i2c_open(bus, address, &i2c_handle, user_data)) < PERIPHERAL_ERROR_NONE)
                goto out;
 
@@ -65,7 +68,7 @@ gboolean handle_i2c_open(
        _D("bus : %d, address : 0x%x, id = %s", bus, address, i2c_handle->client_info.id);
 
 out:
-       peripheral_io_gdbus_i2c_complete_open(i2c, invocation, GPOINTER_TO_UINT(i2c_handle), ret);
+       peripheral_io_gdbus_i2c_complete_open(i2c, invocation, i2c_fd_list, GPOINTER_TO_UINT(i2c_handle), ret);
 
        return true;
 }
index 21518c2..f4ad8e2 100644 (file)
@@ -37,6 +37,7 @@ static void __pwm_on_name_vanished(GDBusConnection *connection,
 gboolean handle_pwm_open(
                PeripheralIoGdbusPwm *pwm,
                GDBusMethodInvocation *invocation,
+               GUnixFDList *fd_list,
                gint chip,
                gint pin,
                gpointer user_data)
@@ -45,6 +46,8 @@ gboolean handle_pwm_open(
        peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
        pb_data_h pwm_handle = NULL;
 
+       GUnixFDList *pwm_fd_list = NULL;
+
        if ((ret = peripheral_bus_pwm_open(chip, pin, &pwm_handle, user_data)) <  PERIPHERAL_ERROR_NONE)
                goto out;
 
@@ -65,7 +68,7 @@ gboolean handle_pwm_open(
        _D("chip : %d, pin : %d, id = %s", chip, pin, pwm_handle->client_info.id);
 
 out:
-       peripheral_io_gdbus_pwm_complete_open(pwm, invocation, GPOINTER_TO_UINT(pwm_handle), ret);
+       peripheral_io_gdbus_pwm_complete_open(pwm, invocation, pwm_fd_list, GPOINTER_TO_UINT(pwm_handle), ret);
 
        return true;
 }
index 2246996..d85870e 100644 (file)
@@ -37,6 +37,7 @@ static void __spi_on_name_vanished(GDBusConnection *connection,
 gboolean handle_spi_open(
                PeripheralIoGdbusSpi *spi,
                GDBusMethodInvocation *invocation,
+               GUnixFDList *fd_list,
                gint bus,
                gint cs,
                gpointer user_data)
@@ -45,6 +46,8 @@ gboolean handle_spi_open(
        peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
        pb_data_h spi_handle = NULL;
 
+       GUnixFDList *spi_fd_list = NULL;
+
        if ((ret = peripheral_bus_spi_open(bus, cs, &spi_handle, user_data)) < PERIPHERAL_ERROR_NONE)
                goto out;
 
@@ -65,7 +68,8 @@ gboolean handle_spi_open(
        _D("bus : %d, cs : %d, id = %s", bus, cs, spi_handle->client_info.id);
 
 out:
-       peripheral_io_gdbus_spi_complete_open(spi, invocation, GPOINTER_TO_UINT(spi_handle), ret);
+       peripheral_io_gdbus_spi_complete_open(spi, invocation, spi_fd_list, GPOINTER_TO_UINT(spi_handle), ret);
 
        return true;
 }
+
index e2ba4a0..f05d02f 100644 (file)
@@ -37,6 +37,7 @@ static void __uart_on_name_vanished(GDBusConnection *connection,
 gboolean handle_uart_open(
                PeripheralIoGdbusUart *uart,
                GDBusMethodInvocation *invocation,
+               GUnixFDList *fd_list,
                gint port,
                gpointer user_data)
 {
@@ -44,6 +45,8 @@ gboolean handle_uart_open(
        peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
        pb_data_h uart_handle = NULL;
 
+       GUnixFDList *uart_fd_list = NULL;
+
        if ((ret = peripheral_bus_uart_open(port, &uart_handle, user_data)) < PERIPHERAL_ERROR_NONE)
                goto out;
 
@@ -64,7 +67,7 @@ gboolean handle_uart_open(
        _D("port : %d, id = %s", port, uart_handle->client_info.id);
 
 out:
-       peripheral_io_gdbus_uart_complete_open(uart, invocation, GPOINTER_TO_UINT(uart_handle), ret);
+       peripheral_io_gdbus_uart_complete_open(uart, invocation, uart_fd_list, GPOINTER_TO_UINT(uart_handle), ret);
 
        return true;
 }
index 5f3aa84..6b987a3 100644 (file)
@@ -2,6 +2,7 @@
 <node>
        <interface name="org.tizen.peripheral_io.gpio">
                <method name="Open">
+                       <annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
                        <arg type="i" name="pin" direction="in"/>
                        <arg type="u" name="handle" direction="out"/>
                        <arg type="i" name="result" direction="out"/>
@@ -9,6 +10,7 @@
        </interface>
        <interface name="org.tizen.peripheral_io.i2c">
                <method name="Open">
+                       <annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
                        <arg type="i" name="bus" direction="in"/>
                        <arg type="i" name="address" direction="in"/>
                        <arg type="u" name="handle" direction="out"/>
@@ -17,6 +19,7 @@
        </interface>
        <interface name="org.tizen.peripheral_io.pwm">
                <method name="Open">
+                       <annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
                        <arg type="i" name="chip" direction="in"/>
                        <arg type="i" name="pin" direction="in"/>
                        <arg type="u" name="handle" direction="out"/>
@@ -25,6 +28,7 @@
        </interface>
        <interface name="org.tizen.peripheral_io.uart">
                <method name="Open">
+                       <annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
                        <arg type="i" name="port" direction="in"/>
                        <arg type="u" name="handle" direction="out"/>
                        <arg type="i" name="result" direction="out"/>
@@ -32,6 +36,7 @@
        </interface>
        <interface name="org.tizen.peripheral_io.spi">
                <method name="Open">
+                       <annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
                        <arg type="i" name="bus" direction="in"/>
                        <arg type="i" name="cs" direction="in"/>
                        <arg type="u" name="handle" direction="out"/>