ivi-resource-manager: removed.
authorIsmo Puustinen <ismo.puustinen@intel.com>
Mon, 8 Dec 2014 12:31:51 +0000 (14:31 +0200)
committerKrisztian Litkey <krisztian.litkey@intel.com>
Thu, 8 Jan 2015 16:37:20 +0000 (18:37 +0200)
Change-Id: Id64767c49bb94ac9b0d2fe7271daeec89d8fc0ac

src/Makefile.am
src/plugins/ivi-resource-manager/appid.c [deleted file]
src/plugins/ivi-resource-manager/appid.h [deleted file]
src/plugins/ivi-resource-manager/audio.c [deleted file]
src/plugins/ivi-resource-manager/audio.h [deleted file]
src/plugins/ivi-resource-manager/class.c [deleted file]
src/plugins/ivi-resource-manager/class.h [deleted file]
src/plugins/ivi-resource-manager/plugin-ivi-resource-manager.c [deleted file]
src/plugins/ivi-resource-manager/plugin-ivi-resource-manager.h [deleted file]
src/plugins/ivi-resource-manager/screen.c [deleted file]
src/plugins/ivi-resource-manager/screen.h [deleted file]

index 1b6e597..254172e 100644 (file)
@@ -1324,36 +1324,6 @@ resource_client_CFLAGS  = $(AM_CFLAGS)
 resource_client_LDADD   =  libmurphy-common.la
 endif
 
-# IVI resource manager plugin
-if BUILD_RESOURCES
-PLUGIN_IVI_RESOURCE_MANAGER_REGULAR_SOURCES =                              \
-               plugins/ivi-resource-manager/plugin-ivi-resource-manager.c  \
-               plugins/ivi-resource-manager/class.c                        \
-               plugins/ivi-resource-manager/screen.c                       \
-               plugins/ivi-resource-manager/audio.c                        \
-               plugins/ivi-resource-manager/appid.c
-PLUGIN_IVI_RESOURCE_MANAGER_SOURCES =                                      \
-               $(PLUGIN_IVI_RESOURCE_MANAGER_REGULAR_SOURCES)
-PLUGIN_IVI_RESOURCE_MANAGER_CFLAGS =                                       \
-               $(LUA_CFLAGS)                                                                           \
-               $(TZCONFIG_CFLAGS)
-
-PLUGIN_IVI_RESOURCE_MANAGER_LIBS =                                         \
-               libmurphy-common.la                                                                     \
-               $(RESOURCE_LIBRARY)                                         \
-               $(LUA_LIBS)                                                                             \
-               $(TZCONFIG_LIBS)
-
-plugin_ivi_resource_manager_la_SOURCES = $(PLUGIN_IVI_RESOURCE_MANAGER_SOURCES)
-plugin_ivi_resource_manager_la_CFLAGS  = $(PLUGIN_IVI_RESOURCE_MANAGER_CFLAGS)\
-                                        $(MURPHY_CFLAGS) $(AM_CFLAGS)        \
-                                        $(JSON_CFLAGS)
-plugin_ivi_resource_manager_la_LDFLAGS = -module -avoid-version
-plugin_ivi_resource_manager_la_LIBADD  = $(PLUGIN_IVI_RESOURCE_MANAGER_LIBS)
-
-plugin_LTLIBRARIES += plugin-ivi-resource-manager.la
-endif
-
 #
 # GAM support:
 # - decision-tree library
diff --git a/src/plugins/ivi-resource-manager/appid.c b/src/plugins/ivi-resource-manager/appid.c
deleted file mode 100644 (file)
index 5306245..0000000
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Copyright (c) 2012, Intel Corporation
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *  * 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.
- *  * Neither the name of Intel Corporation nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <dirent.h>
-#include <limits.h>
-#include <errno.h>
-
-#include <murphy/common.h>
-
-#include "appid.h"
-
-#ifdef TZCONFIG_ENABLED
-#    include <tzplatform_config.h>
-#endif
-
-#define APP_MAX   1024
-
-typedef struct appid_map_s   appid_map_t;
-
-struct appid_map_s {
-    const char *id;
-    const char *exe;
-};
-
-struct mrp_resmgr_appid_s {
-    mrp_resmgr_data_t *data;
-    mrp_htbl_t *map;
-};
-
-static void map_init(mrp_resmgr_appid_t *, const char *);
-static void map_add_entry(mrp_resmgr_appid_t *, const char *, const char *);
-static void map_free_entry(void *, void *);
-
-static int pid2exe(const char *, char *, size_t);
-
-
-mrp_resmgr_appid_t *mrp_resmgr_appid_create(mrp_resmgr_data_t *data)
-{
-    mrp_resmgr_appid_t *appid;
-    mrp_htbl_config_t cfg;
-
-#ifdef TZCONFIG_ENABLED
-    const char *app_dir = tzplatform_getenv(TZ_USER_APP);
-#else
-    const char *app_dir = "/usr/app";
-#endif
-
-    cfg.nentry = APP_MAX;
-    cfg.comp = mrp_string_comp;
-    cfg.hash =  mrp_string_hash;
-    cfg.free = map_free_entry;
-    cfg.nbucket = cfg.nentry / 8;
-
-    if ((appid = mrp_allocz(sizeof(*appid)))) {
-        appid->data = data;
-        appid->map = mrp_htbl_create(&cfg);
-
-        map_init(appid, app_dir);
-    }
-
-    return appid;
-}
-
-
-void mrp_resmgr_appid_destroy(mrp_resmgr_appid_t *appid)
-{
-    if (appid) {
-        mrp_htbl_destroy(appid->map, TRUE);
-        mrp_free(appid);
-    }
-}
-
-const char *mrp_resmgr_appid_find_by_pid(mrp_resmgr_appid_t *appid,
-                                         const char *pid)
-{
-    char exe[PATH_MAX];
-    appid_map_t *entry;
-
-    if (pid2exe(pid, exe, PATH_MAX) < 0)
-        goto failed;
-
-    if (!(entry = mrp_htbl_lookup(appid->map, exe)))
-        goto failed;
-
-
-    return entry->id;
-
- failed:
-    return NULL;
-}
-
-static void map_init(mrp_resmgr_appid_t *appid, const char *dir_path)
-{
-    DIR *dir, *bindir;
-    struct dirent *dirent, *binent;
-    struct stat stat;
-    const char *id;
-    char subdir_path[PATH_MAX];
-    char bindir_path[PATH_MAX];
-    char exe[PATH_MAX];
-
-    if (!(dir = opendir(dir_path))) {
-        mrp_log_error("ivi-resource-manager: can't open directory %s: %s",
-                      dir_path, strerror(errno));
-        return;
-    }
-
-    while ((dirent = readdir(dir))) {
-        id = dirent->d_name;
-
-        snprintf(subdir_path, sizeof(subdir_path), "%s/%s", dir_path, id);
-
-        if (lstat(subdir_path, &stat) < 0) {
-            mrp_log_error("ivi-resource-manager: can't stat %s: %s",
-                          subdir_path, strerror(errno));
-            continue;
-        }
-
-        if (!S_ISDIR(stat.st_mode) || id[0] == '.')
-            continue;
-
-        snprintf(bindir_path, sizeof(bindir_path), "%s/bin", subdir_path);
-
-        if (!(bindir = opendir(bindir_path))) {
-            mrp_log_error("ivi-resource-manager: can't open directory %s: %s",
-                          bindir_path, strerror(errno));
-            continue;
-        }
-
-        while ((binent = readdir(bindir))) {
-            snprintf(exe, sizeof(exe), "%s/%s", bindir_path, binent->d_name);
-
-            if (lstat(exe, &stat) < 0) {
-                mrp_log_error("ivi-resource-manager: can't stat %s: %s",
-                              exe, strerror(errno));
-                continue;
-            }
-
-            if (!S_ISREG(stat.st_mode) || !(stat.st_mode & 0111))
-                continue;
-
-            map_add_entry(appid, id, exe);
-        }
-
-        closedir(bindir);
-
-    } /* while dirent */
-
-    closedir(dir);
-}
-
-static void map_add_entry(mrp_resmgr_appid_t *appid,
-                          const char *id,
-                          const char *exe)
-{
-    appid_map_t *entry;
-
-    if (!(entry = mrp_allocz(sizeof(*entry))) ||
-        !(entry->id = mrp_strdup(id)) ||
-        !(entry->exe = mrp_strdup(exe)))
-    {
-        mrp_log_error("ivi-resource-manager: can't allocate memory");
-        return;
-    }
-
-    mrp_htbl_insert(appid->map, (void *)entry->exe, entry);
-
-    mrp_log_info("ivi-resource-manager: map exe %s => appid %s",
-                 entry->exe, entry->id);
-}
-
-static void map_free_entry(void *key, void *object)
-{
-    appid_map_t *me = (appid_map_t *)object;
-
-    MRP_UNUSED(key);
-
-    free((void *)me->id);
-    free((void *)me->exe);
-    free((void *)me);
-}
-
-static int pid2exe(const char *pid, char *buf, size_t len)
-{
-    FILE *f;
-    char path[PATH_MAX];
-    char *p;
-    int st = -1;
-
-    if (pid && buf && len > 0) {
-        snprintf(path, sizeof(path), "/proc/%s/cmdline", pid);
-
-        if ((f = fopen(path, "r"))) {
-            if (fgets(buf, len-1, f)) {
-                if ((p = strchr(buf, ' ')))
-                    *p = '\0';
-                else if ((p = strchr(buf, '\n')))
-                    *p = '\0';
-                st = 0;
-            }
-            fclose(f);
-        }
-    }
-
-    if (st < 0)
-        mrp_log_info("ivi-resource-manager: pid2exe(%s) failed", pid);
-    else
-        mrp_log_info("ivi-resource-manager: pid %s => exe %s", pid, buf);
-
-    return st;
-}
-
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
- */
diff --git a/src/plugins/ivi-resource-manager/appid.h b/src/plugins/ivi-resource-manager/appid.h
deleted file mode 100644 (file)
index 20d63b7..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2012, Intel Corporation
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *  * 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.
- *  * Neither the name of Intel Corporation nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#ifndef __MURPHY_IVI_RESOURCE_MANAGER_APPID_H__
-#define __MURPHY_IVI_RESOURCE_MANAGER_APPID_H__
-
-#include "plugin-ivi-resource-manager.h"
-
-mrp_resmgr_appid_t *mrp_resmgr_appid_create(mrp_resmgr_data_t *);
-void mrp_resmgr_appid_destroy(mrp_resmgr_appid_t *);
-
-const char *mrp_resmgr_appid_find_by_pid(mrp_resmgr_appid_t *, const char *);
-
-
-#endif  /* __MURPHY_IVI_RESOURCE_MANAGER_APPID_H__ */
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
- */
diff --git a/src/plugins/ivi-resource-manager/audio.c b/src/plugins/ivi-resource-manager/audio.c
deleted file mode 100644 (file)
index 8ef756e..0000000
+++ /dev/null
@@ -1,819 +0,0 @@
-/*
- * Copyright (c) 2012, Intel Corporation
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *  * 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.
- *  * Neither the name of Intel Corporation nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include <murphy/common.h>
-
-#include <murphy-db/mqi.h>
-
-#include <murphy/resource/config-api.h>
-#include <murphy/resource/manager-api.h>
-#include <murphy/resource/client-api.h>
-
-#include "audio.h"
-#include "class.h"
-#include "appid.h"
-
-#define RESOURCE_NAME       "audio_playback"
-#define ACTIVE_SCREEN_TABLE "active_screen"
-
-#define ACTIVE_SCREEN_MAX   32
-
-#define BIT(i)               ((uint32_t)1 << (i))
-#define MASK(w)              (((uint32_t)1 << (w)) - 1)
-
-#define PRIORITY_BITS       8
-#define CATEGORY_BITS       8
-#define ZORDER_BITS         16
-
-#define PRIORITY_POSITION   0
-#define CATEGORY_POSITION   (PRIORITY_POSITION + PRIORITY_BITS)
-#define ZORDER_POSITION     (CATEGORY_POSITION + CATEGORY_BITS)
-
-#define PRIORITY_MASK       MASK(PRIORITY_BITS)
-#define CATEGORY_MASK       MASK(CATEGORY_BITS)
-#define ZORDER_MASK         MASK(ZORDER_BITS)
-
-#define STAMP_BITS          30
-#define ACQUIRE_BITS        1
-#define SHARE_BITS          1
-
-#define STAMP_POSITION      0
-#define ACQUIRE_POSITION    (STAMP_POSITION + STAMP_BITS)
-#define SHARE_POSITION      (ACQUIRE_POSITION + ACQUIRE_BITS)
-
-#define STAMP_MASK          MASK(STAMP_BITS)
-#define ACQUIRE_MASK        MASK(ACQUIRE_BITS)
-#define SHARE_MASK          MASK(SHARE_BITS)
-
-
-#define ATTRIBUTE(n,t,v)    {n, MRP_RESOURCE_RW, mqi_##t, {.t=v}}
-#define ATTR_END            {NULL, 0, 0, {.string=NULL}}
-
-typedef struct audio_resource_s   audio_resource_t;
-typedef struct active_screen_s    active_screen_t;
-
-struct active_screen_s {
-    const char *appid;
-};
-
-struct mrp_resmgr_audio_s {
-    mrp_resmgr_data_t *data;
-    uint32_t resid;
-    mrp_list_hook_t classes[MRP_ZONE_MAX];
-    int nactive[MRP_ZONE_MAX];
-    active_screen_t actives[MRP_ZONE_MAX][ACTIVE_SCREEN_MAX];
-    mqi_handle_t dbtbl;
-    uint32_t grantids[MRP_ZONE_MAX];
-};
-
-struct audio_resource_s {
-    mrp_list_hook_t link;
-    mrp_resource_t *res;
-    mrp_resmgr_audio_t *audio;
-    mrp_resmgr_class_t *class;
-    bool acquire;
-    uint32_t grantid;
-    uint32_t key;
-};
-
-
-static audio_resource_t *audio_resource_create(mrp_resmgr_audio_t *,
-                                                 mrp_zone_t *,mrp_resource_t *,
-                                                 mrp_application_class_t *);
-static void audio_resource_destroy(mrp_resmgr_audio_t *,  mrp_zone_t *,
-                                    mrp_resource_t *);
-static audio_resource_t *audio_resource_lookup(mrp_resmgr_audio_t *,
-                                                 mrp_resource_t *);
-static void audio_update_resources(mrp_resmgr_audio_t *, mrp_zone_t *);
-static void audio_grant_resources(mrp_resmgr_audio_t *, mrp_zone_t *);
-
-static void resource_class_move_resource(mrp_resmgr_class_t *,
-                                         audio_resource_t *);
-static uint32_t resource_key(audio_resource_t *);
-static bool resource_is_active(mrp_resmgr_audio_t *, uint32_t,
-                               audio_resource_t *);
-static void resource_fix_appid(mrp_resmgr_audio_t *, mrp_resource_t *);
-
-static void get_active_screens(mrp_resmgr_audio_t *, mrp_zone_t *);
-
-static void audio_notify(mrp_resource_event_t, mrp_zone_t *,
-                          mrp_application_class_t *, mrp_resource_t *, void *);
-static void audio_init(mrp_zone_t *, void *);
-static bool audio_allocate(mrp_zone_t *, mrp_resource_t *, void *);
-static void audio_free(mrp_zone_t *, mrp_resource_t *, void *);
-static bool audio_advice(mrp_zone_t *, mrp_resource_t *, void *);
-static void audio_commit(mrp_zone_t *, void *);
-
-
-#define PRIORITY_ATTRIDX  0
-#define CATEGORY_ATTRIDX  1
-#define APPID_ATTRIDX     2
-#define ROLE_ATTRIDX      3
-#define PID_ATTRIDX       4
-#define POLICY_ATTRIDX    5
-
-static mrp_attr_def_t audio_attrs[] = {
-    ATTRIBUTE("priority" , integer,       0      ),
-    ATTRIBUTE("cathegory", integer,       0      ),
-    ATTRIBUTE("appid"    , string , "<undefined>"),
-    ATTRIBUTE("role"     , string , "music"      ),
-    ATTRIBUTE("pid"      , string , "<unknown>"  ),
-    ATTRIBUTE("policy"   , string , "relaxed"    ),
-    ATTR_END
-};
-
-
-static mrp_resource_mgr_ftbl_t audio_ftbl = {
-    audio_notify,
-    audio_init,
-    audio_allocate,
-    audio_free,
-    audio_advice,
-    audio_commit
-};
-
-
-static uint32_t request_stamp;
-
-
-mrp_resmgr_audio_t *mrp_resmgr_audio_create(mrp_resmgr_data_t *data)
-{
-    mrp_resmgr_audio_t *audio;
-    uint32_t resid;
-    uint32_t i;
-
-    if ((audio = mrp_allocz(sizeof(*audio)))) {
-        resid = mrp_resource_definition_create(RESOURCE_NAME,true,audio_attrs,
-                                               &audio_ftbl,audio);
-        mrp_lua_resclass_create_from_c(resid);
-
-        audio->data = data;
-        audio->resid = resid;
-        audio->dbtbl = MQI_HANDLE_INVALID;
-
-        for (i = 0;  i < MRP_ZONE_MAX;  i++)
-            mrp_list_init(audio->classes + i);
-
-        mqi_open();
-
-        mrp_resmgr_register_dependency(data, ACTIVE_SCREEN_TABLE);
-    }
-
-    return audio;
-}
-
-
-void mrp_resmgr_audio_destroy(mrp_resmgr_audio_t *audio)
-{
-    if (audio) {
-
-        mrp_free(audio);
-    }
-}
-
-int mrp_resmgr_audio_print(mrp_resmgr_audio_t *audio,
-                            uint32_t zoneid,
-                            char *buf, int len)
-{
-#define PRINT(...)                              \
-    do {                                        \
-        p += snprintf(p, e-p, __VA_ARGS__);     \
-        if (p >= e)                             \
-            return p - buf;                     \
-    } while (0)
-
-    char *p, *e;
-    mrp_list_hook_t *classes, *centry, *cn;
-    mrp_list_hook_t *resources, *rentry, *rn;
-    mrp_resmgr_class_t *class;
-    audio_resource_t *ar;
-    const char *class_name;
-    mrp_attr_t a;
-    int i;
-
-    MRP_ASSERT(audio && buf && len > 0, "invalid argument");
-
-    e = (p = buf) + len;
-    classes = audio->classes + zoneid;
-
-    PRINT("      Resource 'audio' - grantid:%u\n", audio->grantids[zoneid]);
-
-    if (mrp_list_empty(classes))
-        PRINT("         No resources\n");
-    else {
-        mrp_list_foreach_back(classes, centry, cn) {
-            class = mrp_list_entry(centry, mrp_resmgr_class_t, link);
-            class_name = mrp_application_class_get_name(class->class);
-            resources = &class->resources;
-
-            PRINT("         Class '%s':\n", class_name);
-
-            mrp_list_foreach_back(resources, rentry, rn) {
-                ar = mrp_list_entry(rentry, audio_resource_t, link);
-
-                PRINT("            0x%08x %s %u",
-                      ar->key, ar->acquire ? "acquire":"release", ar->grantid);
-
-                for (i = 0;  i < (int)MRP_ARRAY_SIZE(audio_attrs) - 1;  i++) {
-                    if ((mrp_resource_read_attribute(ar->res, i, &a))) {
-                        PRINT(" %s:", a.name);
-
-                        switch (a.type) {
-                        case mqi_string:   PRINT("'%s'",a.value.string); break;
-                        case mqi_integer:  PRINT("%d",a.value.integer);  break;
-                        case mqi_unsignd:  PRINT("%u",a.value.unsignd);  break;
-                        case mqi_floating: PRINT("%lf",a.value.floating);break;
-                        default:           PRINT("<unsupported type>");  break;
-                        }
-                    }
-                }
-
-                PRINT("\n");
-            }
-        }
-    }
-
-    return p - buf;
-
-#undef PRINT
-}
-
-static audio_resource_t *audio_resource_create(mrp_resmgr_audio_t *audio,
-                                               mrp_zone_t *zone,
-                                               mrp_resource_t *res,
-                                               mrp_application_class_t *ac)
-{
-    mrp_resmgr_data_t *data;
-    uint32_t zone_id;
-    mrp_list_hook_t *classes;
-    mrp_resmgr_class_t *rc;
-    audio_resource_t *ar = NULL;
-
-    MRP_ASSERT(audio && zone && res && ac, "invalid argument");
-    MRP_ASSERT(audio->data, "confused with data structures");
-
-    data = audio->data;
-
-    zone_id = mrp_zone_get_id(zone);
-    classes = audio->classes + zone_id;
-
-    if (!(rc = mrp_resmgr_class_find(classes, ac)) &&
-        !(rc = mrp_resmgr_class_create(classes, ac)) )
-    {
-        mrp_log_error("ivi-resource-manager: can't obtain resmgr class");
-    }
-    else {
-        resource_fix_appid(audio, res);
-
-        if ((ar = mrp_allocz(sizeof(*ar)))) {
-            mrp_list_init(&ar->link);
-            ar->res = res;
-            ar->audio = audio;
-            ar->class = rc;
-            ar->key = resource_key(ar);
-
-            resource_class_move_resource(rc, ar);
-
-            mrp_resmgr_insert_resource(data, zone, res, ar);
-        }
-    }
-
-    return ar;
-}
-
-
-static void audio_resource_destroy(mrp_resmgr_audio_t *audio,
-                                    mrp_zone_t *zone,
-                                    mrp_resource_t *res)
-{
-    audio_resource_t *ar;
-
-    MRP_ASSERT(res && audio, "invalid argument");
-    MRP_ASSERT(audio->data, "confused with data structures");
-
-    if ((ar = mrp_resmgr_remove_resource(audio->data, zone, res))) {
-        mrp_list_delete(&ar->link);
-        mrp_free(ar);
-    }
-}
-
-
-static audio_resource_t *audio_resource_lookup(mrp_resmgr_audio_t *audio,
-                                                 mrp_resource_t *res)
-{
-    audio_resource_t *ar;
-
-    MRP_ASSERT(res && audio, "invalid argument");
-    MRP_ASSERT(audio->data, "confused with data structures");
-
-    ar = mrp_resmgr_lookup_resource(audio->data, res);
-
-    return ar;
-}
-
-static void audio_update_resources(mrp_resmgr_audio_t *audio,
-                                    mrp_zone_t *zone)
-{
-    uint32_t zoneid;
-    mrp_list_hook_t *classes, *centry, *cn;
-    mrp_list_hook_t *resources, *rentry, *rn;
-    mrp_resmgr_class_t *class;
-    const char *class_name;
-    audio_resource_t *ar, *ars[4096];
-    int nar;
-    uint32_t zorder;
-    int i;
-
-    zoneid = mrp_zone_get_id(zone);
-
-    /* We got a nonsense zone id */
-    if (zoneid >= MRP_ZONE_MAX) {
-        mrp_debug("invalid zoneid '%" PRIu32 "' >= MRP_ZONE_MAX (%d), "
-                  "bailing", zoneid, MRP_ZONE_MAX);
-        return;
-    }
-
-    classes = audio->classes + zoneid;
-
-    mrp_list_foreach_back(classes, centry, cn) {
-        class = mrp_list_entry(centry, mrp_resmgr_class_t, link);
-        class_name = mrp_application_class_get_name(class->class);
-        resources = &class->resources;
-
-        if (!strcmp(class_name, "player") || !strcmp(class_name, "base") || 1) {
-            nar = 0;
-
-            mrp_list_foreach_back(resources, rentry, rn) {
-                ar = mrp_list_entry(rentry, audio_resource_t, link);
-
-                if (resource_is_active(audio, zoneid, ar)) {
-                    ar->key |= (ZORDER_MASK << ZORDER_POSITION);
-                    if (nar >= (int)MRP_ARRAY_SIZE(ars)) {
-                        mrp_log_error("ivi-resource-manager: "
-                                      "too many active audios");
-                        break;
-                    }
-                    mrp_list_delete(&ar->link);
-                    ars[nar++] = ar;
-                }
-                else {
-                    zorder  = (ar->key >> ZORDER_POSITION) & ZORDER_MASK;
-                    zorder -= (zorder > 0) ? 1 : 0;
-
-                    ar->key &= ~(ZORDER_MASK << ZORDER_POSITION);
-                    ar->key |= (zorder << ZORDER_POSITION);
-                }
-            } /* foreach resource */
-
-            for (i = 0;   i < nar;   i++)
-                resource_class_move_resource(class, ars[i]);
-        } /* if class is 'player' or 'base' */
-
-    } /* foreach class */
-}
-
-static void audio_grant_resources(mrp_resmgr_audio_t *audio,
-                                   mrp_zone_t *zone)
-{
-    uint32_t zoneid;
-    uint32_t grantid;
-    mrp_list_hook_t *classes, *centry, *cn;
-    mrp_list_hook_t *resources, *rentry, *rn;
-    mrp_resmgr_class_t *class;
-    const char *class_name;
-    bool base_class;
-    audio_resource_t *ar;
-
-    zoneid  = mrp_zone_get_id(zone);
-
-    /* We got a nonsense zone id */
-    if (zoneid >= MRP_ZONE_MAX) {
-        mrp_debug("invalid zoneid '%" PRIu32 "' >= MRP_ZONE_MAX (%d), "
-                  "bailing", zoneid, MRP_ZONE_MAX);
-        return;
-    }
-
-    classes = audio->classes + zoneid;
-    grantid = ++audio->grantids[zoneid];
-
-    mrp_list_foreach_back(classes, centry, cn) {
-        class = mrp_list_entry(centry, mrp_resmgr_class_t, link);
-        class_name = mrp_application_class_get_name(class->class);
-        resources = &class->resources;
-        base_class = !strcmp(class_name, "player") ||
-            !strcmp(class_name, "base") || 1;
-
-        if (!base_class || audio->nactive[zoneid]) {
-            mrp_list_foreach_back(resources, rentry, rn) {
-                ar = mrp_list_entry(rentry, audio_resource_t, link);
-
-                if (!ar->acquire)
-                    continue;
-
-                if (base_class && !resource_is_active(audio,zoneid,ar))
-                    continue;
-
-                ar->grantid = grantid;
-
-                if (!mrp_resource_is_shared(ar->res))
-                    return;
-            } /* resources */
-        }
-    }
-}
-
-static void resource_class_move_resource(mrp_resmgr_class_t *class,
-                                         audio_resource_t *resource)
-{
-    mrp_list_hook_t *list, *entry, *n, *insert_before;
-    audio_resource_t *ar;
-
-    mrp_list_delete(&resource->link);
-
-    list = insert_before = &class->resources;
-
-    mrp_list_foreach_back(list, entry, n) {
-        ar = mrp_list_entry(entry, audio_resource_t, link);
-
-        if (resource->key >= ar->key)
-            break;
-
-        insert_before = entry;
-    }
-
-    mrp_list_append(insert_before, &resource->link);
-}
-
-
-static uint32_t resource_key(audio_resource_t *ar)
-{
-    mrp_resmgr_class_t *class;
-    const char *class_name;
-    bool base_class;
-    mrp_resource_t *res;
-    mrp_attr_t a;
-    uint32_t priority;
-    uint32_t category;
-    bool share;
-    bool acquire;
-    uint32_t key = 0;
-
-    do {
-        if (!(class = ar->class))
-            base_class = false;
-        else {
-            class_name = mrp_application_class_get_name(class->class);
-            base_class = !strcmp(class_name, "player") ||
-                         !strcmp(class_name, "base");
-        }
-
-        if (!(res = ar->res))
-            break;
-
-        if (base_class) {
-            if (!mrp_resource_read_attribute(res, PRIORITY_ATTRIDX, &a))
-                break;
-            if (a.type != mqi_integer || a.value.integer < 0)
-                break;
-
-            priority = (a.value.integer & PRIORITY_MASK) << PRIORITY_POSITION;
-
-            if (!mrp_resource_read_attribute(res, CATEGORY_ATTRIDX, &a))
-                break;
-            if (a.type != mqi_integer || a.value.integer < 0)
-                break;
-
-            category = (a.value.integer & CATEGORY_MASK) << CATEGORY_POSITION;
-
-            key = (priority | category);
-        }
-        else {
-            acquire = ar->acquire;
-            share = mrp_resource_is_shared(res);
-
-            key  = (++request_stamp & STAMP_MASK);
-            key |= (acquire ? (ACQUIRE_BITS << ACQUIRE_POSITION) : 0);
-            key |= (share ? (SHARE_BITS << SHARE_POSITION) : 0);
-        }
-
-    } while(0);
-
-    return key;
-}
-
-static bool resource_is_active(mrp_resmgr_audio_t *audio,
-                               uint32_t zoneid,
-                               audio_resource_t *ar)
-{
-    active_screen_t *as;
-    mrp_attr_t a;
-    const char *appid;
-    int i, n;
-
-    if (mrp_resource_read_attribute(ar->res, APPID_ATTRIDX, &a)) {
-        appid = a.value.string;
-
-        for (i = 0, n = audio->nactive[zoneid];   i < n;   i++) {
-            as = &audio->actives[zoneid][i];
-
-            if (!strcmp(appid, as->appid))
-                return true;
-        }
-    }
-
-    return false;
-}
-
-static void resource_fix_appid(mrp_resmgr_audio_t *audio, mrp_resource_t *res)
-{
-    mrp_resmgr_data_t *data;
-    mrp_attr_t attr, attrs[2];
-    const char *appid;
-    const char *pid;
-
-    data = audio->data;
-    appid = NULL;
-    pid = 0;
-
-    if (mrp_resource_read_attribute(res, PID_ATTRIDX, &attr)) {
-        if (attr.type == mqi_string) {
-            if (strcmp(attr.value.string, "<unknown>"))
-                pid = attr.value.string;
-        }
-    }
-
-    if (mrp_resource_read_attribute(res, APPID_ATTRIDX, &attr)) {
-        if (attr.type == mqi_string) {
-            if (strcmp(attr.value.string, "<undefined>"))
-                appid = attr.value.string;
-        }
-    }
-
-    if (!appid && pid) {
-        appid = mrp_resmgr_appid_find_by_pid(mrp_resmgr_get_appid(data), pid);
-
-        if (appid) {
-            memset(attrs, 0, sizeof(attrs));
-            attrs[0].name = audio_attrs[APPID_ATTRIDX].name;
-            attrs[0].type = mqi_string;
-            attrs[0].value.string = appid;
-
-            mrp_resource_write_attributes(res, attrs);
-        }
-    }
-}
-
-static void get_active_screens(mrp_resmgr_audio_t *audio, mrp_zone_t *zone)
-{
-    static const char *zone_name;
-
-    MQI_COLUMN_SELECTION_LIST(columns,
-        MQI_COLUMN_SELECTOR( 1, active_screen_t, appid )
-    );
-
-    MQI_WHERE_CLAUSE(where,
-        MQI_EQUAL( MQI_COLUMN(0), MQI_STRING_VAR(zone_name) )
-    );
-
-
-    uint32_t zone_id;
-    int n, nrow;
-    active_screen_t rows[MRP_ZONE_MAX * ACTIVE_SCREEN_MAX];
-    active_screen_t *as, *from, *to;
-    int i;
-
-    if (!audio || !zone)
-        return;
-
-    zone_id = mrp_zone_get_id(zone);
-    zone_name = mrp_zone_get_name(zone);
-
-    for (i = 0, n = audio->nactive[zone_id];   i < n;   i++) {
-        as = &audio->actives[zone_id][i];
-        mrp_free((void *)as->appid);
-        as = NULL;
-    }
-
-    audio->nactive[zone_id] = 0;
-
-    if (audio->dbtbl == MQI_HANDLE_INVALID) {
-        audio->dbtbl = mqi_get_table_handle(ACTIVE_SCREEN_TABLE);
-
-        if (audio->dbtbl == MQI_HANDLE_INVALID)
-            return;
-
-        mrp_log_info("ivi-resource-manager: audio resource: "
-                     "'active_screen' table found");
-    }
-
-    if ((size_t)mqi_get_table_size(audio->dbtbl) > MRP_ARRAY_SIZE(rows)) {
-        mrp_log_error("ivi-resource-manager: audio resource: "
-                      "table size exceeds the max.");
-        return;
-    }
-
-    if ((nrow = MQI_SELECT(columns, audio->dbtbl, where, rows)) < 0) {
-        mrp_log_error("ivi-resource-manager: audio resource: "
-                      "DB select failed: %s", strerror(errno));
-        return;
-    }
-
-    if (nrow > ACTIVE_SCREEN_MAX) {
-        mrp_log_error("ivi-resource-manager: audio resource: "
-                      "DB select result is too large (%d). "
-                      "Will be truncated to %d", nrow, ACTIVE_SCREEN_MAX);
-        nrow = ACTIVE_SCREEN_MAX;
-    }
-
-    for (i = 0;  i < nrow;  i++) {
-        from = &rows[i];
-        to = &audio->actives[zone_id][i];
-
-        to->appid = mrp_strdup(from->appid);
-    }
-
-    audio->nactive[zone_id] = nrow;
-}
-
-
-static void audio_notify(mrp_resource_event_t event,
-                          mrp_zone_t *zone,
-                          mrp_application_class_t *ac,
-                          mrp_resource_t *res,
-                          void *userdata)
-{
-    mrp_resmgr_audio_t *audio = (mrp_resmgr_audio_t *)userdata;
-    const char *zone_name = mrp_zone_get_name(zone);
-    audio_resource_t *ar;
-
-    MRP_ASSERT(zone && ac && res && audio, "invalid argument");
-
-    switch (event) {
-
-    case MRP_RESOURCE_EVENT_CREATED:
-        mrp_log_info("audio resource in zone '%s' created", zone_name);
-        audio_resource_create(audio, zone, res, ac);
-        break;
-
-    case MRP_RESOURCE_EVENT_DESTROYED:
-        mrp_log_info("audio resource in zone '%s' destroyed", zone_name);
-        audio_resource_destroy(audio, zone, res);
-        break;
-
-    case MRP_RESOURCE_EVENT_ACQUIRE:
-        mrp_log_info("audio resource in zone '%s' is acquiring", zone_name);
-        if (!(ar = audio_resource_lookup(audio, res)))
-            goto no_audio_resource;
-        else {
-            ar->acquire = true;
-        }
-        break;
-
-    case MRP_RESOURCE_EVENT_RELEASE:
-        mrp_log_info("audio resource in zone '%s' is released", zone_name);
-        if (!(ar = audio_resource_lookup(audio, res)))
-            goto no_audio_resource;
-        else {
-            ar->acquire = false;
-        }
-        break;
-
-    no_audio_resource:
-        mrp_log_error("ivi-resource-manager: can't find audio resource "
-                      "in zone '%s'", zone_name);
-        break;
-
-    default:
-        mrp_log_error("ivi-resource-manager: invalid event %d at audio "
-                      "notification (zone '%s')", event, zone_name);
-        break;
-    }
-}
-
-static void audio_init(mrp_zone_t *zone, void *userdata)
-{
-    mrp_resmgr_audio_t *audio = (mrp_resmgr_audio_t *)userdata;
-    const char *zone_name = mrp_zone_get_name(zone);
-
-    MRP_ASSERT(audio, "invalid argument");
-
-    mrp_log_info("audio init in zone '%s'", zone_name);
-
-    get_active_screens(audio, zone);
-    audio_update_resources(audio, zone);
-
-    audio_grant_resources(audio, zone);
-}
-
-static bool audio_allocate(mrp_zone_t *zone,
-                            mrp_resource_t *res,
-                            void *userdata)
-{
-    mrp_resmgr_audio_t *audio = (mrp_resmgr_audio_t *)userdata;
-    uint32_t zoneid;
-    const char *zonenam;
-    audio_resource_t *ar;
-    uint32_t grantid;
-
-    MRP_ASSERT(res && audio, "invalid argument");
-
-    zoneid  = mrp_zone_get_id(zone);
-
-    /* We got a nonsense zone id */
-    if (zoneid >= MRP_ZONE_MAX) {
-        mrp_debug("invalid zoneid '%" PRIu32 "' >= MRP_ZONE_MAX (%d), "
-                  "bailing", zoneid, MRP_ZONE_MAX);
-        return FALSE;
-    }
-
-    zonenam = mrp_zone_get_name(zone);
-    grantid = audio->grantids[zoneid];
-
-    mrp_log_info("audio allocate in zone '%s'", zonenam);
-
-    if ((ar = audio_resource_lookup(audio, res))) {
-        return (ar->grantid == grantid);
-    }
-
-    mrp_log_error("ivi-resource-manager: attempt to allocate "
-                  "untracked resource");
-
-    return FALSE;
-}
-
-
-static void audio_free(mrp_zone_t *zone, mrp_resource_t *res, void *userdata)
-{
-    mrp_resmgr_audio_t *audio = (mrp_resmgr_audio_t *)userdata;
-    const char *zone_name = mrp_zone_get_name(zone);
-
-    MRP_UNUSED(res);
-
-    MRP_ASSERT(audio, "invalid argument");
-
-    mrp_log_info("audio free in zone '%s'", zone_name);
-}
-
-static bool audio_advice(mrp_zone_t *zone,mrp_resource_t *res,void *userdata)
-{
-    mrp_resmgr_audio_t *audio = (mrp_resmgr_audio_t *)userdata;
-    const char *zone_name = mrp_zone_get_name(zone);
-
-    MRP_UNUSED(res);
-
-    MRP_ASSERT(audio, "invalid argument");
-
-    mrp_log_info("audio advice in zone '%s'", zone_name);
-
-    return TRUE;
-}
-
-static void audio_commit(mrp_zone_t *zone, void *userdata)
-{
-    mrp_resmgr_audio_t *audio = (mrp_resmgr_audio_t *)userdata;
-    const char *zone_name = mrp_zone_get_name(zone);
-
-    MRP_ASSERT(audio, "invalid argument");
-
-    mrp_log_info("audio commit in zone '%s'", zone_name);
-}
-
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
- */
diff --git a/src/plugins/ivi-resource-manager/audio.h b/src/plugins/ivi-resource-manager/audio.h
deleted file mode 100644 (file)
index 9473b63..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2012, Intel Corporation
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *  * 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.
- *  * Neither the name of Intel Corporation nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#ifndef __MURPHY_IVI_RESOURCE_MANAGER_AUDIO_H__
-#define __MURPHY_IVI_RESOURCE_MANAGER_AUDIO_H__
-
-#include "plugin-ivi-resource-manager.h"
-
-mrp_resmgr_audio_t *mrp_resmgr_audio_create(mrp_resmgr_data_t *);
-void mrp_resmgr_audio_destroy(mrp_resmgr_audio_t *);
-
-int mrp_resmgr_audio_print(mrp_resmgr_audio_t *, uint32_t, char *, int);
-
-
-#endif  /* __MURPHY_IVI_RESOURCE_MANAGER_AUDIO_H__ */
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
- */
diff --git a/src/plugins/ivi-resource-manager/class.c b/src/plugins/ivi-resource-manager/class.c
deleted file mode 100644 (file)
index 1bd079b..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2012, Intel Corporation
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *  * 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.
- *  * Neither the name of Intel Corporation nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <murphy/common.h>
-
-#include <murphy/resource/manager-api.h>
-
-#include "class.h"
-
-
-mrp_resmgr_class_t *mrp_resmgr_class_create(mrp_list_hook_t *classes,
-                                            mrp_application_class_t *ac)
-{
-    mrp_list_hook_t *insert_before, *entry, *n;
-    mrp_resmgr_class_t *class, *c;
-    uint32_t pri;
-
-    if (ac) {
-        pri = mrp_application_class_get_priority(ac);
-
-        if ((class = mrp_allocz(sizeof(mrp_resmgr_class_t)))) {
-            class->class = ac;
-            mrp_list_init(&class->resources);
-
-            insert_before = classes;
-            mrp_list_foreach_back(classes, entry, n) {
-                c = mrp_list_entry(entry, mrp_resmgr_class_t, link);
-
-                if (pri >= mrp_application_class_get_priority(c->class))
-                    break;
-
-                insert_before = entry;
-            }
-
-            mrp_list_insert_before(insert_before, &class->link);
-
-            return class;
-        }
-    }
-
-    return NULL;
-}
-
-
-void mrp_resmgr_class_destroy(mrp_resmgr_class_t *rc)
-{
-    if (rc) {
-        mrp_list_delete(&rc->link);
-        mrp_free(rc);
-    }
-}
-
-
-mrp_resmgr_class_t *mrp_resmgr_class_find(mrp_list_hook_t *classes,
-                                          mrp_application_class_t *ac)
-{
-    mrp_list_hook_t *entry, *n;
-    mrp_resmgr_class_t *rc;
-
-    if (ac) {
-        mrp_list_foreach(classes, entry, n) {
-            rc = mrp_list_entry(entry, mrp_resmgr_class_t, link);
-
-            if (ac == rc->class)
-                return rc;
-        }
-    }
-
-    return NULL;
-}
-
-
-
-
-
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
- */
diff --git a/src/plugins/ivi-resource-manager/class.h b/src/plugins/ivi-resource-manager/class.h
deleted file mode 100644 (file)
index d0c0074..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2012, Intel Corporation
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *  * 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.
- *  * Neither the name of Intel Corporation nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#ifndef __MURPHY_IVI_RESOURCE_MANAGER_CLASS_H__
-#define __MURPHY_IVI_RESOURCE_MANAGER_CLASS_H__
-
-#include <murphy/common/list.h>
-
-#include "plugin-ivi-resource-manager.h"
-
-struct mrp_resmgr_class_s {
-    mrp_list_hook_t link;
-    mrp_application_class_t *class;
-    mrp_list_hook_t resources;
-};
-
-
-mrp_resmgr_class_t *mrp_resmgr_class_create(mrp_list_hook_t *,
-                                            mrp_application_class_t *);
-
-void mrp_resmgr_class_destroy(mrp_resmgr_class_t *);
-
-mrp_resmgr_class_t *mrp_resmgr_class_find(mrp_list_hook_t *,
-                                          mrp_application_class_t *);
-
-
-#endif  /* __MURPHY_IVI_RESOURCE_MANAGER_CLASS_H__ */
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
- */
diff --git a/src/plugins/ivi-resource-manager/plugin-ivi-resource-manager.c b/src/plugins/ivi-resource-manager/plugin-ivi-resource-manager.c
deleted file mode 100644 (file)
index ed7ce30..0000000
+++ /dev/null
@@ -1,430 +0,0 @@
-/*
- * Copyright (c) 2012, Intel Corporation
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *  * 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.
- *  * Neither the name of Intel Corporation nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-#include <lualib.h>
-#include <lauxlib.h>
-
-#include <murphy/common.h>
-#include <murphy/common/debug.h>
-#include <murphy/core/plugin.h>
-#include <murphy/core/console.h>
-#include <murphy/core/event.h>
-#include <murphy/core/context.h>
-#include <murphy/core/lua-bindings/murphy.h>
-
-#include <murphy-db/mql.h>
-#include <murphy-db/mqi.h>
-
-#include <murphy/resource/config-api.h>
-#include <murphy/resource/manager-api.h>
-#include <murphy/resource/client-api.h>
-#include <murphy/resource/protocol.h>
-
-#include "screen.h"
-#include "audio.h"
-#include "appid.h"
-
-struct mrp_resmgr_data_s {
-    mrp_plugin_t        *plugin;
-    mrp_event_watch_t   *w;
-    mrp_resmgr_screen_t *screen;
-    mrp_resmgr_audio_t  *audio;
-    mrp_resmgr_appid_t  *appid;
-    mrp_htbl_t          *resources;
-    int                  ndepend;
-    const char         **depends;
-    mrp_zone_mask_t      zones;
-};
-
-static void print_resources_cb(mrp_console_t *, void *, int, char **);
-
-MRP_CONSOLE_GROUP(manager_group, "ivi-resource-manager", NULL, NULL, {
-        MRP_TOKENIZED_CMD("resources", print_resources_cb, FALSE,
-                          "resources", "prints managed resources",
-                          "prints  the resources managed by "
-                          "ivi-resource-manager."),
-});
-
-static mrp_resmgr_data_t *resmgr_data;
-
-void mrp_resmgr_register_dependency(mrp_resmgr_data_t *data,
-                                    const char *db_table_name)
-{
-    size_t size;
-    const char **depends;
-    char dependency[512];
-    int idx;
-
-    MRP_ASSERT(data && db_table_name, "invalid argument");
-
-    idx = data->ndepend;
-    size = (idx + 1) * sizeof(const char *);
-
-    if (!(depends = mrp_realloc(data->depends, size))) {
-        mrp_log_error("ivi-resource-manager: failed to allocate memory "
-                      "for resource dependencies");
-        data->ndepend = 0;
-        data->depends = NULL;
-        return;
-    }
-
-    snprintf(dependency, sizeof(dependency), "$%s", db_table_name);
-
-    if (!(depends[idx] = mrp_strdup(dependency))) {
-        mrp_log_error("ivi-resource-manager: failed to strdup dependency");
-        data->depends = depends;
-        return;
-    }
-
-    data->ndepend = idx + 1;
-    data->depends = depends;
-}
-
-void mrp_resmgr_insert_resource(mrp_resmgr_data_t *data,
-                                mrp_zone_t *zone,
-                                mrp_resource_t *key,
-                                void *resource)
-{
-    uint32_t zoneid;
-
-    MRP_ASSERT(data && zone && key && resource, "invalid argument");
-    MRP_ASSERT(data->resources, "uninitialised data structure");
-
-    zoneid = mrp_zone_get_id(zone);
-
-    data->zones |= ((mrp_zone_mask_t)1 << zoneid);
-
-    mrp_htbl_insert(data->resources, key, resource);
-}
-
-void *mrp_resmgr_remove_resource(mrp_resmgr_data_t *data,
-                                 mrp_zone_t *zone,
-                                 mrp_resource_t *key)
-{
-    MRP_ASSERT(data && zone && key, "invalid argument");
-    MRP_ASSERT(data->resources, "uninitialised data structure");
-
-    return mrp_htbl_remove(data->resources, key, FALSE);
-}
-
-void *mrp_resmgr_lookup_resource(mrp_resmgr_data_t *data, mrp_resource_t *key)
-{
-    MRP_ASSERT(data && key, "invalid argument");
-    MRP_ASSERT(data->resources, "uninitialised data structure");
-
-    return mrp_htbl_lookup(data->resources, key);
-}
-
-mrp_resmgr_screen_t *mrp_resmgr_get_screen(mrp_resmgr_data_t *data)
-{
-    MRP_ASSERT(data, "invalid argument");
-    MRP_ASSERT(data->screen, "confused with data structures");
-
-    return data->screen;
-}
-
-mrp_resmgr_audio_t *mrp_resmgr_get_audio(mrp_resmgr_data_t *data)
-{
-    MRP_ASSERT(data, "invalid argument");
-    MRP_ASSERT(data->audio, "confused with data structures");
-
-    return data->audio;
-}
-
-mrp_resmgr_appid_t *mrp_resmgr_get_appid(mrp_resmgr_data_t *data)
-{
-    MRP_ASSERT(data, "invalid argument");
-    MRP_ASSERT(data->appid, "confused with data structures");
-
-    return data->appid;
-}
-
-static void print_resources_cb(mrp_console_t *c, void *user_data,
-                               int argc, char **argv)
-{
-    const char *zones[MRP_ZONE_MAX + 1];
-    uint32_t zoneid;
-    char buf[65536];
-
-    MRP_UNUSED(c);
-    MRP_UNUSED(user_data);
-    MRP_UNUSED(argc);
-    MRP_UNUSED(argv);
-
-    mrp_zone_get_all_names(MRP_ZONE_MAX+1, zones);
-
-    printf("Resources managed by ivi-resource-manager:\n");
-
-    for (zoneid = 0;   zones[zoneid];  zoneid++) {
-        printf("   Zone '%s':\n", zones[zoneid]);
-
-        mrp_resmgr_screen_print(resmgr_data->screen, zoneid, buf, sizeof(buf));
-        fputs(buf, stdout);
-
-        mrp_resmgr_audio_print(resmgr_data->audio, zoneid, buf, sizeof(buf));
-        fputs(buf, stdout);
-    }
-
-    printf("\n");
-}
-
-
-static int resource_update_cb(mrp_scriptlet_t *script, mrp_context_tbl_t *ctbl)
-{
-    mrp_resmgr_data_t *data = (mrp_resmgr_data_t *)script->data;
-    mrp_zone_mask_t mask;
-    uint32_t zoneid;
-
-    MRP_UNUSED(ctbl);
-
-    for (mask = data->zones, zoneid = 0;   mask;   mask >>= 1, zoneid++) {
-        if ((mask & 1))
-            mrp_resource_owner_recalc(zoneid);
-    }
-
-    return TRUE;
-}
-
-static void add_depenedencies_to_resolver(mrp_resmgr_data_t *data)
-{
-    static const char *target = "_ivi_resources";
-    static mrp_interpreter_t resource_updater = {
-        { NULL, NULL },
-        "resource_updater",
-        NULL,
-        NULL,
-        NULL,
-        resource_update_cb,
-        NULL
-    };
-
-    mrp_plugin_t *plugin;
-    mrp_context_t *ctx;
-    mrp_resolver_t *resolver;
-    char buf[2048];
-    char *p, *e;
-    int i;
-    int success;
-
-    MRP_ASSERT(data, "invalid argument");
-
-    plugin = data->plugin;
-
-    if (!(ctx = plugin->ctx) || !(resolver = ctx->r))
-        return;
-
-    if (!data->ndepend || !data->depends)
-        return;
-
-    for (i = 0, e = (p = buf) + sizeof(buf); i < data->ndepend && p < e; i++)
-        p += snprintf(p, e-p, " %s", data->depends[i]);
-
-    printf("%s:%s\n\tresource_recalc()\n\n", target, buf);
-
-    success = mrp_resolver_add_prepared_target(resolver, target,
-                                               data->depends, data->ndepend,
-                                               &resource_updater, NULL, data);
-    if (!success) {
-        mrp_log_error("ivi-resource-manager: failed to install "
-                      "resolver target '%s'", target);
-    }
-}
-
-static void event_cb(mrp_event_watch_t *w, int id, mrp_msg_t *event_data,
-                     void *user_data)
-{
-    mrp_plugin_t      *plugin   = (mrp_plugin_t *)user_data;
-#if 0
-    mrp_plugin_arg_t  *args     = plugin->args;
-#endif
-    mrp_resmgr_data_t *data     = (mrp_resmgr_data_t *)plugin->data;
-    const char        *event    = mrp_get_event_name(id);
-    uint16_t           tag_inst = MRP_PLUGIN_TAG_INSTANCE;
-    uint16_t           tag_name = MRP_PLUGIN_TAG_PLUGIN;
-    const char        *inst;
-    const char        *name;
-    int                success;
-
-    MRP_UNUSED(w);
-
-    mrp_log_info("%s: got event 0x%x (%s):", plugin->instance, id, event);
-
-    if (data && event) {
-        if (!strcmp(event, MRP_PLUGIN_EVENT_STARTED)) {
-            success = mrp_msg_get(event_data,
-                                  MRP_MSG_TAG_STRING(tag_inst, &inst),
-                                  MRP_MSG_TAG_STRING(tag_name, &name),
-                                  MRP_MSG_END);
-            if (success) {
-                if (!strcmp(inst, plugin->instance)) {
-                    data->screen = mrp_resmgr_screen_create(data);
-                    data->audio  = mrp_resmgr_audio_create(data);
-                    data->appid  = mrp_resmgr_appid_create(data);
-
-                    add_depenedencies_to_resolver(data);
-                }
-            }
-        } /* if PLUGIN_STARTED */
-    }
-}
-
-
-static int subscribe_events(mrp_plugin_t *plugin)
-{
-    mrp_resmgr_data_t *data = (mrp_resmgr_data_t *)plugin->data;
-    mrp_event_mask_t   events;
-
-    mrp_set_named_events(&events,
-                         MRP_PLUGIN_EVENT_LOADED,
-                         MRP_PLUGIN_EVENT_STARTED,
-                         MRP_PLUGIN_EVENT_FAILED,
-                         MRP_PLUGIN_EVENT_STOPPING,
-                         MRP_PLUGIN_EVENT_STOPPED,
-                         MRP_PLUGIN_EVENT_UNLOADED,
-                         NULL);
-
-    data->w = mrp_add_event_watch(&events, event_cb, plugin);
-
-    return (data->w != NULL);
-}
-
-
-static void unsubscribe_events(mrp_plugin_t *plugin)
-{
-    mrp_resmgr_data_t *data = (mrp_resmgr_data_t *)plugin->data;
-
-    if (data->w) {
-        mrp_del_event_watch(data->w);
-        data->w = NULL;
-    }
-}
-
-
-static int hash_compare(const void *key1, const void *key2)
-{
-    if (key1 < key2)
-        return -1;
-    if (key1 > key2)
-        return 1;
-    return 0;
-}
-
-static uint32_t hash_function(const void *key)
-{
-    uint64_t k = (ptrdiff_t)key;
-
-    return (uint32_t)((k >> 4) & 0xffffffff);
-}
-
-
-static int manager_init(mrp_plugin_t *plugin)
-{
-#if 0
-    mrp_plugin_arg_t  *args = plugin->args;
-#endif
-    mrp_resmgr_data_t *data;
-    mrp_htbl_config_t  cfg;
-
-    mrp_log_info("%s() called for IVI resource manager instance '%s'...",
-                 __FUNCTION__, plugin->instance);
-
-    cfg.nentry = 256;
-    cfg.comp = hash_compare;
-    cfg.hash = hash_function;
-    cfg.free = NULL;
-    cfg.nbucket = cfg.nentry / 4;
-
-    if (!(data = mrp_allocz(sizeof(*data)))) {
-        mrp_log_error("Failed to allocate private data for IVI resource "
-                      "manager plugin instance %s.", plugin->instance);
-        return FALSE;
-    }
-
-    data->plugin = plugin;
-    data->resources = mrp_htbl_create(&cfg);
-
-    plugin->data = data;
-    resmgr_data  = data;
-
-    subscribe_events(plugin);
-
-    return TRUE;
-}
-
-
-static void manager_exit(mrp_plugin_t *plugin)
-{
-    mrp_resmgr_data_t *data;
-
-    mrp_log_info("%s() called for IVI resource manager instance '%s'...",
-                 __FUNCTION__, plugin->instance);
-
-    unsubscribe_events(plugin);
-
-    if ((data = plugin->data) && data == resmgr_data) {
-        mrp_resmgr_screen_destroy(data->screen);
-        mrp_resmgr_audio_destroy(data->audio);
-        mrp_resmgr_appid_destroy(data->appid);
-    }
-}
-
-
-#define MANAGER_DESCRIPTION "Plugin to implement IVI resources"
-#define MANAGER_HELP        "Maybe later ..."
-#define MANAGER_VERSION      MRP_VERSION_INT(0, 0, 1)
-#define MANAGER_AUTHORS     "Janos Kovacs <jankovac503@gmail.com>"
-
-static mrp_plugin_arg_t args[] = {
-};
-
-
-MURPHY_REGISTER_PLUGIN("resource-manager",
-                       MANAGER_VERSION,
-                       MANAGER_DESCRIPTION,
-                       MANAGER_AUTHORS,
-                       MANAGER_HELP,
-                       MRP_SINGLETON,
-                       manager_init,
-                       manager_exit,
-                       args, MRP_ARRAY_SIZE(args),
-                       NULL, 0,
-                       NULL, 0,
-                       &manager_group);
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
- */
diff --git a/src/plugins/ivi-resource-manager/plugin-ivi-resource-manager.h b/src/plugins/ivi-resource-manager/plugin-ivi-resource-manager.h
deleted file mode 100644 (file)
index 8980251..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2012, Intel Corporation
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *  * 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.
- *  * Neither the name of Intel Corporation nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#ifndef __MURPHY_IVI_RESOURCE_MANAGER_H__
-#define __MURPHY_IVI_RESOURCE_MANAGER_H__
-
-#include <murphy/resource/data-types.h>
-
-
-typedef struct mrp_resmgr_data_s      mrp_resmgr_data_t;
-typedef struct mrp_resmgr_screen_s    mrp_resmgr_screen_t;
-typedef struct mrp_resmgr_audio_s     mrp_resmgr_audio_t;
-typedef struct mrp_resmgr_class_s     mrp_resmgr_class_t;
-typedef struct mrp_resmgr_appid_s     mrp_resmgr_appid_t;
-
-
-void  mrp_resmgr_register_dependency(mrp_resmgr_data_t *, const char *);
-
-void  mrp_resmgr_insert_resource(mrp_resmgr_data_t *, mrp_zone_t *,
-                                 mrp_resource_t *, void *);
-void *mrp_resmgr_remove_resource(mrp_resmgr_data_t *, mrp_zone_t *,
-                                 mrp_resource_t *);
-void *mrp_resmgr_lookup_resource(mrp_resmgr_data_t *, mrp_resource_t *);
-
-mrp_resmgr_screen_t *mrp_resmgr_get_screen(mrp_resmgr_data_t *);
-mrp_resmgr_audio_t *mrp_resmgr_get_audio(mrp_resmgr_data_t *);
-mrp_resmgr_appid_t *mrp_resmgr_get_appid(mrp_resmgr_data_t *);
-
-
-#endif  /* __MURPHY_IVI_RESOURCE_MANAGER_H__ */
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
- */
diff --git a/src/plugins/ivi-resource-manager/screen.c b/src/plugins/ivi-resource-manager/screen.c
deleted file mode 100644 (file)
index 4ca5c2d..0000000
+++ /dev/null
@@ -1,709 +0,0 @@
-/*
- * Copyright (c) 2012, Intel Corporation
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *  * 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.
- *  * Neither the name of Intel Corporation nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include <murphy/common.h>
-
-#include <murphy-db/mqi.h>
-
-#include <murphy/resource/config-api.h>
-#include <murphy/resource/manager-api.h>
-#include <murphy/resource/client-api.h>
-
-#include "screen.h"
-#include "class.h"
-
-#define RESOURCE_NAME       "screen"
-#define ACTIVE_SCREEN_TABLE "active_screen"
-
-#define ACTIVE_SCREEN_MAX   32
-
-#define BIT(i)               ((uint32_t)1 << (i))
-#define MASK(w)              (((uint32_t)1 << (w)) - 1)
-
-#define PRIORITY_BITS       8
-#define CATEGORY_BITS       8
-#define ZORDER_BITS         16
-
-#define PRIORITY_POSITION   0
-#define CATEGORY_POSITION   (PRIORITY_POSITION + PRIORITY_BITS)
-#define ZORDER_POSITION     (CATEGORY_POSITION + CATEGORY_BITS)
-
-#define PRIORITY_MASK       MASK(PRIORITY_BITS)
-#define CATEGORY_MASK       MASK(CATEGORY_BITS)
-#define ZORDER_MASK         MASK(ZORDER_BITS)
-
-#define ATTRIBUTE(n,t,v)    {n, MRP_RESOURCE_RW, mqi_##t, {.t=v}}
-#define ATTR_END            {NULL, 0, 0, {.string=NULL}}
-
-typedef struct screen_resource_s   screen_resource_t;
-typedef struct active_screen_s     active_screen_t;
-
-struct active_screen_s {
-    const char *appid;
-};
-
-struct mrp_resmgr_screen_s {
-    mrp_resmgr_data_t *data;
-    uint32_t resid;
-    mrp_list_hook_t classes[MRP_ZONE_MAX];
-    int nactive[MRP_ZONE_MAX];
-    active_screen_t actives[MRP_ZONE_MAX][ACTIVE_SCREEN_MAX];
-    mqi_handle_t dbtbl;
-    uint32_t grantids[MRP_ZONE_MAX];
-};
-
-struct screen_resource_s {
-    mrp_list_hook_t link;
-    mrp_resource_t *res;
-    mrp_resmgr_screen_t *screen;
-    mrp_resmgr_class_t *class;
-    bool acquire;
-    uint32_t grantid;
-    uint32_t key;
-};
-
-
-static screen_resource_t *screen_resource_create(mrp_resmgr_screen_t *,
-                                                 mrp_zone_t *,mrp_resource_t *,
-                                                 mrp_application_class_t *);
-static void screen_resource_destroy(mrp_resmgr_screen_t *,  mrp_zone_t *,
-                                    mrp_resource_t *);
-static screen_resource_t *screen_resource_lookup(mrp_resmgr_screen_t *,
-                                                 mrp_resource_t *);
-static void screen_update_resources(mrp_resmgr_screen_t *, mrp_zone_t *);
-static void screen_grant_resources(mrp_resmgr_screen_t *, mrp_zone_t *);
-
-static void resource_class_move_resource(mrp_resmgr_class_t *,
-                                         screen_resource_t *);
-static uint32_t resource_key(mrp_resource_t *);
-
-static void get_active_screens(mrp_resmgr_screen_t *, mrp_zone_t *);
-
-static void screen_notify(mrp_resource_event_t, mrp_zone_t *,
-                          mrp_application_class_t *, mrp_resource_t *, void *);
-static void screen_init(mrp_zone_t *, void *);
-static bool screen_allocate(mrp_zone_t *, mrp_resource_t *, void *);
-static void screen_free(mrp_zone_t *, mrp_resource_t *, void *);
-static bool screen_advice(mrp_zone_t *, mrp_resource_t *, void *);
-static void screen_commit(mrp_zone_t *, void *);
-
-
-#define PRIORITY_ATTRIDX  0
-#define CATEGORY_ATTRIDX  1
-#define APPID_ATTRIDX     2
-
-static mrp_attr_def_t screen_attrs[] = {
-    ATTRIBUTE("priority" , integer,       0      ),
-    ATTRIBUTE("cathegory", integer,       0      ),
-    ATTRIBUTE("appid"    , string , "<undefined>"),
-    ATTR_END
-};
-
-
-static mrp_resource_mgr_ftbl_t screen_ftbl = {
-    screen_notify,
-    screen_init,
-    screen_allocate,
-    screen_free,
-    screen_advice,
-    screen_commit
-};
-
-
-
-mrp_resmgr_screen_t *mrp_resmgr_screen_create(mrp_resmgr_data_t *data)
-{
-    mrp_resmgr_screen_t *screen;
-    uint32_t resid;
-    uint32_t i;
-
-    if ((screen = mrp_allocz(sizeof(*screen)))) {
-        resid = mrp_resource_definition_create(RESOURCE_NAME,true,screen_attrs,
-                                               &screen_ftbl,screen);
-        mrp_lua_resclass_create_from_c(resid);
-
-        screen->data = data;
-        screen->resid = resid;
-        screen->dbtbl = MQI_HANDLE_INVALID;
-
-        for (i = 0;  i < MRP_ZONE_MAX;  i++)
-            mrp_list_init(screen->classes + i);
-
-        mqi_open();
-
-        mrp_resmgr_register_dependency(data, ACTIVE_SCREEN_TABLE);
-    }
-
-    return screen;
-}
-
-
-void mrp_resmgr_screen_destroy(mrp_resmgr_screen_t *screen)
-{
-    if (screen) {
-
-        mrp_free(screen);
-    }
-}
-
-int mrp_resmgr_screen_print(mrp_resmgr_screen_t *screen,
-                            uint32_t zoneid,
-                            char *buf, int len)
-{
-#define PRINT(...)                              \
-    do {                                        \
-        p += snprintf(p, e-p, __VA_ARGS__);     \
-        if (p >= e)                             \
-            return p - buf;                     \
-    } while (0)
-
-    char *p, *e;
-    mrp_list_hook_t *classes, *centry, *cn;
-    mrp_list_hook_t *resources, *rentry, *rn;
-    mrp_resmgr_class_t *class;
-    screen_resource_t *sr;
-    const char *class_name;
-    mrp_attr_t a;
-    int i;
-
-    MRP_ASSERT(screen && buf && len > 0, "invalid argument");
-
-    e = (p = buf) + len;
-    classes = screen->classes + zoneid;
-
-    PRINT("      Resource 'screen' - grantid:%u\n", screen->grantids[zoneid]);
-
-    if (mrp_list_empty(classes))
-        PRINT("         No resources\n");
-    else {
-        mrp_list_foreach_back(classes, centry, cn) {
-            class = mrp_list_entry(centry, mrp_resmgr_class_t, link);
-            class_name = mrp_application_class_get_name(class->class);
-            resources = &class->resources;
-
-            PRINT("         Class '%s':\n", class_name);
-
-            mrp_list_foreach_back(resources, rentry, rn) {
-                sr = mrp_list_entry(rentry, screen_resource_t, link);
-
-                PRINT("            0x%08x %s %u",
-                      sr->key, sr->acquire ? "acquire":"release", sr->grantid);
-
-                for (i = 0;  i < (int)MRP_ARRAY_SIZE(screen_attrs) - 1;  i++) {
-                    if ((mrp_resource_read_attribute(sr->res, i, &a))) {
-                        PRINT(" %s:", a.name);
-
-                        switch (a.type) {
-                        case mqi_string:   PRINT("'%s'",a.value.string); break;
-                        case mqi_integer:  PRINT("%d",a.value.integer);  break;
-                        case mqi_unsignd:  PRINT("%u",a.value.unsignd);  break;
-                        case mqi_floating: PRINT("%lf",a.value.floating);break;
-                        default:           PRINT("<unsupported type>");  break;
-                        }
-                    }
-                }
-
-                PRINT("\n");
-            }
-        }
-    }
-
-    return p - buf;
-
-#undef PRINT
-}
-
-static screen_resource_t *screen_resource_create(mrp_resmgr_screen_t *screen,
-                                                 mrp_zone_t *zone,
-                                                 mrp_resource_t *res,
-                                                 mrp_application_class_t *ac)
-{
-    mrp_resmgr_data_t *data;
-    uint32_t zone_id;
-    mrp_list_hook_t *classes;
-    mrp_resmgr_class_t *rc;
-    screen_resource_t *sr = NULL;
-
-    MRP_ASSERT(screen && zone && res && ac, "invalid argument");
-    MRP_ASSERT(screen->data, "confused with data structures");
-
-    data = screen->data;
-
-    zone_id = mrp_zone_get_id(zone);
-    classes = screen->classes + zone_id;
-
-    if (!(rc = mrp_resmgr_class_find(classes, ac)) &&
-        !(rc = mrp_resmgr_class_create(classes, ac)) )
-    {
-        mrp_log_error("ivi-resource-manager: can't obtain resmgr class");
-    }
-    else {
-        if ((sr = mrp_allocz(sizeof(*sr)))) {
-            mrp_list_init(&sr->link);
-            sr->res = res;
-            sr->screen = screen;
-            sr->class = rc;
-            sr->key = resource_key(res);
-
-            resource_class_move_resource(rc, sr);
-
-            mrp_resmgr_insert_resource(data, zone, res, sr);
-        }
-    }
-
-    return sr;
-}
-
-
-static void screen_resource_destroy(mrp_resmgr_screen_t *screen,
-                                    mrp_zone_t *zone,
-                                    mrp_resource_t *res)
-{
-    screen_resource_t *sr;
-
-    MRP_ASSERT(res && screen, "invalid argument");
-    MRP_ASSERT(screen->data, "confused with data structures");
-
-    if ((sr = mrp_resmgr_remove_resource(screen->data, zone, res))) {
-        mrp_list_delete(&sr->link);
-        mrp_free(sr);
-    }
-}
-
-
-static screen_resource_t *screen_resource_lookup(mrp_resmgr_screen_t *screen,
-                                                 mrp_resource_t *res)
-{
-    screen_resource_t *sr;
-
-    MRP_ASSERT(res && screen, "invalid argument");
-    MRP_ASSERT(screen->data, "confused with data structures");
-
-    sr = mrp_resmgr_lookup_resource(screen->data, res);
-
-    return sr;
-}
-
-static void screen_update_resources(mrp_resmgr_screen_t *screen,
-                                    mrp_zone_t *zone)
-{
-    uint32_t zoneid;
-    mrp_list_hook_t *classes, *centry, *cn;
-    mrp_list_hook_t *resources, *rentry, *rn;
-    mrp_resmgr_class_t *class;
-    mrp_attr_t a;
-    const char *appid;
-    screen_resource_t *sr, *srs[4096];
-    int nsr;
-    active_screen_t *as;
-    bool active;
-    uint32_t zorder;
-    int i, n;
-
-    zoneid = mrp_zone_get_id(zone);
-
-    /* We got a nonsense zone id */
-    if (zoneid >= MRP_ZONE_MAX) {
-        mrp_debug("invalid zoneid '%" PRIu32 "' is larger than MRP_ZONE_MAX (%d), "
-                  "bailing", zoneid, MRP_ZONE_MAX);
-        return;
-    }
-
-    classes = screen->classes + zoneid;
-
-    mrp_list_foreach_back(classes, centry, cn) {
-        class = mrp_list_entry(centry, mrp_resmgr_class_t, link);
-        resources = &class->resources;
-        nsr = 0;
-
-        mrp_list_foreach_back(resources, rentry, rn) {
-            sr = mrp_list_entry(rentry, screen_resource_t, link);
-
-            active = false;
-
-            if (mrp_resource_read_attribute(sr->res, APPID_ATTRIDX, &a)) {
-                appid = a.value.string;
-
-                for (i = 0, n = screen->nactive[zoneid];   i < n;   i++) {
-                    as = &screen->actives[zoneid][i];
-
-                    if (!strcmp(appid, as->appid)) {
-                        active = true;
-                        break;
-                    }
-                }
-            }
-
-            if (active) {
-                sr->key |= (ZORDER_MASK << ZORDER_POSITION);
-                if (nsr >= (int)MRP_ARRAY_SIZE(srs)) {
-                    mrp_log_error("ivi-resource-manager: "
-                                  "too many active screens");
-                    break;
-                }
-                mrp_list_delete(&sr->link);
-                srs[nsr++] = sr;
-            }
-            else {
-                zorder  = (sr->key >> ZORDER_POSITION) & ZORDER_MASK;
-                zorder -= (zorder > 0) ? 1 : 0;
-
-                sr->key &= ~(ZORDER_MASK << ZORDER_POSITION);
-                sr->key |= (zorder << ZORDER_POSITION);
-            }
-        } /* foreach resource */
-
-        for (i = 0;   i < nsr;   i++)
-            resource_class_move_resource(class, srs[i]);
-
-    } /* foreach class */
-}
-
-static void screen_grant_resources(mrp_resmgr_screen_t *screen,
-                                   mrp_zone_t *zone)
-{
-    uint32_t zoneid;
-    uint32_t grantid;
-    mrp_list_hook_t *classes, *centry, *cn;
-    mrp_list_hook_t *resources, *rentry, *rn;
-    mrp_resmgr_class_t *class;
-    screen_resource_t *sr;
-
-    zoneid  = mrp_zone_get_id(zone);
-
-    /* We got a nonsense zone id */
-    if (zoneid >= MRP_ZONE_MAX) {
-        mrp_debug("invalid zoneid '%" PRIu32 "' is larger than MRP_ZONE_MAX (%d), "
-                  "bailing", zoneid, MRP_ZONE_MAX);
-        return;
-    }
-
-    classes = screen->classes + zoneid;
-    grantid = ++screen->grantids[zoneid];
-
-    if (screen->nactive[zoneid]) {
-        mrp_list_foreach_back(classes, centry, cn) {
-            class = mrp_list_entry(centry, mrp_resmgr_class_t, link);
-            resources = &class->resources;
-
-            mrp_list_foreach_back(resources, rentry, rn) {
-                sr = mrp_list_entry(rentry, screen_resource_t, link);
-
-                if (sr->acquire) {
-                    sr->grantid = grantid;
-
-                    if (!mrp_resource_is_shared(sr->res))
-                        return;
-                }
-            }
-        }
-    }
-}
-
-static void resource_class_move_resource(mrp_resmgr_class_t *class,
-                                         screen_resource_t *resource)
-{
-    mrp_list_hook_t *list, *entry, *n, *insert_before;
-    screen_resource_t *sr;
-
-    mrp_list_delete(&resource->link);
-
-    list = insert_before = &class->resources;
-
-    mrp_list_foreach_back(list, entry, n) {
-        sr = mrp_list_entry(entry, screen_resource_t, link);
-
-        if (resource->key >= sr->key)
-            break;
-
-        insert_before = entry;
-    }
-
-    mrp_list_append(insert_before, &resource->link);
-}
-
-
-static uint32_t resource_key(mrp_resource_t *res)
-{
-    mrp_attr_t attr;
-    uint32_t priority;
-    uint32_t category;
-    uint32_t key = 0;
-
-    do {
-        if (!res)
-            break;
-
-        if (!mrp_resource_read_attribute(res, PRIORITY_ATTRIDX, &attr))
-            break;
-        if (attr.type != mqi_integer || attr.value.integer < 0)
-            break;
-
-        priority = ((attr.value.integer & PRIORITY_MASK) << PRIORITY_POSITION);
-
-        if (!mrp_resource_read_attribute(res, CATEGORY_ATTRIDX, &attr))
-            break;
-        if (attr.type != mqi_integer || attr.value.integer < 0)
-            break;
-
-        category = ((attr.value.integer & CATEGORY_MASK) << CATEGORY_POSITION);
-
-        key = (priority | category);
-
-        return key;
-
-    } while(0);
-
-    return key;
-}
-
-static void get_active_screens(mrp_resmgr_screen_t *screen, mrp_zone_t *zone)
-{
-    static const char *zone_name;
-
-    MQI_COLUMN_SELECTION_LIST(columns,
-        MQI_COLUMN_SELECTOR( 1, active_screen_t, appid )
-    );
-
-    MQI_WHERE_CLAUSE(where,
-        MQI_EQUAL( MQI_COLUMN(0), MQI_STRING_VAR(zone_name) )
-    );
-
-
-    uint32_t zone_id;
-    int n, nrow;
-    active_screen_t rows[MRP_ZONE_MAX * ACTIVE_SCREEN_MAX];
-    active_screen_t *as, *from, *to;
-    int i;
-
-    if (!screen || !zone)
-        return;
-
-    zone_id = mrp_zone_get_id(zone);
-    zone_name = mrp_zone_get_name(zone);
-
-    for (i = 0, n = screen->nactive[zone_id];   i < n;   i++) {
-        as = &screen->actives[zone_id][i];
-        mrp_free((void *)as->appid);
-        as = NULL;
-    }
-
-    screen->nactive[zone_id] = 0;
-
-    if (screen->dbtbl == MQI_HANDLE_INVALID) {
-        screen->dbtbl = mqi_get_table_handle(ACTIVE_SCREEN_TABLE);
-
-        if (screen->dbtbl == MQI_HANDLE_INVALID)
-            return;
-
-        mrp_log_info("ivi-resource-manager: screen resource: "
-                     "'active_screen' table found");
-    }
-
-    if ((size_t)mqi_get_table_size(screen->dbtbl) > MRP_ARRAY_SIZE(rows)) {
-        mrp_log_error("ivi-resource-manager: screen resource: "
-                      "table size exceeds the max.");
-        return;
-    }
-
-    if ((nrow = MQI_SELECT(columns, screen->dbtbl, where, rows)) < 0) {
-        mrp_log_error("ivi-resource-manager: screen resource: "
-                      "DB select failed: %s", strerror(errno));
-        return;
-    }
-
-    if (nrow > ACTIVE_SCREEN_MAX) {
-        mrp_log_error("ivi-resource-manager: screen resource: "
-                      "DB select result is too large (%d). "
-                      "Will be truncated to %d", nrow, ACTIVE_SCREEN_MAX);
-        nrow = ACTIVE_SCREEN_MAX;
-    }
-
-    for (i = 0;  i < nrow;  i++) {
-        from = &rows[i];
-        to = &screen->actives[zone_id][i];
-
-        to->appid = mrp_strdup(from->appid);
-    }
-
-    screen->nactive[zone_id] = nrow;
-}
-
-
-static void screen_notify(mrp_resource_event_t event,
-                          mrp_zone_t *zone,
-                          mrp_application_class_t *ac,
-                          mrp_resource_t *res,
-                          void *userdata)
-{
-    mrp_resmgr_screen_t *screen = (mrp_resmgr_screen_t *)userdata;
-    const char *zone_name = mrp_zone_get_name(zone);
-    screen_resource_t *sr;
-
-    MRP_ASSERT(zone && ac && res && screen, "invalid argument");
-
-    switch (event) {
-
-    case MRP_RESOURCE_EVENT_CREATED:
-        mrp_log_info("screen resource in zone '%s' created", zone_name);
-        screen_resource_create(screen, zone, res, ac);
-        break;
-
-    case MRP_RESOURCE_EVENT_DESTROYED:
-        mrp_log_info("screen resource in zone '%s' destroyed", zone_name);
-        screen_resource_destroy(screen, zone, res);
-        break;
-
-    case MRP_RESOURCE_EVENT_ACQUIRE:
-        mrp_log_info("screen resource in zone '%s' is acquiring", zone_name);
-        if (!(sr = screen_resource_lookup(screen, res)))
-            goto no_screen_resource;
-        else {
-            sr->acquire = true;
-        }
-        break;
-
-    case MRP_RESOURCE_EVENT_RELEASE:
-        mrp_log_info("screen resource in zone '%s' is released", zone_name);
-        if (!(sr = screen_resource_lookup(screen, res)))
-            goto no_screen_resource;
-        else {
-            sr->acquire = false;
-        }
-        break;
-
-    no_screen_resource:
-        mrp_log_error("ivi-resource-manager: can't find screen resource "
-                      "in zone '%s'", zone_name);
-        break;
-
-    default:
-        mrp_log_error("ivi-resource-manager: invalid event %d at screen "
-                      "notification (zone '%s')", event, zone_name);
-        break;
-    }
-}
-
-static void screen_init(mrp_zone_t *zone, void *userdata)
-{
-    mrp_resmgr_screen_t *screen = (mrp_resmgr_screen_t *)userdata;
-    const char *zone_name = mrp_zone_get_name(zone);
-
-    MRP_ASSERT(screen, "invalid argument");
-
-    mrp_log_info("screen init in zone '%s'", zone_name);
-
-    get_active_screens(screen, zone);
-    screen_update_resources(screen, zone);
-
-    screen_grant_resources(screen, zone);
-}
-
-static bool screen_allocate(mrp_zone_t *zone,
-                            mrp_resource_t *res,
-                            void *userdata)
-{
-    mrp_resmgr_screen_t *screen = (mrp_resmgr_screen_t *)userdata;
-    uint32_t zoneid;
-    screen_resource_t *sr;
-    uint32_t grantid;
-
-    MRP_ASSERT(res && screen, "invalid argument");
-
-    zoneid  = mrp_zone_get_id(zone);
-
-    /* We got a nonsense zone id */
-    if (zoneid >= MRP_ZONE_MAX) {
-        mrp_debug("invalid zoneid '%" PRIu32 "' is larger than MRP_ZONE_MAX (%d), "
-                  "bailing", zoneid, MRP_ZONE_MAX);
-        return FALSE;
-    }
-
-    grantid = screen->grantids[zoneid];
-
-    if ((sr = screen_resource_lookup(screen, res))) {
-        return (sr->grantid == grantid);
-    }
-
-    mrp_log_error("ivi-resource-manager: attempt to allocate "
-                  "untracked resource");
-
-    return FALSE;
-}
-
-
-static void screen_free(mrp_zone_t *zone, mrp_resource_t *res, void *userdata)
-{
-    mrp_resmgr_screen_t *screen = (mrp_resmgr_screen_t *)userdata;
-    const char *zone_name = mrp_zone_get_name(zone);
-
-    MRP_UNUSED(res);
-
-    MRP_ASSERT(screen, "invalid argument");
-
-    mrp_log_info("screen free in zone '%s'", zone_name);
-}
-
-static bool screen_advice(mrp_zone_t *zone,mrp_resource_t *res,void *userdata)
-{
-    mrp_resmgr_screen_t *screen = (mrp_resmgr_screen_t *)userdata;
-    const char *zone_name = mrp_zone_get_name(zone);
-
-    MRP_UNUSED(res);
-
-    MRP_ASSERT(screen, "invalid argument");
-
-    mrp_log_info("screen advice in zone '%s'", zone_name);
-
-    return TRUE;
-}
-
-static void screen_commit(mrp_zone_t *zone, void *userdata)
-{
-    mrp_resmgr_screen_t *screen = (mrp_resmgr_screen_t *)userdata;
-    const char *zone_name = mrp_zone_get_name(zone);
-
-    MRP_ASSERT(screen, "invalid argument");
-
-    mrp_log_info("screen commit in zone '%s'", zone_name);
-}
-
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
- */
diff --git a/src/plugins/ivi-resource-manager/screen.h b/src/plugins/ivi-resource-manager/screen.h
deleted file mode 100644 (file)
index ea28f26..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2012, Intel Corporation
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *  * 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.
- *  * Neither the name of Intel Corporation nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#ifndef __MURPHY_IVI_RESOURCE_MANAGER_SCREEN_H__
-#define __MURPHY_IVI_RESOURCE_MANAGER_SCREEN_H__
-
-#include "plugin-ivi-resource-manager.h"
-
-mrp_resmgr_screen_t *mrp_resmgr_screen_create(mrp_resmgr_data_t *);
-void mrp_resmgr_screen_destroy(mrp_resmgr_screen_t *);
-
-int mrp_resmgr_screen_print(mrp_resmgr_screen_t *, uint32_t, char *, int);
-
-
-#endif  /* __MURPHY_IVI_RESOURCE_MANAGER_SCREEN_H__ */
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
- */