summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2013-09-04 04:41:34 (GMT)
committerSung-jae Park <nicesj.park@samsung.com>2013-09-04 04:41:34 (GMT)
commit0402de6c194ca45b79077df5d8961b8f54202394 (patch)
tree72dff18f3efa49ccfb129eabd21a92cb9b2bc6d2
parent10fa9dd12b3632acdedd62c53274a764b9f56f58 (diff)
downloaddata-provider-master-0402de6c194ca45b79077df5d8961b8f54202394.zip
data-provider-master-0402de6c194ca45b79077df5d8961b8f54202394.tar.gz
data-provider-master-0402de6c194ca45b79077df5d8961b8f54202394.tar.bz2
Update image/desc filename management code.
Change-Id: I1387900fcd2819e86732075966f31895b00fa31c
-rw-r--r--include/instance.h3
-rw-r--r--include/script_handler.h2
-rw-r--r--include/util.h1
-rw-r--r--packaging/data-provider-master.spec2
-rw-r--r--src/instance.c18
-rw-r--r--src/script_handler.c16
-rw-r--r--src/server.c27
-rw-r--r--src/util.c37
8 files changed, 25 insertions, 81 deletions
diff --git a/include/instance.h b/include/instance.h
index 6bbf554..789960b 100644
--- a/include/instance.h
+++ b/include/instance.h
@@ -220,8 +220,7 @@ extern int instance_pd_update_begin(struct inst_info *inst);
extern int instance_pd_update_end(struct inst_info *inst);
extern void instance_pd_updated(const char *pkgname, const char *id, const char *descfile);
-extern void instance_lb_updated(const char *pkgname, const char *id);
-extern void instance_lb_updated_by_instance(struct inst_info *inst);
+extern void instance_lb_updated_by_instance(struct inst_info *inst, const char *safe_file);
extern void instance_pd_updated_by_instance(struct inst_info *inst, const char *descfile);
extern int instance_client_pd_destroyed(struct inst_info *inst, int status);
diff --git a/include/script_handler.h b/include/script_handler.h
index 1ebad1e..6a2195f 100644
--- a/include/script_handler.h
+++ b/include/script_handler.h
@@ -21,7 +21,7 @@ extern struct script_info *script_handler_create(struct inst_info *inst, const c
extern int script_handler_destroy(struct script_info *info);
extern struct fb_info *script_handler_fb(struct script_info *info);
extern void *script_handler_evas(struct script_info *info);
-extern int script_handler_parse_desc(const char *pkgname, const char *filename, const char *descfile, int is_pd);
+extern int script_handler_parse_desc(struct inst_info *inst, const char *descfile, int is_pd);
extern int script_handler_unload(struct script_info *info, int is_pd);
extern int script_handler_load(struct script_info *info, int is_pd);
extern int script_handler_is_loaded(struct script_info *info);
diff --git a/include/util.h b/include/util.h
index 180fffc..a43a462 100644
--- a/include/util.h
+++ b/include/util.h
@@ -27,7 +27,6 @@ extern char *util_replace_string(const char *src, const char *pattern, const cha
extern const char *util_uri_to_path(const char *uri);
extern void *util_timer_add(double interval, Eina_Bool (*cb)(void *data), void *data);
extern void util_timer_interval_set(void *timer, double interval);
-extern char *util_get_file_kept_in_safe(const char *id);
extern double util_time_delay_for_compensation(double period);
#define SCHEMA_FILE "file://"
diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec
index e363d0b..763504f 100644
--- a/packaging/data-provider-master.spec
+++ b/packaging/data-provider-master.spec
@@ -1,6 +1,6 @@
Name: data-provider-master
Summary: Master service provider for liveboxes.
-Version: 0.25.10
+Version: 0.25.11
Release: 1
Group: HomeTF/Livebox
License: Flora License
diff --git a/src/instance.c b/src/instance.c
index 5ae31aa..3bf9e84 100644
--- a/src/instance.c
+++ b/src/instance.c
@@ -1733,19 +1733,7 @@ HAPI int instance_pd_update_end(struct inst_info *inst)
return CLIENT_SEND_EVENT(inst, packet);
}
-HAPI void instance_lb_updated(const char *pkgname, const char *id)
-{
- struct inst_info *inst;
-
- inst = package_find_instance_by_id(pkgname, id);
- if (!inst) {
- return;
- }
-
- instance_lb_updated_by_instance(inst);
-}
-
-HAPI void instance_lb_updated_by_instance(struct inst_info *inst)
+HAPI void instance_lb_updated_by_instance(struct inst_info *inst, const char *safe_file)
{
struct packet *packet;
const char *id;
@@ -1782,9 +1770,9 @@ HAPI void instance_lb_updated_by_instance(struct inst_info *inst)
title = "";
}
- packet = packet_create_noack("lb_updated", "sssiidss",
+ packet = packet_create_noack("lb_updated", "sssiidsss",
package_name(inst->info), inst->id, id,
- inst->lb.width, inst->lb.height, inst->lb.priority, content, title);
+ inst->lb.width, inst->lb.height, inst->lb.priority, content, title, safe_file);
if (!packet) {
ErrPrint("Failed to create param (%s - %s)\n", package_name(inst->info), inst->id);
return;
diff --git a/src/script_handler.c b/src/script_handler.c
index b3fe0a7..0e04bda 100644
--- a/src/script_handler.c
+++ b/src/script_handler.c
@@ -200,7 +200,7 @@ static void render_post_cb(void *data, Evas *e, void *event_info)
info = instance_lb_script(inst);
if (info && script_handler_evas(info) == e) {
fb_sync(script_handler_fb(info));
- instance_lb_updated_by_instance(inst);
+ instance_lb_updated_by_instance(inst, NULL);
return;
}
@@ -839,9 +839,8 @@ free_out:
delete_block(block);
}
-HAPI int script_handler_parse_desc(const char *pkgname, const char *id, const char *descfile, int is_pd)
+HAPI int script_handler_parse_desc(struct inst_info *inst, const char *descfile, int is_pd)
{
- struct inst_info *inst;
FILE *fp;
int ch;
int lineno;
@@ -873,14 +872,7 @@ HAPI int script_handler_parse_desc(const char *pkgname, const char *id, const ch
enum state state;
register int field_idx;
register int idx = 0;
- struct block *block;
-
- block = NULL;
- inst = package_find_instance_by_id(pkgname, id);
- if (!inst) {
- ErrPrint("Instance is not exists\n");
- return LB_STATUS_ERROR_NOT_EXIST;
- }
+ struct block *block = NULL;
fp = fopen(descfile, "rt");
if (!fp) {
@@ -1223,7 +1215,7 @@ HAPI int script_handler_parse_desc(const char *pkgname, const char *id, const ch
break;
case BLOCK_CLOSE:
if (!block->file) {
- block->file = strdup(util_uri_to_path(id));
+ block->file = strdup(util_uri_to_path(instance_id(inst)));
if (!block->file) {
ErrPrint("Heap: %s\n", strerror(errno));
goto errout;
diff --git a/src/server.c b/src/server.c
index 1d09231..e4e4668 100644
--- a/src/server.c
+++ b/src/server.c
@@ -5639,6 +5639,7 @@ static struct packet *slave_updated(pid_t pid, int handle, const struct packet *
{
struct slave_node *slave;
const char *pkgname;
+ const char *safe_filename;
const char *id;
const char *content_info;
const char *title;
@@ -5654,18 +5655,17 @@ static struct packet *slave_updated(pid_t pid, int handle, const struct packet *
goto out;
}
- ret = packet_get(packet, "ssiidss", &pkgname, &id,
+ ret = packet_get(packet, "ssiidsss", &pkgname, &id,
&w, &h, &priority,
- &content_info, &title);
- if (ret != 7) {
+ &content_info, &title,
+ &safe_filename);
+ if (ret != 8) {
ErrPrint("Parameter is not matched\n");
goto out;
}
ret = validate_request(pkgname, id, &inst, NULL);
if (ret == LB_STATUS_SUCCESS) {
- char *filename;
-
if (instance_state(inst) == INST_DESTROYED) {
ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
goto out;
@@ -5676,12 +5676,15 @@ static struct packet *slave_updated(pid_t pid, int handle, const struct packet *
switch (package_lb_type(instance_package(inst))) {
case LB_TYPE_SCRIPT:
script_handler_resize(instance_lb_script(inst), w, h);
- filename = util_get_file_kept_in_safe(id);
- if (filename) {
- (void)script_handler_parse_desc(pkgname, id, filename, 0);
- DbgFree(filename);
+ if (safe_filename) {
+ (void)script_handler_parse_desc(inst, safe_filename, 0);
} else {
- (void)script_handler_parse_desc(pkgname, id, util_uri_to_path(id), 0);
+ safe_filename = util_uri_to_path(id);
+ (void)script_handler_parse_desc(inst, safe_filename, 0);
+ }
+
+ if (unlink(safe_filename) < 0) {
+ ErrPrint("unlink: %s - %s\n", strerror(errno), safe_filename);
}
break;
case LB_TYPE_BUFFER:
@@ -5691,7 +5694,7 @@ static struct packet *slave_updated(pid_t pid, int handle, const struct packet *
* text format (inst)
*/
instance_set_lb_size(inst, w, h);
- instance_lb_updated_by_instance(inst);
+ instance_lb_updated_by_instance(inst, safe_filename);
break;
}
@@ -5770,7 +5773,7 @@ static struct packet *slave_desc_updated(pid_t pid, int handle, const struct pac
switch (package_pd_type(instance_package(inst))) {
case PD_TYPE_SCRIPT:
if (script_handler_is_loaded(instance_pd_script(inst))) {
- (void)script_handler_parse_desc(pkgname, id, descfile, 1);
+ (void)script_handler_parse_desc(inst, descfile, 1);
}
break;
case PD_TYPE_TEXT:
diff --git a/src/util.c b/src/util.c
index 63b41a8..fb86297 100644
--- a/src/util.c
+++ b/src/util.c
@@ -409,43 +409,6 @@ HAPI void util_timer_interval_set(void *timer, double interval)
ecore_timer_delay(timer, delay);
}
-HAPI char *util_get_file_kept_in_safe(const char *id)
-{
- const char *path;
- char *new_path;
- int len;
- int base_idx;
-
- path = util_uri_to_path(id);
- if (!path) {
- ErrPrint("Invalid URI(%s)\n", id);
- return NULL;
- }
-
- /*!
- * TODO: Remove me
- */
- if (OVERWRITE_CONTENT) {
- return strdup(path);
- }
-
- len = strlen(path);
- base_idx = len - 1;
-
- while (base_idx > 0 && path[base_idx] != '/') base_idx--;
- base_idx += (path[base_idx] == '/');
-
- new_path = malloc(len + 10);
- if (!new_path) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return NULL;
- }
-
- strncpy(new_path, path, base_idx);
- snprintf(new_path + base_idx, len + 10 - base_idx, "reader/%s", path + base_idx);
- return new_path;
-}
-
HAPI int util_unlink_files(const char *folder)
{
struct stat info;