struct buffer_info *buffer;
} canvas;
- const char *auto_launch;
- int timeout;
double period;
} lb;
inst->pd.width, inst->pd.height,
inst->cluster, inst->category,
lb_file, pd_file,
- inst->lb.auto_launch,
+ package_auto_launch(inst->info),
inst->lb.priority,
package_size_list(inst->info),
!!inst->client,
inst->pd.width, inst->pd.height,
inst->cluster, inst->category,
lb_file, pd_file,
- inst->lb.auto_launch,
+ package_auto_launch(inst->info),
inst->lb.priority,
package_size_list(inst->info),
!!inst->client,
DbgFree(tag_item);
}
- /*!
- * \note
- *
- * inst->lb.auto_launch
- *
- * will be released by the package object
- * it is readonly value for instances
- */
EINA_LIST_FREE(inst->delete_event_list, item) {
DbgFree(item);
}
}
snprintf(inst->id, len, SCHEMA_FILE "%s%s_%d_%lf.png", IMAGE_PATH, package_name(info), client_pid(inst->client), inst->timestamp);
- inst->lb.auto_launch = package_auto_launch(info);
instance_set_pd_size(inst, package_pd_width(info), package_pd_height(info));
- inst->lb.timeout = package_timeout(info);
inst->lb.period = package_period(info);
inst->info = info;
* The instance_reload will care this.
* And it will be called from the slave activate callback.
*/
- inst->changing_state = 0;
- instance_unref(inst);
- return;
+ goto out;
}
if (packet_get(packet, "i", &ret) != 1) {
ErrPrint("Invalid argument\n");
- inst->changing_state = 0;
- instance_unref(inst);
- return;
+ goto out;
}
if (inst->state == INST_DESTROYED) {
* Already destroyed.
* Do nothing at here anymore.
*/
- inst->changing_state = 0;
- instance_unref(inst);
- return;
+ goto out;
}
switch (ret) {
break;
}
+out:
inst->changing_state = 0;
instance_unref(inst);
}
return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, deactivate_cb, instance_ref(inst), 0);
}
+HAPI int instance_reload(struct inst_info *inst, enum instance_destroy_type type)
+{
+ struct packet *packet;
+ int ret;
+
+ DbgPrint("Reload instance (%s)\n", instance_id(inst));
+
+ if (!inst) {
+ ErrPrint("Invalid instance handle\n");
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ switch (inst->state) {
+ case INST_REQUEST_TO_ACTIVATE:
+ case INST_REQUEST_TO_REACTIVATE:
+ return LB_STATUS_SUCCESS;
+ case INST_INIT:
+ ret = instance_activate(inst);
+ if (ret < 0) {
+ ErrPrint("Failed to activate instance: %d (%s)\n", ret, instance_id(inst));
+ }
+ return LB_STATUS_SUCCESS;
+ case INST_DESTROYED:
+ case INST_REQUEST_TO_DESTROY:
+ DbgPrint("Instance is destroying now\n");
+ return LB_STATUS_SUCCESS;
+ default:
+ break;
+ }
+
+ packet = packet_create("delete", "ssi", package_name(inst->info), inst->id, type);
+ if (!packet) {
+ ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ inst->destroy_type = type;
+ inst->requested_state = INST_ACTIVATED;
+ inst->state = INST_REQUEST_TO_DESTROY;
+ inst->changing_state = 1;
+ return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, deactivate_cb, instance_ref(inst), 0);
+}
+
/* Client Deactivated Callback */
static int pd_buffer_close_cb(struct client_node *client, void *inst)
{
package_name(inst->info),
inst->id,
inst->content,
- inst->lb.timeout,
+ package_timeout(inst->info),
!!package_lb_path(inst->info),
inst->lb.period,
inst->cluster,
package_name(inst->info),
inst->id,
inst->content,
- inst->lb.timeout,
+ package_timeout(inst->info),
!!package_lb_path(inst->info),
inst->lb.period,
inst->cluster,
HAPI const char * const instance_auto_launch(const struct inst_info *inst)
{
- return inst->lb.auto_launch;
+ return package_auto_launch(inst->info);
}
HAPI const int const instance_priority(const struct inst_info *inst)
HAPI const int const instance_timeout(const struct inst_info *inst)
{
- return inst->lb.timeout;
+ return package_timeout(inst->info);
}
HAPI const double const instance_period(const struct inst_info *inst)
return LB_STATUS_SUCCESS;
}
-HAPI int io_is_exists(const char *pkgname) /* Manifest Package Name */
+HAPI int io_is_exists(const char *lbid)
{
sqlite3_stmt *stmt;
int ret;
return LB_STATUS_ERROR_IO;
}
- ret = sqlite3_prepare_v2(s_info.handle, "SELECT COUNT(pkgid) FROM pkgmap WHERE appid = ?", -1, &stmt, NULL);
+ ret = sqlite3_prepare_v2(s_info.handle, "SELECT COUNT(pkgid) FROM pkgmap WHERE pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
return LB_STATUS_ERROR_IO;
}
- ret = sqlite3_bind_text(stmt, 1, pkgname, -1, SQLITE_TRANSIENT);
+ ret = sqlite3_bind_text(stmt, 1, lbid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
ret = LB_STATUS_ERROR_IO;
}
if (sqlite3_step(stmt) != SQLITE_ROW) {
- ErrPrint("%s has no record (%s)\n", pkgname, sqlite3_errmsg(s_info.handle));
+ ErrPrint("%s has no record (%s)\n", lbid, sqlite3_errmsg(s_info.handle));
ret = LB_STATUS_ERROR_IO;
goto out;
}
return pkgid;
}
-HAPI int io_crawling_liveboxes(int (*cb)(const char *pkgname, int prime, void *data), void *data)
+HAPI int io_crawling_liveboxes(int (*cb)(const char *pkgid, const char *lbid, int prime, void *data), void *data)
{
DIR *dir;
int ret;
sqlite3_stmt *stmt;
- ret = sqlite3_prepare_v2(s_info.handle, "SELECT pkgid, prime FROM pkgmap", -1, &stmt, NULL);
+ ret = sqlite3_prepare_v2(s_info.handle, "SELECT appid, pkgid, prime FROM pkgmap", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
} else {
+ const char *lbid;
const char *pkgid;
int prime;
continue;
}
+ lbid = (const char *)sqlite3_column_text(stmt, 1);
+ if (!lbid || !strlen(lbid)) {
+ continue;
+ }
+
prime = (int)sqlite3_column_int(stmt, 1);
- if (cb(pkgid, prime, data) < 0) {
+
+ if (cb(pkgid, lbid, prime, data) < 0) {
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
return LB_STATUS_ERROR_CANCEL;
continue;
}
- if (cb(ent->d_name, -1, data) < 0) {
+ if (cb(ent->d_name, ent->d_name, -2, data) < 0) {
if (closedir(dir) < 0) {
ErrPrint("closedir: %s\n", strerror(errno));
}
return LB_STATUS_SUCCESS;
}
-HAPI int io_update_livebox_package(const char *pkgname, int (*cb)(const char *lb_pkgname, int prime, void *data), void *data)
+HAPI int io_update_livebox_package(const char *pkgid, int (*cb)(const char *pkgid, const char *lbid, int prime, void *data), void *data)
{
sqlite3_stmt *stmt;
- char *pkgid;
+ char *lbid;
int prime;
int ret;
- if (!cb || !pkgname) {
+ if (!cb || !pkgid) {
return LB_STATUS_ERROR_INVALID;
}
return LB_STATUS_ERROR_FAULT;
}
- ret = sqlite3_bind_text(stmt, 1, pkgname, -1, SQLITE_TRANSIENT);
+ ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
ret = LB_STATUS_ERROR_FAULT;
ret = 0;
while (sqlite3_step(stmt) == SQLITE_ROW) {
- pkgid = (char *)sqlite3_column_text(stmt, 0);
- if (!pkgid || !strlen(pkgid)) {
+ lbid = (char *)sqlite3_column_text(stmt, 0);
+ if (!lbid || !strlen(lbid)) {
continue;
}
prime = sqlite3_column_int(stmt, 1);
- if (cb(pkgid, prime, data) < 0) {
+ if (cb(pkgid, lbid, prime, data) < 0) {
DbgPrint("Callback canceled\n");
break;
}
#include <packet.h>
#include <livebox-errno.h>
+#include <livebox-service.h>
#include <ail.h>
#include "critical_log.h"
*/
struct pkg_info {
- char *pkgname;
+ char *pkgid;
+ char *lbid;
struct {
enum lb_type type;
/* This items will be deleted from group_del_livebox */
}
- group_del_livebox(info->pkgname);
+ group_del_livebox(info->lbid);
package_clear_fault(info);
s_info.pkg_list = eina_list_remove(s_info.pkg_list, info);
DbgFree(info->script);
DbgFree(info->abi);
- DbgFree(info->pkgname);
+ DbgFree(info->lbid);
DbgFree(info->lb.libexec);
DbgFree(info->lb.auto_launch);
+ DbgFree(info->pkgid);
DbgFree(info);
}
const char *str;
const char *group;
- parser = parser_load(info->pkgname);
+ parser = parser_load(info->lbid);
if (!parser) {
info->lb.size_list = 0x01; /* Default */
parser_get_pdsize(parser, &info->pd.width, &info->pd.height);
group = parser_group_str(parser);
- if (group && group_add_livebox(group, info->pkgname) < 0) {
- ErrPrint("Failed to build cluster tree for %s{%s}\n", info->pkgname, group);
+ if (group && group_add_livebox(group, info->lbid) < 0) {
+ ErrPrint("Failed to build cluster tree for %s{%s}\n", info->lbid, group);
}
parser_unload(parser);
return LB_STATUS_SUCCESS;
}
-HAPI struct pkg_info *package_create(const char *pkgname)
+HAPI struct pkg_info *package_create(const char *pkgid, const char *lbid)
{
struct pkg_info *pkginfo;
return NULL;
}
- pkginfo->pkgname = io_livebox_pkgname(pkgname);
- if (!pkginfo->pkgname) {
+ pkginfo->pkgid = strdup(pkgid);
+ if (!pkginfo->pkgid) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ DbgFree(pkginfo);
+ return NULL;
+ }
+
+ pkginfo->lbid = io_livebox_pkgname(lbid);
+ if (!pkginfo->lbid) {
ErrPrint("Failed to get pkgname, fallback to fs checker\n");
- if (util_validate_livebox_package(pkgname) < 0) {
- ErrPrint("Invalid package name: %s\n", pkgname);
+ if (util_validate_livebox_package(lbid) < 0) {
+ ErrPrint("Invalid package name: %s\n", lbid);
+ DbgFree(pkginfo->pkgid);
DbgFree(pkginfo);
return NULL;
}
- pkginfo->pkgname = strdup(pkgname);
- if (!pkginfo->pkgname) {
+ pkginfo->lbid = strdup(lbid);
+ if (!pkginfo->lbid) {
ErrPrint("Heap: %s\n", strerror(errno));
+ DbgFree(pkginfo->pkgid);
DbgFree(pkginfo);
return NULL;
}
ErrPrint("Failed to load DB, fall back to conf file loader\n");
if (load_conf(pkginfo) < 0) {
ErrPrint("Failed to initiate the conf file loader\n");
- DbgFree(pkginfo->pkgname);
+ DbgFree(pkginfo->lbid);
+ DbgFree(pkginfo->pkgid);
DbgFree(pkginfo);
return NULL;
}
HAPI char *package_lb_pkgname(const char *pkgname)
{
- char *lb_pkgname;
+ char *lbid;
- lb_pkgname = io_livebox_pkgname(pkgname);
- if (!lb_pkgname) {
+ lbid = io_livebox_pkgname(pkgname);
+ if (!lbid) {
if (util_validate_livebox_package(pkgname) < 0) {
return NULL;
}
- lb_pkgname = strdup(pkgname);
- if (!lb_pkgname) {
+ lbid = strdup(pkgname);
+ if (!lbid) {
ErrPrint("Heap: %s\n", strerror(errno));
return NULL;
}
}
- return lb_pkgname;
+ return lbid;
}
HAPI int package_is_lb_pkgname(const char *pkgname)
{
- char *lb_pkgname;
+ char *lbid;
int ret;
- lb_pkgname = package_lb_pkgname(pkgname);
- ret = !!lb_pkgname;
- DbgFree(lb_pkgname);
+ lbid = package_lb_pkgname(pkgname);
+ ret = !!lbid;
+ DbgFree(lbid);
return ret;
}
-HAPI struct pkg_info *package_find(const char *pkgname)
+HAPI struct pkg_info *package_find(const char *lbid)
{
Eina_List *l;
struct pkg_info *info;
- if (!pkgname) {
+ if (!lbid) {
return NULL;
}
EINA_LIST_FOREACH(s_info.pkg_list, l, info) {
- if (!strcmp(info->pkgname, pkgname)) {
+ if (!strcmp(info->lbid, lbid)) {
return info;
}
}
return NULL;
}
-HAPI struct inst_info *package_find_instance_by_id(const char *pkgname, const char *id)
+HAPI struct inst_info *package_find_instance_by_id(const char *lbid, const char *id)
{
Eina_List *l;
struct inst_info *inst;
struct pkg_info *info;
- info = package_find(pkgname);
+ info = package_find(lbid);
if (!info) {
- ErrPrint("Package %s is not exists\n", pkgname);
+ ErrPrint("Package %s is not exists\n", lbid);
return NULL;
}
return NULL;
}
-HAPI struct inst_info *package_find_instance_by_timestamp(const char *pkgname, double timestamp)
+HAPI struct inst_info *package_find_instance_by_timestamp(const char *lbid, double timestamp)
{
Eina_List *l;
struct inst_info *inst;
struct pkg_info *info;
- info = package_find(pkgname);
+ info = package_find(lbid);
if (!info) {
- ErrPrint("Package %s is not exists\n", pkgname);
+ ErrPrint("Package %s is not exists\n", lbid);
return NULL;
}
CRITICAL_LOG("=============\n");
CRITICAL_LOG("faulted at %lf\n", info->fault_info->timestamp);
- CRITICAL_LOG("Package: %s\n", info->pkgname);
+ CRITICAL_LOG("Package: %s\n", info->lbid);
CRITICAL_LOG("Function: %s\n", info->fault_info->function);
CRITICAL_LOG("InstanceID: %s\n", info->fault_info->filename);
return LB_STATUS_SUCCESS;
return LB_STATUS_ERROR_INVALID;
}
- s_pkgname = util_replace_string(tmp, REPLACE_TAG_APPID, info->pkgname);
+ s_pkgname = util_replace_string(tmp, REPLACE_TAG_APPID, info->lbid);
if (!s_pkgname) {
DbgPrint("Failed to get replaced string\n");
s_pkgname = strdup(tmp);
}
}
- DbgPrint("New slave[%s] is assigned for %s (using %s / abi[%s])\n", s_name, info->pkgname, s_pkgname, info->abi);
+ DbgPrint("New slave[%s] is assigned for %s (using %s / abi[%s])\n", s_name, info->lbid, s_pkgname, info->abi);
info->slave = slave_create(s_name, info->secured, info->abi, s_pkgname, info->network);
DbgFree(s_name);
return ret;
}
} else {
- DbgPrint("Slave %s is used for %s\n", slave_name(info->slave), info->pkgname);
+ DbgPrint("Slave %s is used for %s\n", slave_name(info->slave), info->lbid);
}
slave_ref(info->slave);
EINA_LIST_FOREACH(s_info.pkg_list, l, info) {
if (info->fault_info) {
- fault_unicast_info(client, info->pkgname, info->fault_info->filename, info->fault_info->function);
+ fault_unicast_info(client, info->lbid, info->fault_info->filename, info->fault_info->function);
continue;
}
*/
if (client_is_subscribed(client, instance_cluster(inst), instance_category(inst))) {
instance_unicast_created_event(inst, client);
- DbgPrint("(Subscribed) Created package: %s\n", info->pkgname);
+ DbgPrint("(Subscribed) Created package: %s\n", info->lbid);
}
}
return 0;
}
-static int io_uninstall_cb(const char *pkgname, int prime, void *data)
+static int io_uninstall_cb(const char *pkgid, const char *lbid, int prime, void *data)
{
struct pkg_info *info;
Eina_List *l;
Eina_List *n;
struct inst_info *inst;
- DbgPrint("Package %s is uninstalled\n", pkgname);
- info = package_find(pkgname);
+ DbgPrint("Package %s is uninstalled\n", lbid);
+ info = package_find(lbid);
if (!info) {
- DbgPrint("%s is not yet loaded\n", pkgname);
+ DbgPrint("%s is not yet loaded\n", lbid);
return 0;
}
Eina_List *l;
Eina_List *n;
struct inst_info *inst;
+ unsigned int size_type;
+ int width;
+ int height;
DbgPrint("Already exists, try to update it\n");
- /*!
- * \note
- * Without "is_uninstalled", the package will be kept
- */
- EINA_LIST_FOREACH_SAFE(info->inst_list, l, n, inst) {
- instance_destroy(inst, INSTANCE_DESTROY_PKGMGR);
- }
- group_del_livebox(info->pkgname);
+ group_del_livebox(info->lbid);
package_clear_fault(info);
/*!
* Nested DB I/O
*/
io_load_package_db(info);
+
+ /*!
+ * \note
+ * Without "is_uninstalled", the package will be kept
+ */
+ EINA_LIST_FOREACH_SAFE(info->inst_list, l, n, inst) {
+ width = instance_lb_width(inst);
+ height = instance_lb_height(inst);
+ size_type = livebox_service_size_type(width, height);
+ if (info->lb.size_list & size_type) {
+ instance_reload(inst, INSTANCE_DESTROY_PKGMGR);
+ } else {
+ instance_destroy(inst, INSTANCE_DESTROY_PKGMGR);
+ }
+ }
}
-static int io_install_cb(const char *pkgname, int prime, void *data)
+static int io_install_cb(const char *pkgid, const char *lbid, int prime, void *data)
{
struct pkg_info *info;
- DbgPrint("Livebox package %s is installed\n", pkgname);
- info = package_find(pkgname);
+ info = package_find(lbid);
if (info) {
- reload_package_info(info);
+ /*!
+ * Already exists. skip to create this.
+ */
+ return 0;
+ }
+
+ info = package_create(pkgid, lbid);
+ if (!info) {
+ ErrPrint("Failed to build an info %s\n", lbid);
} else {
- info = package_create(pkgname);
- if (!info) {
- ErrPrint("Failed to build an info: %s\n", pkgname);
- } else {
- DbgPrint("Package %s is built\n", pkgname);
- }
+ DbgPrint("Livebox %s is built\n", lbid);
}
return 0;
}
-static int install_cb(const char *pkgname, enum pkgmgr_status status, double value, void *data)
+static int uninstall_cb(const char *pkgname, enum pkgmgr_status status, double value, void *data)
{
- int ret;
+ Eina_List *l;
+ Eina_List *n;
+ struct pkg_info *info;
if (status != PKGMGR_STATUS_END) {
return 0;
}
- ret = io_update_livebox_package(pkgname, io_install_cb, NULL);
- return 0;
-}
-
-static int uninstall_cb(const char *pkgname, enum pkgmgr_status status, double value, void *data)
-{
- int ret;
-
- if (status == PKGMGR_STATUS_START) {
- ret = io_update_livebox_package(pkgname, io_uninstall_cb, NULL);
- if (ret == 0) {
- /*! for keeping the old style */
- (void)io_uninstall_cb(pkgname, -1, NULL);
+ EINA_LIST_FOREACH_SAFE(s_info.pkg_list, l, n, info) {
+ if (!strcmp(info->pkgid, pkgname)) {
+ io_uninstall_cb(pkgname, info->lbid, -1, NULL);
}
}
return 0;
}
-static int io_update_cb(const char *pkgname, int prime, void *data)
+static int update_cb(const char *pkgname, enum pkgmgr_status status, double value, void *data)
{
+ Eina_List *l;
+ Eina_List *n;
struct pkg_info *info;
- DbgPrint("Livebox package %s is updated\n", pkgname);
- info = package_find(pkgname);
- if (!info) {
+ if (status != PKGMGR_STATUS_END) {
return 0;
}
- reload_package_info(info);
- return 0;
-}
-
-static int update_cb(const char *pkgname, enum pkgmgr_status status, double value, void *data)
-{
- int ret;
- if (status != PKGMGR_STATUS_END) {
- return 0;
+ EINA_LIST_FOREACH_SAFE(s_info.pkg_list, l, n, info) {
+ if (!strcmp(info->pkgid, pkgname)) {
+ DbgPrint("Update lbid: %s\n", info->lbid);
+ if (io_is_exists(info->lbid) == 1) {
+ reload_package_info(info);
+ } else {
+ io_uninstall_cb(pkgname, info->lbid, -1, NULL);
+ }
+ }
}
- ret = io_update_livebox_package(pkgname, io_update_cb, NULL);
+ (void)io_update_livebox_package(pkgname, io_install_cb, NULL);
return 0;
}
-static int crawling_liveboxes(const char *pkgname, int prime, void *data)
+static int crawling_liveboxes(const char *pkgid, const char *lbid, int prime, void *data)
{
- if (package_find(pkgname)) {
- ErrPrint("Information of %s is already built\n", pkgname);
+ if (package_find(lbid)) {
+ ErrPrint("Information of %s is already built\n", lbid);
} else {
struct pkg_info *info;
- info = package_create(pkgname);
+ info = package_create(pkgid, lbid);
if (info) {
- DbgPrint("[%s] information is built prime(%d)\n", pkgname, prime);
+ DbgPrint("[%s] information is built prime(%d)\n", lbid, prime);
}
}
client_global_event_handler_add(CLIENT_GLOBAL_EVENT_CREATE, client_created_cb, NULL);
pkgmgr_init();
- pkgmgr_add_event_callback(PKGMGR_EVENT_INSTALL, install_cb, NULL);
+ pkgmgr_add_event_callback(PKGMGR_EVENT_INSTALL, update_cb, NULL);
pkgmgr_add_event_callback(PKGMGR_EVENT_UNINSTALL, uninstall_cb, NULL);
pkgmgr_add_event_callback(PKGMGR_EVENT_UPDATE, update_cb, NULL);
struct pkg_info *info;
struct inst_info *inst;
- pkgmgr_del_event_callback(PKGMGR_EVENT_INSTALL, install_cb, NULL);
+ pkgmgr_del_event_callback(PKGMGR_EVENT_INSTALL, update_cb, NULL);
pkgmgr_del_event_callback(PKGMGR_EVENT_UNINSTALL, uninstall_cb, NULL);
pkgmgr_del_event_callback(PKGMGR_EVENT_UPDATE, update_cb, NULL);
pkgmgr_fini();
EINA_LIST_FOREACH(s_info.pkg_list, l, info) {
if (info->slave == slave) {
- return info->pkgname;
+ return info->lbid;
}
}
HAPI const char * const package_name(const struct pkg_info *info)
{
- return info->pkgname;
+ return info->lbid;
}
/*!
if (!instance_has_client(inst, client)) {
instance_unicast_created_event(inst, client);
instance_add_client(inst, client);
- DbgPrint("(Subscribed) Created package: %s\n", info->pkgname);
+ DbgPrint("(Subscribed) Created package: %s\n", info->lbid);
}
break;
case ALTER_DESTROY:
struct pkg_info *info;
int width;
int height;
- char *lb_pkgname;
+ char *lbid;
char *mainappid;
client = client_find_by_rpc_handle(handle);
DbgPrint("pid[%d] period[%lf] pkgname[%s] content[%s] cluster[%s] category[%s] period[%lf]\n",
pid, timestamp, pkgname, content, cluster, category, period);
- lb_pkgname = package_lb_pkgname(pkgname);
- if (!lb_pkgname) {
+ lbid = package_lb_pkgname(pkgname);
+ if (!lbid) {
ErrPrint("This %s has no livebox package\n", pkgname);
ret = LB_STATUS_ERROR_INVALID;
goto out;
}
- mainappid = livebox_service_mainappid(lb_pkgname);
+ mainappid = livebox_service_mainappid(lbid);
if (!package_is_enabled(mainappid)) {
DbgFree(mainappid);
- DbgFree(lb_pkgname);
+ DbgFree(lbid);
ret = LB_STATUS_ERROR_DISABLED;
goto out;
}
DbgFree(mainappid);
- info = package_find(lb_pkgname);
+ info = package_find(lbid);
if (!info) {
- info = package_create(lb_pkgname);
+ char *pkgid;
+ pkgid = livebox_service_appid(lbid);
+ if (!pkgid) {
+ DbgFree(mainappid);
+ DbgFree(lbid);
+ ret = LB_STATUS_ERROR_FAULT;
+ goto out;
+ }
+
+ info = package_create(pkgid, lbid);
+ DbgFree(pkgid);
}
if (!info) {
period = MINIMUM_PERIOD;
}
- inst = instance_create(client, timestamp, lb_pkgname, content, cluster, category, period, width, height);
+ inst = instance_create(client, timestamp, lbid, content, cluster, category, period, width, height);
/*!
* \note
* Using the "inst" without validate its value is at my disposal. ;)
ret = inst ? 0 : LB_STATUS_ERROR_FAULT;
}
- DbgFree(lb_pkgname);
+ DbgFree(lbid);
out:
result = packet_create_reply(packet, "i", ret);
const char *id;
const char *cluster;
const char *category;
- char *lb_pkgname;
+ char *lbid;
int ret;
ret = packet_get(packet, "ssss", &pkgname, &id, &cluster, &category);
goto out;
}
- lb_pkgname = package_lb_pkgname(pkgname);
- if (!lb_pkgname) {
+ lbid = package_lb_pkgname(pkgname);
+ if (!lbid) {
ErrPrint("Invalid package %s\n", pkgname);
ret = LB_STATUS_ERROR_INVALID;
goto out;
}
- pkg = package_find(lb_pkgname);
+ pkg = package_find(lbid);
if (!pkg) {
ret = LB_STATUS_ERROR_NOT_EXIST;
- DbgFree(lb_pkgname);
+ DbgFree(lbid);
goto out;
}
if (package_is_fault(pkg)) {
ret = LB_STATUS_ERROR_FAULT;
- DbgFree(lb_pkgname);
+ DbgFree(lbid);
goto out;
}
inst_list = package_instance_list(pkg);
if (!eina_list_count(inst_list)) {
ret = LB_STATUS_ERROR_NOT_EXIST;
- DbgFree(lb_pkgname);
+ DbgFree(lbid);
goto out;
}
}
if (ret == LB_STATUS_ERROR_NOT_EXIST) {
- DbgFree(lb_pkgname);
+ DbgFree(lbid);
goto out;
}
}
* \TODO
* Validate the update requstor.
*/
- slave_rpc_request_update(lb_pkgname, id, cluster, category);
- DbgFree(lb_pkgname);
+ slave_rpc_request_update(lbid, id, cluster, category);
+ DbgFree(lbid);
ret = LB_STATUS_SUCCESS;
out: