summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2013-08-29 03:54:38 (GMT)
committerSung-jae Park <nicesj.park@samsung.com>2013-08-29 03:54:38 (GMT)
commit774441774791fd145e9cdcdcf6b04bd078b757d1 (patch)
tree1c6fd25fa326f40c559c186edb355db4399738d8
parent938f4b79399cc004c1e02526a4a60f44f09dc4e7 (diff)
downloaddata-provider-master-774441774791fd145e9cdcdcf6b04bd078b757d1.zip
data-provider-master-774441774791fd145e9cdcdcf6b04bd078b757d1.tar.gz
data-provider-master-774441774791fd145e9cdcdcf6b04bd078b757d1.tar.bz2
Send delete type to service provider.
Change-Id: I97a84b69c0e04c9f6d75d48b2886d903a6194944
-rw-r--r--include/instance.h10
-rw-r--r--packaging/data-provider-master.spec2
-rw-r--r--src/instance.c42
-rw-r--r--src/package.c6
-rw-r--r--src/server.c6
-rw-r--r--src/setting.c2
6 files changed, 39 insertions, 29 deletions
diff --git a/include/instance.h b/include/instance.h
index 77a6971..32856d6 100644
--- a/include/instance.h
+++ b/include/instance.h
@@ -94,6 +94,14 @@ enum instance_event {
INSTNACE_EVENT_UNKNOWN
};
+enum instance_destroy_type {
+ INSTANCE_DESTROY_DEFAULT,
+ INSTANCE_DESTROY_PKGMGR,
+ INSTANCE_DESTROY_TERMINATE,
+ INSTANCE_DESTROY_FAULT,
+ INSTANCE_DESTROY_UNKNOWN,
+};
+
enum instance_state {
INST_INIT = 0x0, /*!< Only keeps in the master */
@@ -127,7 +135,7 @@ struct script_handle;
struct client_node;
extern struct inst_info *instance_create(struct client_node *client, double timestamp, const char *pkgname, const char *content, const char *cluster, const char *category, double period, int width, int height);
-extern int instance_destroy(struct inst_info *inst);
+extern int instance_destroy(struct inst_info *inst, enum instance_destroy_type type);
extern struct inst_info * instance_ref(struct inst_info *inst);
extern struct inst_info * instance_unref(struct inst_info *inst);
diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec
index 44afb4f..0d623a5 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.7
+Version: 0.25.8
Release: 1
Group: HomeTF/Livebox
License: Flora License
diff --git a/src/instance.c b/src/instance.c
index fde6a3d..02107be 100644
--- a/src/instance.c
+++ b/src/instance.c
@@ -93,6 +93,7 @@ struct inst_info {
enum instance_state state; /*!< Represents current state */
enum instance_state requested_state; /*!< Only ACTIVATED | DESTROYED is acceptable */
+ enum instance_destroy_type destroy_type;
int changing_state;
char *id;
@@ -213,7 +214,7 @@ static int viewer_deactivated_cb(struct client_node *client, void *data)
inst->client_list = eina_list_remove(inst->client_list, client);
if (!inst->client_list && !inst->client) {
DbgPrint("Has no clients\n");
- instance_destroy(inst);
+ instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
}
instance_unref(inst);
@@ -522,7 +523,7 @@ static int instance_broadcast_deleted_event(struct inst_info *inst)
static int client_deactivated_cb(struct client_node *client, void *data)
{
struct inst_info *inst = data;
- instance_destroy(inst);
+ instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
return LB_STATUS_SUCCESS;
}
@@ -805,7 +806,7 @@ HAPI struct inst_info *instance_create(struct client_node *client, double timest
if (package_add_instance(inst->info, inst) < 0) {
instance_state_reset(inst);
- instance_destroy(inst);
+ instance_destroy(inst, INSTANCE_DESTROY_FAULT);
return NULL;
}
@@ -813,7 +814,7 @@ HAPI struct inst_info *instance_create(struct client_node *client, double timest
if (instance_activate(inst) < 0) {
instance_state_reset(inst);
- instance_destroy(inst);
+ instance_destroy(inst, INSTANCE_DESTROY_FAULT);
inst = NULL;
}
@@ -906,7 +907,7 @@ static void deactivate_cb(struct slave_node *slave, const struct packet *packet,
info = inst->info;
instance_broadcast_deleted_event(inst);
instance_state_reset(inst);
- instance_destroy(inst);
+ instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
default:
/*!< Unable to reach here */
break;
@@ -941,7 +942,7 @@ static void deactivate_cb(struct slave_node *slave, const struct packet *packet,
info = inst->info;
instance_broadcast_deleted_event(inst);
instance_state_reset(inst);
- instance_destroy(inst);
+ instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
break;
}
@@ -1014,7 +1015,7 @@ static void reactivate_cb(struct slave_node *slave, const struct packet *packet,
inst->state = INST_ACTIVATED;
switch (inst->requested_state) {
case INST_DESTROYED:
- instance_destroy(inst);
+ instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
break;
case INST_ACTIVATED:
inst->is_pinned_up = is_pinned_up;
@@ -1103,7 +1104,7 @@ static void reactivate_cb(struct slave_node *slave, const struct packet *packet,
info = inst->info;
instance_broadcast_deleted_event(inst);
instance_state_reset(inst);
- instance_destroy(inst);
+ instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
break;
}
@@ -1175,7 +1176,7 @@ static void activate_cb(struct slave_node *slave, const struct packet *packet, v
case INST_DESTROYED:
instance_unicast_deleted_event(inst, NULL);
instance_state_reset(inst);
- instance_destroy(inst);
+ instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
break;
case INST_ACTIVATED:
default:
@@ -1229,7 +1230,7 @@ static void activate_cb(struct slave_node *slave, const struct packet *packet, v
default:
instance_unicast_deleted_event(inst, NULL);
instance_state_reset(inst);
- instance_destroy(inst);
+ instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
break;
}
@@ -1275,7 +1276,7 @@ HAPI int instance_create_lb_buffer(struct inst_info *inst)
return !!inst->lb.canvas.buffer;
}
-HAPI int instance_destroy(struct inst_info *inst)
+HAPI int instance_destroy(struct inst_info *inst, enum instance_destroy_type type)
{
struct packet *packet;
@@ -1302,12 +1303,13 @@ HAPI int instance_destroy(struct inst_info *inst)
break;
}
- packet = packet_create("delete", "ss", package_name(inst->info), inst->id);
+ 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_DESTROYED;
inst->state = INST_REQUEST_TO_DESTROY;
inst->changing_state = 1;
@@ -2653,7 +2655,7 @@ HAPI int instance_destroyed(struct inst_info *inst)
DbgPrint("Send deleted event - unicast - %p\n", inst->client);
instance_unicast_deleted_event(inst, NULL);
instance_state_reset(inst);
- instance_destroy(inst);
+ instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
break;
case INST_REQUEST_TO_REACTIVATE:
case INST_REQUEST_TO_DESTROY:
@@ -2661,7 +2663,7 @@ HAPI int instance_destroyed(struct inst_info *inst)
DbgPrint("Send deleted event - multicast\n");
instance_broadcast_deleted_event(inst);
instance_state_reset(inst);
- instance_destroy(inst);
+ instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
case INST_DESTROYED:
break;
default:
@@ -2697,7 +2699,7 @@ HAPI int instance_recover_state(struct inst_info *inst)
case INST_DESTROYED:
DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
instance_state_reset(inst);
- instance_destroy(inst);
+ instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
break;
default:
break;
@@ -2714,7 +2716,7 @@ HAPI int instance_recover_state(struct inst_info *inst)
DbgPrint("Failed to reactivate the instance\n");
instance_broadcast_deleted_event(inst);
instance_state_reset(inst);
- instance_destroy(inst);
+ instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
} else {
ret = 1;
}
@@ -2722,7 +2724,7 @@ HAPI int instance_recover_state(struct inst_info *inst)
case INST_DESTROYED:
DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
instance_state_reset(inst);
- instance_destroy(inst);
+ instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
ret = 1;
break;
default:
@@ -2761,7 +2763,7 @@ HAPI int instance_need_slave(struct inst_info *inst)
case INST_REQUEST_TO_DESTROY:
case INST_REQUEST_TO_ACTIVATE:
instance_state_reset(inst);
- instance_destroy(inst);
+ instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
break;
case INST_DESTROYED:
break;
@@ -2783,7 +2785,7 @@ HAPI int instance_need_slave(struct inst_info *inst)
case INST_DESTROYED:
DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
instance_state_reset(inst);
- instance_destroy(inst);
+ instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
break;
default:
break;
@@ -2800,7 +2802,7 @@ HAPI int instance_need_slave(struct inst_info *inst)
case INST_DESTROYED:
DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
instance_state_reset(inst);
- instance_destroy(inst);
+ instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
break;
default:
break;
diff --git a/src/package.c b/src/package.c
index bcfa278..fccd666 100644
--- a/src/package.c
+++ b/src/package.c
@@ -1264,7 +1264,7 @@ static int io_uninstall_cb(const char *pkgname, int prime, void *data)
*/
if (info->inst_list) {
EINA_LIST_FOREACH_SAFE(info->inst_list, l, n, inst) {
- instance_destroy(inst);
+ instance_destroy(inst, INSTANCE_DESTROY_PKGMGR);
}
} else {
package_destroy(info);
@@ -1285,7 +1285,7 @@ static inline void reload_package_info(struct pkg_info *info)
* Without "is_uninstalled", the package will be kept
*/
EINA_LIST_FOREACH_SAFE(info->inst_list, l, n, inst) {
- instance_destroy(inst);
+ instance_destroy(inst, INSTANCE_DESTROY_PKGMGR);
}
group_del_livebox(info->pkgname);
@@ -1416,7 +1416,7 @@ HAPI int package_fini(void)
EINA_LIST_FOREACH_SAFE(s_info.pkg_list, p_l, p_n, info) {
EINA_LIST_FOREACH_SAFE(info->inst_list, i_l, i_n, inst) {
instance_state_reset(inst);
- instance_destroy(inst);
+ instance_destroy(inst, INSTANCE_DESTROY_TERMINATE);
}
package_destroy(info);
diff --git a/src/server.c b/src/server.c
index 43421d7..b048f8f 100644
--- a/src/server.c
+++ b/src/server.c
@@ -784,7 +784,7 @@ static struct packet *client_delete(pid_t pid, int handle, const struct packet *
ret = LB_STATUS_ERROR_PERMISSION;
}
} else {
- ret = instance_destroy(inst);
+ ret = instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
}
out:
@@ -5357,7 +5357,7 @@ static struct packet *slave_faulted(pid_t pid, int handle, const struct packet *
} else if (instance_state(inst) == INST_DESTROYED) {
ErrPrint("Instance(%s) is already destroyed\n", id);
} else {
- ret = instance_destroy(inst);
+ ret = instance_destroy(inst, INSTANCE_DESTROY_FAULT);
}
out:
@@ -6570,7 +6570,7 @@ static struct packet *liveinfo_pkg_ctrl(pid_t pid, int handle, const struct pack
if (!inst) {
fprintf(fp, "%d\n", ENOENT);
} else {
- (void)instance_destroy(inst);
+ (void)instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
fprintf(fp, "%d\n", 0);
}
}
diff --git a/src/setting.c b/src/setting.c
index f8d41a5..4e6d1c6 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -203,7 +203,7 @@ static void ail_info_cb(keynode_t *node, void *user_data)
inst_list = package_instance_list(info);
EINA_LIST_FOREACH_SAFE(inst_list, j, n, inst) {
- instance_destroy(inst);
+ instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
}
}