vgaarb: make it compile.
authorTiago Vignatti <vignatti@freedesktop.org>
Wed, 13 May 2009 20:55:31 +0000 (17:55 -0300)
committerTiago Vignatti <vignatti@freedesktop.org>
Wed, 13 May 2009 20:55:31 +0000 (17:55 -0300)
src/Makefile.am
src/common_vgaarb.c
src/common_vgaarb_stub.c [new file with mode: 0644]

index 14f2e48..0de6894 100644 (file)
@@ -45,6 +45,12 @@ if SOLARIS
 OS_SUPPORT = solx_devfs.c pci_tools.h
 endif
 
+if LINUX
+VGA_ARBITER = common_vgaarb.c
+else
+VGA_ARBITER = common_vgaarb_stub.c
+endif
+
 libpciaccess_la_SOURCES = common_bridge.c \
        common_iterator.c \
        common_init.c \
@@ -53,6 +59,7 @@ libpciaccess_la_SOURCES = common_bridge.c \
        common_device_name.c \
        common_map.c \
        pciaccess_private.h \
+       $(VGA_ARBITER) \
        $(OS_SUPPORT)
 
 INCLUDES = -I$(top_srcdir)/include
index 729998d..df259d5 100644 (file)
@@ -24,8 +24,6 @@
  *
  */
 
-/* vgaaccess.c */
-
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -39,7 +37,7 @@
 #include <fcntl.h>
 #include <errno.h>
 
-#include "vgaaccess.h"
+#include "pciaccess.h"
 
 /* ALL messages *should* fit in this buffer */
 #define BUFSIZE 128
@@ -101,7 +99,6 @@ rsrc_to_str(VgaArbRsrcType iostate)
         return "none";
 }
 
-#ifndef STUB
 int
 vga_arb_read(vga_arb_ptr vgaDev)
 {
@@ -220,54 +217,3 @@ vga_arb_fini(vga_arb_ptr vgaDev)
     if (close(vgaDev->fd) == -1)
     perror("[libvgaaccess] device close failed");
 }
-
-#else /* STUB */
-int
-vga_arb_read(vga_arb_ptr vgaDev)
-{
-    return 1;
-}
-
-int
-vga_arb_set_target(vga_arb_ptr vgaDev, unsigned int domain, unsigned int bus,
-                   unsigned int dev,    unsigned int fn)
-{
-    return 1;
-}
-
-int
-vga_arb_lock(vga_arb_ptr vgaDev)
-{
-    return 1;
-}
-
-int
-vga_arb_trylock(vga_arb_ptr vgaDev)
-{
-    return 1;
-}
-
-int
-vga_arb_unlock(vga_arb_ptr vgaDev)
-{
-    return 1;
-}
-
-int
-vga_arb_decodes(vga_arb_ptr vgaDev)
-{
-    return 1;
-}
-
-int
-vga_arb_init(vga_arb_ptr *vgaDev)
-{
-    fprintf(stderr, "[libvgaaccess] YOU'RE USING THE STUB FUNCTIONS!\n");
-    return 1;
-}
-
-void
-vga_arb_fini(vga_arb_ptr vgaDev)
-{
-}
-#endif /* END OF STUB */
diff --git a/src/common_vgaarb_stub.c b/src/common_vgaarb_stub.c
new file mode 100644 (file)
index 0000000..9fa36ac
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2007 Paulo R. Zanoni, Tiago Vignatti
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include "pciaccess.h"
+
+
+int
+vga_arb_read(vga_arb_ptr vgaDev)
+{
+    return 1;
+}
+
+int
+vga_arb_set_target(vga_arb_ptr vgaDev, unsigned int domain, unsigned int bus,
+                   unsigned int dev,    unsigned int fn)
+{
+    return 1;
+}
+
+int
+vga_arb_lock(vga_arb_ptr vgaDev)
+{
+    return 1;
+}
+
+int
+vga_arb_trylock(vga_arb_ptr vgaDev)
+{
+    return 1;
+}
+
+int
+vga_arb_unlock(vga_arb_ptr vgaDev)
+{
+    return 1;
+}
+
+int
+vga_arb_decodes(vga_arb_ptr vgaDev)
+{
+    return 1;
+}
+
+int
+vga_arb_init(vga_arb_ptr *vgaDev)
+{
+#ifdef DEBUG
+    fprintf(stderr, "%s: YOU'RE USING THE STUB FUNCTIONS!\n", __FUNCTION__);
+#endif
+    return 1;
+}
+
+void
+vga_arb_fini(vga_arb_ptr vgaDev)
+{
+}