Fix python install
[archipelago] / xseg / drivers / user / xseg_segdev.c
index ac8ee10..6739ab2 100644 (file)
@@ -1,3 +1,37 @@
+/*
+ * Copyright 2012 GRNET S.A. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer.
+ *   2. Redistributions in binary form must reproduce the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer in the documentation and/or other materials
+ *      provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and
+ * documentation are those of the authors and should not be
+ * interpreted as representing official policies, either expressed
+ * or implied, of GRNET S.A.
+ */
+
 #define _GNU_SOURCE
 #include <stdio.h>
 #include <stdlib.h>
@@ -14,6 +48,7 @@
 #include <xseg/xseg.h>
 #include <sys/util.h>
 #include <sys/kernel/segdev.h>
+#include <drivers/xseg_segdev.h>
 
 #define ERRSIZE 512
 static char errbuf[ERRSIZE];
@@ -148,12 +183,12 @@ static struct xseg_type xseg_segdev = {
        "segdev"
 };
 
-static int segdev_local_signal_init(void)
+static int segdev_local_signal_init(struct xseg *xseg, xport portno)
 {
        return -1;
 }
 
-static void segdev_local_signal_quit(void)
+static void segdev_local_signal_quit(struct xseg *xseg, xport portno)
 {
        return;
 }
@@ -188,9 +223,13 @@ static int segdev_signal(struct xseg *xseg, uint32_t portno)
        struct xseg_port *port = xseg_get_port(xseg, portno);
        if (!port)
                return -1;
+       struct segdev_signal_desc *ssd = xseg_get_signal_desc(xseg, port);
+       if (!ssd)
+               return -1;
 
-       if (!port->waitcue)
+       if (!ssd->waitcue){
                return 0;
+       }
        else
                return write(opendev(), &portno, sizeof(portno));
 }
@@ -207,9 +246,45 @@ static void *segdev_realloc(void *mem, uint64_t size)
 
 static void segdev_mfree(void *mem) { }
 
+static int segdev_init_signal_desc(struct xseg *xseg, void *sd)
+{
+       return -1;
+}
+
+static void segdev_quit_signal_desc(struct xseg *xseg, void *sd)
+{
+       return;
+}
+
+static void *segdev_alloc_data(struct xseg *xseg)
+{
+       return NULL;
+}
+
+static void segdev_free_data(struct xseg *xseg, void *data)
+{
+       return;
+}
+
+static void *segdev_alloc_signal_desc(struct xseg *xseg, void *data)
+{
+       return NULL;
+}
+
+static void segdev_free_signal_desc(struct xseg *xseg, void *data, void *sd)
+{
+       return;
+}
+
 static struct xseg_peer xseg_peer_segdev = {
        /* xseg signal operations */
        {
+               .init_signal_desc   = segdev_init_signal_desc,
+               .quit_signal_desc   = segdev_quit_signal_desc,
+               .alloc_data         = segdev_alloc_data,
+               .free_data          = segdev_free_data,
+               .alloc_signal_desc  = segdev_alloc_signal_desc,
+               .free_signal_desc   = segdev_free_signal_desc,
                .local_signal_init  = segdev_local_signal_init,
                .local_signal_quit  = segdev_local_signal_quit,
                .remote_signal_init = segdev_remote_signal_init,