tizen 2.4 release accepted/tizen_2.4_mobile tizen_2.4 accepted/tizen/2.4/mobile/20151029.041933 submit/tizen_2.4/20151028.062444 tizen_2.4_mobile_release
authorjk7744.park <jk7744.park@samsung.com>
Sat, 24 Oct 2015 06:31:11 +0000 (15:31 +0900)
committerjk7744.park <jk7744.park@samsung.com>
Sat, 24 Oct 2015 06:31:11 +0000 (15:31 +0900)
14 files changed:
COPYING [new file with mode: 0644]
ChangeLog [new file with mode: 0644]
Makefile.am [new file with mode: 0644]
autogen.sh [new file with mode: 0755]
configure.ac [new file with mode: 0644]
packaging/xorg-x11-module-lazyload.spec [new file with mode: 0644]
src/Makefile.am [new file with mode: 0644]
src/module_lazyload.c [new file with mode: 0755]
src/module_lazyload_dbus.c [new file with mode: 0644]
src/module_lazyload_dbus.h [new file with mode: 0644]
src/module_lazyload_main.c [new file with mode: 0755]
src/module_lazyload_main.h [new file with mode: 0755]
src/module_lazyload_options.c [new file with mode: 0755]
src/module_lazyload_options.h [new file with mode: 0755]

diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..8f6ba4b
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,21 @@
+Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+
+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 fur-
+nished 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, FIT-
+NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
+NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+
diff --git a/ChangeLog b/ChangeLog
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..d40e868
--- /dev/null
@@ -0,0 +1,21 @@
+#  Copyright 2014 Sung-Jin Park
+#  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
+#  on the rights to use, copy, modify, merge, publish, distribute, sub
+#  license, 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 (including the next
+#  paragraph) 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 NON-INFRINGEMENT.  IN NO EVENT SHALL
+#  ADAM JACKSON 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.
+
+AUTOMAKE_OPTIONS = foreign
+SUBDIRS = src
diff --git a/autogen.sh b/autogen.sh
new file mode 100755 (executable)
index 0000000..218197d
--- /dev/null
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd $srcdir
+
+autoreconf -v --install || exit 1
+cd $ORIGDIR || exit $?
+
+#$srcdir/configure --enable-maintainer-mode "$@"
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..f12eede
--- /dev/null
@@ -0,0 +1,52 @@
+
+AC_PREREQ(2.57)
+AC_INIT([xserver-xorg-module-lazyload],
+        0.1.0,
+        [https://],
+        xserver-xorg-module-lazyload)
+
+AC_CONFIG_SRCDIR([Makefile.am])
+AC_CONFIG_AUX_DIR(.)
+AM_INIT_AUTOMAKE([dist-bzip2])
+
+AM_MAINTAINER_MODE
+
+# Require xorg-macros: XORG_DEFAULT_OPTIONS
+m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.3 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.3)
+AM_CONFIG_HEADER([config.h])
+
+# Checks for programs.
+AC_DISABLE_STATIC
+AC_PROG_LIBTOOL
+AC_PROG_CC
+XORG_DEFAULT_OPTIONS
+
+AH_TOP([#include "xorg-server.h"])
+
+AC_ARG_WITH(xorg-module-dir,
+            AC_HELP_STRING([--with-xorg-module-dir=DIR],
+                           [Default xorg module directory [[default=$libdir/xorg/modules]]]),
+                           [moduledir="$withval"],
+                           [moduledir="$libdir/xorg/modules"])
+
+# Checks for pkg-config packages
+PKG_CHECK_MODULES(XORG, xorg-server xproto resourceproto xdbg glib-2.0 dbus-1 dbus-glib-1 $REQUIRED_MODULES)
+
+MODULE_CFALGS="$XORG_CFLAGS"
+MODULE_LIBS="$XORG_LIBS"
+
+# Checks for header files.
+AC_HEADER_STDC
+
+AC_SUBST([MODULE_CFLAGS])
+AC_SUBST([MODULE_LIBS])
+
+MODULE_NAME=lazyload
+AC_SUBST([MODULE_NAME])
+AC_SUBST([moduledir])
+
+AC_DEFINE_UNQUOTED(MODULE_NAME, "$MODULE_NAME", [module name])
+
+AC_OUTPUT([Makefile
+           src/Makefile])
diff --git a/packaging/xorg-x11-module-lazyload.spec b/packaging/xorg-x11-module-lazyload.spec
new file mode 100644 (file)
index 0000000..8dcc0ee
--- /dev/null
@@ -0,0 +1,41 @@
+Name:  xorg-x11-module-lazyload
+Summary:    X.Org X server -- Xserver lazyload module
+Version: 0.1.9.tv.4
+Release:    1
+Group:      System/X Hardware Support
+License:    MIT
+Source0:    %{name}-%{version}.tar.gz
+BuildRequires:  pkgconfig(xorg-server)
+BuildRequires:  pkgconfig(xproto)
+BuildRequires:  pkgconfig(resourceproto)
+BuildRequires:  pkgconfig(xorg-macros)
+BuildRequires:  pkgconfig(xdbg)
+BuildRequires: pkgconfig(dbus-glib-1)
+
+%description
+ This package provides the module for lazyload of X server.
+
+%prep
+%setup -q
+
+%build
+
+%autogen
+%configure --disable-static \
+           --prefix=/usr \
+           CFLAGS="$CFLAGS -Wall -Werror" \
+           LDFLAGS="$LDFLAGS -Wl,--hash-style=both -Wl,--as-needed"
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+mkdir -p %{buildroot}/usr/share/license
+cp -af COPYING %{buildroot}/usr/share/license/%{name}
+%make_install
+
+%remove_docs
+
+%files
+%{_libdir}/xorg/modules/liblazyload.so
+/usr/share/license/%{name}
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644 (file)
index 0000000..c691779
--- /dev/null
@@ -0,0 +1,37 @@
+#  Copyright 2005 Adam Jackson.
+#
+#  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
+#  on the rights to use, copy, modify, merge, publish, distribute, sub
+#  license, 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 (including the next
+#  paragraph) 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 NON-INFRINGEMENT.  IN NO EVENT SHALL
+#  ADAM JACKSON 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.
+
+
+# this is obnoxious:
+# -module lets us name the module exactly how we want
+# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
+# _ladir passes a dummy rpath to libtool so the thing will actually link
+# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
+AM_CFLAGS = @XORG_CFLAGS@ @MODULE_CFLAGS@
+
+lib@MODULE_NAME@_la_LTLIBRARIES = lib@MODULE_NAME@.la
+lib@MODULE_NAME@_la_LDFLAGS = -module -avoid-version
+lib@MODULE_NAME@_la_LIBADD = @MODULE_LIBS@
+lib@MODULE_NAME@_ladir = @moduledir@
+
+lib@MODULE_NAME@_la_SOURCES = module_@MODULE_NAME@.c \
+                              module_@MODULE_NAME@_main.c \
+                              module_@MODULE_NAME@_options.c \
+                              module_@MODULE_NAME@_dbus.c 
diff --git a/src/module_lazyload.c b/src/module_lazyload.c
new file mode 100755 (executable)
index 0000000..b0c5956
--- /dev/null
@@ -0,0 +1,128 @@
+/**************************************************************************
+
+xserver-xorg-module-lazyload
+
+Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Sung-Jin Park <sj76.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+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, sub license, 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 (including the
+next paragraph) 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 NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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 <sys/types.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <xf86.h>
+
+#include "module_lazyload_main.h"
+#include "module_lazyload_options.h"
+
+MODULESETUPPROTO (moduleSetup);
+MODULETEARDOWNPROTO (moduleTearDown);
+
+static XF86ModuleVersionInfo ModuleVersRec =
+{
+    MODULE_NAME,
+    MODULEVENDORSTRING,
+    MODINFOSTRING1,
+    MODINFOSTRING2,
+    XORG_VERSION_CURRENT,
+    PACKAGE_VERSION_MAJOR,
+    PACKAGE_VERSION_MINOR,
+    PACKAGE_VERSION_PATCHLEVEL,
+    ABI_CLASS_NONE,
+    SET_ABI_VERSION (0,1),
+    NULL,
+    {0,0,0,0}
+};
+
+_X_EXPORT XF86ModuleData lazyloadModuleData =
+{
+    &ModuleVersRec,
+    moduleSetup,
+    moduleTearDown
+};
+
+static ModuleLazyload module_lazyload;
+
+static void
+_moduleLazyloadBlockHandler (pointer data, OSTimePtr pTimeout, pointer pRead)
+{
+    /* _moduleLazyloadBlockHandler called only at the first. */
+    RemoveBlockAndWakeupHandlers(_moduleLazyloadBlockHandler,
+                                 (WakeupHandlerProcPtr)NoopDDA,
+                                 data);
+
+    /* main */
+    moduleLazyloadMain (&module_lazyload, data);
+}
+
+pointer
+moduleSetup (pointer module, pointer opts, int *errmaj, int *errmin)
+{
+    XF86OptionPtr pOpt = (XF86OptionPtr)opts;
+    static Bool setupDone = FALSE;
+
+    if (!setupDone)
+    {
+        setupDone = TRUE;
+
+        //XDBG_KLOG (MX11, "Setup:Xorg server pid : %d \n", p);
+
+        /* Parse Options */
+        moduleLazyloadParseOptions (&module_lazyload, pOpt);
+
+        /* Register block handler */
+        RegisterBlockAndWakeupHandlers (_moduleLazyloadBlockHandler,
+                                        (WakeupHandlerProcPtr)NoopDDA,
+                                        opts);
+
+        return (pointer) 1;
+    }
+    else
+    {
+        if (errmaj)
+            *errmaj = LDR_ONCEONLY;
+
+        return NULL;
+    }
+}
+
+void
+moduleTearDown (pointer module)
+{
+    //XDBG_KLOG (MX11, "TearDown:Xorg server pid : %d \n", p);
+
+    moduleLazyloadMainExit (&module_lazyload);
+
+    RemoveBlockAndWakeupHandlers (_moduleLazyloadBlockHandler,
+                                  (WakeupHandlerProcPtr)NoopDDA,
+                                  NULL);
+}
+
diff --git a/src/module_lazyload_dbus.c b/src/module_lazyload_dbus.c
new file mode 100644 (file)
index 0000000..c2aa765
--- /dev/null
@@ -0,0 +1,456 @@
+/**************************************************************************
+
+xserver-xorg-module-lazyload
+
+Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Sung-Jin Park <sj76.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+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, sub license, 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 (including the
+next paragraph) 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 NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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 <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <dbus/dbus.h>
+#include <os.h>
+#include <dix.h>
+
+#include <xdbg.h>
+#include "module_lazyload_main.h"
+#include "module_lazyload_dbus.h"
+
+#define ARGV_NUM        128
+#define REP_MSG_SIZE    8192
+#define STR_LEN         128
+
+#define RECONNECT_TIME  500
+#define DISPATCH_TIME   50
+
+typedef struct _ModuleLazyloadDbusInfo
+{
+    OsTimerPtr timer;
+    DBusConnection *conn;
+    ModuleLazyloadDbusMethod *methods;
+    char rule[STR_LEN];
+    int fd;
+} ModuleLazyloadDbusInfo;
+
+static ModuleLazyloadDbusInfo server_info;
+
+static CARD32 _moduleLazyloadDbusTimeout (OsTimerPtr timer, CARD32 time, pointer arg);
+static Bool _moduleLazyloadDbusInit (ModuleLazyloadDbusInfo *info);
+static void _moduleLazyloadDbusDeinit (ModuleLazyloadDbusInfo *info);
+
+static Bool
+_moduleLazyloadDbusReplyMessage (ModuleLazyloadDbusInfo *info, DBusMessage *msg, char *reply)
+{
+    DBusMessage *reply_msg = NULL;
+    DBusMessageIter iter;
+
+    XDBG_RETURN_VAL_IF_FAIL (info->conn != NULL, FALSE);
+
+    reply_msg = dbus_message_new_method_return (msg);
+    XDBG_RETURN_VAL_IF_FAIL (reply_msg != NULL, FALSE);
+
+    dbus_message_iter_init_append (reply_msg, &iter);
+    if (!dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &reply))
+    {
+        XDBG_ERROR (MLAZY, "[SERVER] out of memory\n");
+        dbus_message_unref (reply_msg);
+        return FALSE;
+    }
+
+    if (!dbus_connection_send (info->conn, reply_msg, NULL))
+    {
+        XDBG_ERROR (MLAZY, "[SERVER] failed: send reply\n");
+        dbus_message_unref (reply_msg);
+        return FALSE;
+    }
+
+    XDBG_DEBUG (MLAZY, "[SERVER] send reply\n");
+
+    dbus_connection_flush (info->conn);
+    dbus_message_unref (reply_msg);
+
+    return TRUE;
+}
+
+static void
+_moduleLazyloadDbusProcessMessage (ModuleLazyloadDbusInfo *info, DBusMessage *msg)
+{
+    ModuleLazyloadDbusMethod **prev;
+    DBusError err;
+    char err_buf[REP_MSG_SIZE] = {0,};
+    char *argv[ARGV_NUM] = {0,};
+    int argc = 0;
+    int i;
+
+    snprintf (err_buf, REP_MSG_SIZE, "error message!\n");
+
+    dbus_error_init (&err);
+
+    XDBG_DEBUG (MLAZY, "[SERVER] Process a message (%s.%s)\n",
+               dbus_message_get_interface (msg), dbus_message_get_member (msg));
+
+    XDBG_RETURN_IF_FAIL (info->conn != NULL);
+
+    for (prev = &info->methods; *prev; prev = &(*prev)->next)
+    {
+        ModuleLazyloadDbusMethod *method = *prev;
+
+        if (!strcmp (dbus_message_get_member (msg), method->name))
+        {
+            DBusMessageIter iter;
+            char reply[REP_MSG_SIZE] = {0,};
+            char *p;
+            int   len;
+
+            if (!dbus_message_iter_init (msg, &iter))
+            {
+                XDBG_ERROR (MLAZY, "[SERVER] Message has no arguments!\n");
+                snprintf (err_buf, REP_MSG_SIZE, "Message has no arguments!\n");
+                goto send_fail;
+            }
+
+            do
+            {
+                p = NULL;
+
+                if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_STRING)
+                {
+                    XDBG_ERROR (MLAZY, "[SERVER] Argument is not string!\n");
+                    snprintf (err_buf, REP_MSG_SIZE, "Argument is not string!\n");
+                    goto send_fail;
+                }
+
+                dbus_message_iter_get_basic (&iter, &p);
+
+                if (!p)
+                {
+                    XDBG_ERROR (MLAZY, "[SERVER] Can't get string!\n");
+                    snprintf (err_buf, REP_MSG_SIZE, "Can't get string!\n");
+                    goto send_fail;
+                }
+
+                argv[argc] = strdup (p);
+                argc++;
+            } while (dbus_message_iter_has_next (&iter) &&
+                   dbus_message_iter_next (&iter) &&
+                   argc < ARGV_NUM);
+
+            len = REP_MSG_SIZE - 1;
+
+            if (method->func)
+                method->func (method->data, argc, argv, reply, &len);
+
+            _moduleLazyloadDbusReplyMessage (info, msg, reply);
+
+            for (i = 0; i < ARGV_NUM; i++)
+                if (argv[i])
+                    free (argv[i]);
+            dbus_error_free (&err);
+
+            return;
+        }
+    }
+
+    return;
+
+send_fail:
+   _moduleLazyloadDbusReplyMessage (info, msg, err_buf);
+
+    for (i = 0; i < ARGV_NUM; i++)
+        if (argv[i])
+            free (argv[i]);
+    dbus_error_free (&err);
+}
+
+static void
+_moduleLazyloadDbusWakeupHandler (pointer data, int error, pointer pRead)
+{
+    ModuleLazyloadDbusInfo *info = (ModuleLazyloadDbusInfo*)data;
+
+    if (!info || !info->conn || info->fd < 0)
+        return;
+
+    if (FD_ISSET(info->fd, (fd_set*)pRead))
+    {
+        do {
+            dbus_connection_read_write_dispatch (info->conn, 0);
+        } while (info->conn &&
+                 dbus_connection_get_is_connected (info->conn) &&
+                 dbus_connection_get_dispatch_status (info->conn) ==
+                 DBUS_DISPATCH_DATA_REMAINS);
+
+        /* DON'T use info->conn from here. info->conn becomes NULL by
+         * dbus_connection_read_write_dispatch(_moduleLazyloadDbusMsgFilter)
+         */
+    }
+}
+
+static DBusHandlerResult
+_moduleLazyloadDbusMsgHandler (DBusConnection *connection, DBusMessage *msg, void *data)
+{
+    ModuleLazyloadDbusInfo *info = (ModuleLazyloadDbusInfo*)data;
+
+    if (!info || !info->conn || !msg)
+        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+    XDBG_DEBUG (MLAZY, "[SERVER] Got a message (%s.%s)\n",
+               dbus_message_get_interface (msg), dbus_message_get_member (msg));
+
+    if (!dbus_message_is_method_call (msg, LAZYLOAD_DBUS_INTERFACE, LAZYLOAD_DBUS_METHOD))
+        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+    _moduleLazyloadDbusProcessMessage (info, msg);
+
+    return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+static DBusHandlerResult
+_moduleLazyloadDbusMsgFilter (DBusConnection *conn, DBusMessage *msg, void *data)
+{
+    ModuleLazyloadDbusInfo *info = (ModuleLazyloadDbusInfo*)data;
+
+    if (!info)
+        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+    if (dbus_message_is_signal (msg, DBUS_INTERFACE_LOCAL, "Disconnected"))
+    {
+        XDBG_DEBUG (MLAZY, "[SERVER] disconnected by signal\n");
+        _moduleLazyloadDbusDeinit (info);
+
+        if (info->timer)
+            TimerFree(info->timer);
+        info->timer = TimerSet(NULL, 0, 1, _moduleLazyloadDbusTimeout, info);
+
+        return DBUS_HANDLER_RESULT_HANDLED;
+    }
+
+    return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+static CARD32
+_moduleLazyloadDbusTimeout (OsTimerPtr timer, CARD32 time, pointer arg)
+{
+    ModuleLazyloadDbusInfo *info = (ModuleLazyloadDbusInfo*)arg;
+
+    if (!info)
+        return 0;
+
+    XDBG_DEBUG (MLAZY, "[SERVER] timeout\n");
+
+    if (_moduleLazyloadDbusInit (info))
+    {
+        TimerFree (info->timer);
+        info->timer = NULL;
+        return 0;
+    }
+
+    return RECONNECT_TIME;
+}
+
+static Bool
+_moduleLazyloadDbusInit (ModuleLazyloadDbusInfo *info)
+{
+    DBusObjectPathVTable vtable = {.message_function = _moduleLazyloadDbusMsgHandler, };
+    DBusError err;
+    int ret;
+
+    dbus_error_init (&err);
+
+    XDBG_RETURN_VAL_IF_FAIL (info->conn == NULL, FALSE);
+
+    info->conn = dbus_bus_get (DBUS_BUS_SYSTEM, &err);
+    if (dbus_error_is_set (&err))
+    {
+        XDBG_ERROR (MLAZY, "[SERVER] failed: connection (%s)\n", err.message);
+        goto free_err;
+    }
+    if (!info->conn)
+    {
+        XDBG_ERROR (MLAZY, "[SERVER] failed: connection NULL\n");
+        goto free_err;
+    }
+
+    ret = dbus_bus_request_name (info->conn, LAZYLOAD_DBUS_SERVER,
+                                 DBUS_NAME_FLAG_REPLACE_EXISTING , &err);
+    if (dbus_error_is_set (&err))
+    {
+        XDBG_ERROR (MLAZY, "[SERVER] failed: request name (%s)\n", err.message);
+        goto free_conn;
+    }
+    if (ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
+    {
+        XDBG_ERROR (MLAZY, "[SERVER] failed: Not Primary Owner (%d)\n", ret);
+        goto free_conn;
+    }
+
+       snprintf (info->rule, sizeof (info->rule), "type='method_call',interface='%s'",
+              LAZYLOAD_DBUS_INTERFACE);
+
+    /* blocks until we get a reply. */
+    dbus_bus_add_match (info->conn, info->rule, &err);
+    if (dbus_error_is_set (&err))
+    {
+        XDBG_ERROR (MLAZY, "[SERVER] failed: add match (%s)\n", err.message);
+        goto free_name;
+    }
+
+    if (!dbus_connection_register_object_path (info->conn,
+                                               LAZYLOAD_DBUS_PATH, &vtable,
+                                               info))
+    {
+        XDBG_ERROR (MLAZY, "[SERVER] failed: register object path\n");
+        goto free_match;
+    }
+
+    dbus_connection_set_exit_on_disconnect (info->conn, FALSE);
+
+    if (!dbus_connection_add_filter (info->conn, _moduleLazyloadDbusMsgFilter, info, NULL))
+    {
+        XDBG_ERROR (MLAZY, "[SERVER] failed: add filter (%s)\n", err.message);
+        goto free_register;
+    }
+
+       if (!dbus_connection_get_unix_fd (info->conn, &info->fd) || info->fd < 0)
+    {
+        XDBG_ERROR (MLAZY, "[SERVER] failed: get fd\n");
+        goto free_filter;
+    }
+
+    AddGeneralSocket (info->fd);
+    RegisterBlockAndWakeupHandlers ((BlockHandlerProcPtr)NoopDDA,
+                                    _moduleLazyloadDbusWakeupHandler, info);
+
+    XDBG_INFO (MLAZY, "[SERVER] connected\n");
+
+    dbus_error_free (&err);
+
+    return TRUE;
+
+free_filter:
+    dbus_connection_remove_filter (info->conn, _moduleLazyloadDbusMsgFilter, info);
+free_register:
+    dbus_connection_unregister_object_path (info->conn, LAZYLOAD_DBUS_PATH);
+free_match:
+    dbus_bus_remove_match (info->conn, info->rule, &err);
+    dbus_error_free (&err);
+free_name:
+    dbus_bus_release_name (info->conn, LAZYLOAD_DBUS_SERVER, &err);
+    dbus_error_free (&err);
+free_conn:
+    dbus_connection_close (info->conn);
+free_err:
+    dbus_error_free (&err);
+    info->conn = NULL;
+    info->fd = -1;
+
+    return FALSE;
+}
+
+static void
+_moduleLazyloadDbusDeinit (ModuleLazyloadDbusInfo *info)
+{
+    if (info->timer)
+    {
+        TimerFree (info->timer);
+        info->timer = NULL;
+    }
+
+    if (info->conn)
+    {
+        DBusError err;
+        dbus_error_init (&err);
+        dbus_connection_remove_filter (info->conn, _moduleLazyloadDbusMsgFilter, info);
+        dbus_connection_unregister_object_path (info->conn, LAZYLOAD_DBUS_PATH);
+        dbus_bus_remove_match (info->conn, info->rule, &err);
+        dbus_error_free (&err);
+        dbus_bus_release_name (info->conn, LAZYLOAD_DBUS_SERVER, &err);
+        dbus_error_free (&err);
+        dbus_connection_unref (info->conn);
+        info->conn = NULL;
+    }
+
+    RemoveBlockAndWakeupHandlers ((BlockHandlerProcPtr)NoopDDA,
+                                   _moduleLazyloadDbusWakeupHandler, info);
+    if (info->fd >= 0)
+    {
+        RemoveGeneralSocket (info->fd);
+        info->fd = -1;
+    }
+
+    XDBG_INFO (MLAZY, "[SERVER] disconnected\n");
+}
+
+Bool
+moduleLazyloadDbusConnect (void)
+{
+    XDBG_DEBUG (MLAZY, "[SERVER] connecting\n");
+
+    memset (&server_info, 0, sizeof(server_info));
+
+    server_info.fd = -1;
+    server_info.timer = TimerSet (NULL, 0, 1, _moduleLazyloadDbusTimeout, &server_info);
+
+    return TRUE;
+}
+
+void
+moduleLazyloadDbusDisconnect (void)
+{
+    XDBG_DEBUG (MLAZY, "[SERVER] disconnecting\n");
+
+    _moduleLazyloadDbusDeinit (&server_info);
+}
+
+Bool
+moduleLazyloadDbusAddMethod (ModuleLazyloadDbusMethod *method)
+{
+    ModuleLazyloadDbusMethod **prev;
+
+    for (prev = &server_info.methods; *prev; prev = &(*prev)->next);
+
+    method->next = NULL;
+    *prev = method;
+
+    return TRUE;
+}
+
+void
+moduleLazyloadDbusRemoveMethod (ModuleLazyloadDbusMethod *method)
+{
+    ModuleLazyloadDbusMethod **prev;
+
+    for (prev = &server_info.methods; *prev; prev = &(*prev)->next)
+        if (*prev == method)
+        {
+            *prev = method->next;
+            break;
+        }
+}
\ No newline at end of file
diff --git a/src/module_lazyload_dbus.h b/src/module_lazyload_dbus.h
new file mode 100644 (file)
index 0000000..6dec57b
--- /dev/null
@@ -0,0 +1,53 @@
+/**************************************************************************
+
+xserver-xorg-module-lazyload
+
+Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Sung-Jin Park <sj76.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+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, sub license, 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 (including the
+next paragraph) 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 NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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.
+
+**************************************************************************/
+
+#ifndef __MODULE_LAZYLOAD_DBUS_H__
+#define __MODULE_LAZYLOAD_DBUS_H__
+
+#include <dbus/dbus.h>
+
+typedef void (*MethodFunc) (void *data, int argc, char **argv, char *reply, int *len);
+
+typedef struct _ModuleLazyloadDbusMethod
+{
+    char       name[128];
+    MethodFunc func;
+    void       *data;
+
+    struct _ModuleLazyloadDbusMethod *next;
+} ModuleLazyloadDbusMethod;
+
+Bool moduleLazyloadDbusAddMethod    (ModuleLazyloadDbusMethod *method);
+void moduleLazyloadDbusRemoveMethod (ModuleLazyloadDbusMethod *method);
+Bool moduleLazyloadDbusConnect      (void);
+void moduleLazyloadDbusDisconnect   (void);
+
+#endif /* __MODULE_LAZYLOAD_DBUS_H__ */
diff --git a/src/module_lazyload_main.c b/src/module_lazyload_main.c
new file mode 100755 (executable)
index 0000000..5e6c742
--- /dev/null
@@ -0,0 +1,228 @@
+/**************************************************************************
+
+xserver-xorg-module-lazyload
+
+Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Sung-Jin Park <sj76.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+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, sub license, 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 (including the
+next paragraph) 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 NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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 <signal.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <dbus/dbus.h>
+#include "module_lazyload_main.h"
+#include "module_lazyload_dbus.h"
+
+extern Bool noInputInit;
+extern Bool xf86LoadModules(char **list, pointer *optlist);
+
+static ModuleLazyloadDbusMethod method;
+
+static void
+moduleLazyloadCommand (void *data, int argc, char **argv, char *reply, int *len)
+{
+    ModuleLazyload *pMod = (ModuleLazyload*)data;
+
+    XDBG_DEBUG (MLAZY, "%p\n", pMod);
+
+    //REPLY ("Hello\n");
+}
+
+void
+moduleLazyloadMain (ModuleLazyload *pMod, pointer opts)
+{
+       XF86OptionPtr pOpt;
+       char *token = NULL;
+       char *tmp = NULL;
+       char *reentrant_tmp = NULL;
+       char *reentrant_optVal = NULL;
+       int mod_count = 0;
+       int opt_count;
+       const char **opt_pointer = NULL;
+       XF86OptionPtr options = NULL;
+
+       int module_count = 0;
+       char **modulelist = NULL;
+       pointer *optarray = NULL;
+
+       OsSignal(SIGINT, SIG_IGN);
+
+       if(!(XF86OptionPtr)opts)
+       {
+               xf86Msg(X_INFO, "[%s] No options for lazyload module.\n", __FUNCTION__);
+               goto out;
+       }
+
+       for(pOpt = (XF86OptionPtr)opts ; pOpt ; pOpt = xf86NextOption(pOpt))
+               module_count++;
+
+/* dead_error_condition: The condition is cannot be true. */
+#if 0
+       if(!module_count)
+       {
+               xf86Msg(X_INFO, "[%s] Module count is zero.\n", __FUNCTION__);
+               goto out;
+       }
+#endif
+       modulelist = malloc((module_count + 1) * sizeof(char *));
+       optarray = malloc((module_count + 1) * sizeof(pointer));
+
+       if(!modulelist || !optarray)
+       {
+               xf86Msg(X_INFO, "[%s] Failed to allocate memory for (modulelist/optarray)\n", __FUNCTION__);
+               goto out;
+       }
+
+       for(pOpt = (XF86OptionPtr)opts ; pOpt ; pOpt = xf86NextOption(pOpt))
+       {
+               int len;
+               char *opt_name = xf86OptionName(pOpt);
+               char *opt_val = xf86OptionValue(pOpt);
+
+               if(!opt_name || !opt_val)
+               {
+                       xf86Msg(X_INFO, "[%s] opt_name or opt_val is NULL\n", __FUNCTION__);
+                       break;
+               }
+
+               //Input intialization
+               if(!strncmp("init_input", opt_name, sizeof("init_input")) && !strncmp("1", opt_val, 1))
+               {
+                       if(noInputInit)
+                       {
+                               xf86Msg(X_INFO, "[%s] Begin InitInput\n", __FUNCTION__);
+                               InitInput((int)0, (char **)NULL);
+                               xf86Msg(X_INFO, "[%s] End InitInput\n", __FUNCTION__);
+                       }
+                       continue;
+               }
+
+               //set module name
+               modulelist[mod_count] = opt_name;
+               xf86Msg(X_INFO, "[%s] module [%d] = %s\n", __FUNCTION__, mod_count, modulelist[mod_count]);
+
+               //count number of options
+               opt_count = 0;
+               len = strlen(opt_val);
+               tmp = malloc((len+1)*sizeof(char));
+
+               if(!tmp)
+               {
+                       xf86Msg(X_INFO, "[%s] Failed to allocate memory\n", __FUNCTION__);
+                       goto out;
+               }
+
+               strncpy(tmp, opt_val, len);
+               tmp[len] = '\0';
+
+               //Count number of options
+               
+               token = strtok_r (tmp, " ,", &reentrant_tmp);
+               while (token != NULL)
+               {
+                       opt_count++;            
+                       token = strtok_r (NULL, " ,", &reentrant_tmp);
+               }
+
+               if(opt_count)
+               {
+                       opt_pointer = calloc(opt_count+1, sizeof(char*));
+
+                       if(!opt_pointer)
+                       {
+                               xf86Msg(X_INFO, "[%s] Failed to allocate memory for option pointer\n", __FUNCTION__);
+                               goto out;
+                       }
+               }
+
+               //set option value(s)
+               opt_count = 0;  
+               token = strtok_r (opt_val, " ,", &reentrant_optVal);
+               while (token != NULL)
+               {
+                       opt_pointer[opt_count] = token;
+                       xf86Msg(X_INFO, "[%s] option [%d]=%s\n", __FUNCTION__, opt_count, opt_pointer[opt_count]);
+
+                       opt_count++;    
+                       token = strtok_r (NULL, " ,", &reentrant_optVal);
+               }
+               /* Terminate with NULL */
+               opt_pointer[opt_count] = NULL;
+
+               options = xf86OptionListCreate(opt_pointer, -1, 0);
+               optarray[mod_count] = options;
+
+               //Increase number of modules
+               mod_count++;
+       }
+
+       modulelist[mod_count] = NULL;
+       optarray[mod_count] = NULL;
+
+       if(mod_count)
+       {
+               xf86Msg(X_INFO, "[%s] Begin xf86LoadModules\n", __FUNCTION__);
+               xf86LoadModules(modulelist, optarray);
+               xf86Msg(X_INFO, "[%s] End xf86LoadModules\n", __FUNCTION__);
+
+               xf86Msg(X_INFO, "[%s] Lazy load of modules has been done.\n", __FUNCTION__);
+       }
+
+       if(opt_pointer) free(opt_pointer);
+       if(modulelist) free(modulelist);
+       if(optarray) free(optarray);
+       if(tmp) free(tmp);
+
+    moduleLazyloadDbusConnect ();
+    snprintf (method.name, sizeof (method.name), "%s", LAZYLOAD_DBUS_METHOD);
+    method.func = moduleLazyloadCommand;
+    method.data = pMod;
+    moduleLazyloadDbusAddMethod (&method);
+
+       return;
+
+out:
+       if(opt_pointer) free(opt_pointer);
+       if(modulelist) free(modulelist);
+       if(optarray) free(optarray);
+       if(tmp) free(tmp);
+
+    moduleLazyloadDbusRemoveMethod (&method);
+    moduleLazyloadDbusDisconnect ();
+
+       xf86Msg(X_INFO, "[%s] Failed to do lazy load !\n", __FUNCTION__);
+       return;
+}
+
+void
+moduleLazyloadMainExit (ModuleLazyload *pMod)
+{
+    moduleLazyloadDbusRemoveMethod (&method);
+    moduleLazyloadDbusDisconnect ();
+}
diff --git a/src/module_lazyload_main.h b/src/module_lazyload_main.h
new file mode 100755 (executable)
index 0000000..27d1e21
--- /dev/null
@@ -0,0 +1,56 @@
+/**************************************************************************
+
+xserver-xorg-module-lazyload
+
+Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Sung-Jin Park <sj76.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+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, sub license, 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 (including the
+next paragraph) 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 NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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.
+
+**************************************************************************/
+
+#ifndef __MODULE_LAZYLOAD_MAIN_H__
+#define __MODULE_LAZYLOAD_MAIN_H__
+
+#include <xf86.h>
+#include <xdbg.h>
+
+/* debug module for Lazyload */
+#define MLAZY   XDBG_M('L','A','Z','Y')
+#define MX11    XDBG_M('X','1','1',0)
+
+#define LAZYLOAD_DBUS_SERVER        "org.x.lazyload.server"
+#define LAZYLOAD_DBUS_INTERFACE     "org.x.lazyload.interface"
+#define LAZYLOAD_DBUS_PATH          "/org/x/lazyload/path"
+#define LAZYLOAD_DBUS_CLIENT        "org.x.lazyload.client"
+#define LAZYLOAD_DBUS_METHOD        "x_lazyload_do"
+
+typedef struct _ModuleLazyload
+{
+    int       init_input; /* init input */
+} ModuleLazyload;
+
+void    moduleLazyloadMain (ModuleLazyload *pMod, pointer opts);
+void    moduleLazyloadMainExit (ModuleLazyload *pMod);
+
+#endif /* __MODULE_LAZYLOAD_MAIN_H__ */
diff --git a/src/module_lazyload_options.c b/src/module_lazyload_options.c
new file mode 100755 (executable)
index 0000000..9043bfb
--- /dev/null
@@ -0,0 +1,41 @@
+/**************************************************************************
+
+xserver-xorg-module-lazyload
+
+Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Sung-Jin Park <sj76.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+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, sub license, 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 (including the
+next paragraph) 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 NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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 "module_lazyload_options.h"
+
+void
+moduleLazyloadParseOptions (ModuleLazyload *pMod, XF86OptionPtr pOpt)
+{
+}
diff --git a/src/module_lazyload_options.h b/src/module_lazyload_options.h
new file mode 100755 (executable)
index 0000000..76c8999
--- /dev/null
@@ -0,0 +1,41 @@
+/**************************************************************************
+
+xserver-xorg-module-lazyload
+
+Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Sung-Jin Park <sj76.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+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, sub license, 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 (including the
+next paragraph) 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 NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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.
+
+**************************************************************************/
+
+#ifndef __MODULE_LAZYLOAD_OPTIONS_H__
+#define __MODULE_LAZYLOAD_OPTIONS_H__
+
+#include "module_lazyload_main.h"
+
+#define NUM_MODULES    5
+
+void    moduleLazyloadParseOptions (ModuleLazyload *pMod, XF86OptionPtr pOpt);
+
+#endif /* __MODULE_LAZYLOAD_OPTIONS_H__ */