diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2012-11-01 12:40:36 +0100 |
---|---|---|
committer | Paul Kocialkowski <contact@paulk.fr> | 2012-11-01 12:40:36 +0100 |
commit | 1d47003d41e5c2a84c831b32a345ae3c6bbfa6f1 (patch) | |
tree | 164fbd51f937f62cab5e212674cd16fa223286d8 /ipc.c | |
parent | afb3c6b921053af7d92701f3580be6c04a337990 (diff) | |
download | hardware_ril_samsung-ril-1d47003d41e5c2a84c831b32a345ae3c6bbfa6f1.zip hardware_ril_samsung-ril-1d47003d41e5c2a84c831b32a345ae3c6bbfa6f1.tar.gz hardware_ril_samsung-ril-1d47003d41e5c2a84c831b32a345ae3c6bbfa6f1.tar.bz2 |
Reworked RIL requests, globals, SIM status, client
* Handling ril requests with lists
* Renamed functions to complete requests
* Globals (most of them) are held in ril_data
* Renamed SIM_Status to ril_sim_state
* Renamed client object to data
* Moved client funcs to a sub-structure
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'ipc.c')
-rw-r--r-- | ipc.c | 92 |
1 files changed, 46 insertions, 46 deletions
@@ -42,21 +42,21 @@ void ipc_fmt_send(const unsigned short command, const char type, unsigned char * { struct ipc_client *ipc_client; - if(ipc_fmt_client == NULL) { + if(ril_data.ipc_fmt_client == NULL) { LOGE("ipc_fmt_client is null, aborting!"); return; } - if(ipc_fmt_client->object == NULL) { - LOGE("ipc_fmt_client object is null, aborting!"); + if(ril_data.ipc_fmt_client->data == NULL) { + LOGE("ipc_fmt_client data is null, aborting!"); return; } - ipc_client = ((struct ipc_client_object *) ipc_fmt_client->object)->ipc_client; + ipc_client = ((struct ipc_client_data *) ril_data.ipc_fmt_client->data)->ipc_client; - RIL_CLIENT_LOCK(ipc_fmt_client); + RIL_CLIENT_LOCK(ril_data.ipc_fmt_client); ipc_client_send(ipc_client, command, type, data, length, mseq); - RIL_CLIENT_UNLOCK(ipc_fmt_client); + RIL_CLIENT_UNLOCK(ril_data.ipc_fmt_client); } int ipc_fmt_read_loop(struct ril_client *client) @@ -71,13 +71,13 @@ int ipc_fmt_read_loop(struct ril_client *client) return -1; } - if(client->object == NULL) { - LOGE("client object is NULL, aborting!"); + if(client->data == NULL) { + LOGE("client data is NULL, aborting!"); return -1; } - ipc_client = ((struct ipc_client_object *) client->object)->ipc_client; - ipc_client_fd = ((struct ipc_client_object *) client->object)->ipc_client_fd; + ipc_client = ((struct ipc_client_data *) client->data)->ipc_client; + ipc_client_fd = ((struct ipc_client_data *) client->data)->ipc_client_fd; FD_ZERO(&fds); FD_SET(ipc_client_fd, &fds); @@ -111,18 +111,18 @@ int ipc_fmt_read_loop(struct ril_client *client) int ipc_fmt_create(struct ril_client *client) { - struct ipc_client_object *client_object; + struct ipc_client_data *client_data; struct ipc_client *ipc_client; int ipc_client_fd; int rc; - client_object = malloc(sizeof(struct ipc_client_object)); - memset(client_object, 0, sizeof(struct ipc_client_object)); - client_object->ipc_client_fd = -1; + client_data = malloc(sizeof(struct ipc_client_data)); + memset(client_data, 0, sizeof(struct ipc_client_data)); + client_data->ipc_client_fd = -1; - client->object = client_object; + client->data = client_data; - ipc_client = (struct ipc_client *) client_object->ipc_client; + ipc_client = (struct ipc_client *) client_data->ipc_client; LOGD("Creating new FMT client"); ipc_client = ipc_client_new(IPC_CLIENT_TYPE_FMT); @@ -132,7 +132,7 @@ int ipc_fmt_create(struct ril_client *client) return -1; } - client_object->ipc_client = ipc_client; + client_data->ipc_client = ipc_client; LOGD("Setting log handler"); rc = ipc_client_set_log_handler(ipc_client, ipc_log_handler, NULL); @@ -170,7 +170,7 @@ int ipc_fmt_create(struct ril_client *client) LOGD("Obtaining ipc_client_fd"); ipc_client_fd = ipc_client_get_handlers_common_data_fd(ipc_client); - client_object->ipc_client_fd = ipc_client_fd; + client_data->ipc_client_fd = ipc_client_fd; if(ipc_client_fd < 0) { LOGE("%s: client_fmt_fd is negative, aborting", __FUNCTION__); @@ -201,17 +201,17 @@ int ipc_fmt_destroy(struct ril_client *client) return 0; } - if(client->object == NULL) { - LOGE("client object was already destroyed"); + if(client->data == NULL) { + LOGE("client data was already destroyed"); return 0; } - ipc_client_fd = ((struct ipc_client_object *) client->object)->ipc_client_fd; + ipc_client_fd = ((struct ipc_client_data *) client->data)->ipc_client_fd; if(ipc_client_fd) close(ipc_client_fd); - ipc_client = ((struct ipc_client_object *) client->object)->ipc_client; + ipc_client = ((struct ipc_client_data *) client->data)->ipc_client; if(ipc_client != NULL) { ipc_client_destroy_handlers_common_data(ipc_client); @@ -220,7 +220,7 @@ int ipc_fmt_destroy(struct ril_client *client) ipc_client_free(ipc_client); } - free(client->object); + free(client->data); return 0; } @@ -233,21 +233,21 @@ void ipc_rfs_send(const unsigned short command, unsigned char *data, const int l { struct ipc_client *ipc_client; - if(ipc_rfs_client == NULL) { + if(ril_data.ipc_rfs_client == NULL) { LOGE("ipc_rfs_client is null, aborting!"); return; } - if(ipc_rfs_client->object == NULL) { - LOGE("ipc_rfs_client object is null, aborting!"); + if(ril_data.ipc_rfs_client->data == NULL) { + LOGE("ipc_rfs_client data is null, aborting!"); return; } - ipc_client = ((struct ipc_client_object *) ipc_rfs_client->object)->ipc_client; + ipc_client = ((struct ipc_client_data *) ril_data.ipc_rfs_client->data)->ipc_client; - RIL_CLIENT_LOCK(ipc_rfs_client); + RIL_CLIENT_LOCK(ril_data.ipc_rfs_client); ipc_client_send(ipc_client, command, 0, data, length, mseq); - RIL_CLIENT_UNLOCK(ipc_rfs_client); + RIL_CLIENT_UNLOCK(ril_data.ipc_rfs_client); } int ipc_rfs_read_loop(struct ril_client *client) @@ -262,13 +262,13 @@ int ipc_rfs_read_loop(struct ril_client *client) return -1; } - if(client->object == NULL) { - LOGE("client object is NULL, aborting!"); + if(client->data == NULL) { + LOGE("client data is NULL, aborting!"); return -1; } - ipc_client = ((struct ipc_client_object *) client->object)->ipc_client; - ipc_client_fd = ((struct ipc_client_object *) client->object)->ipc_client_fd; + ipc_client = ((struct ipc_client_data *) client->data)->ipc_client; + ipc_client_fd = ((struct ipc_client_data *) client->data)->ipc_client_fd; FD_ZERO(&fds); FD_SET(ipc_client_fd, &fds); @@ -302,18 +302,18 @@ int ipc_rfs_read_loop(struct ril_client *client) int ipc_rfs_create(struct ril_client *client) { - struct ipc_client_object *client_object; + struct ipc_client_data *client_data; struct ipc_client *ipc_client; int ipc_client_fd; int rc; - client_object = malloc(sizeof(struct ipc_client_object)); - memset(client_object, 0, sizeof(struct ipc_client_object)); - client_object->ipc_client_fd = -1; + client_data = malloc(sizeof(struct ipc_client_data)); + memset(client_data, 0, sizeof(struct ipc_client_data)); + client_data->ipc_client_fd = -1; - client->object = client_object; + client->data = client_data; - ipc_client = (struct ipc_client *) client_object->ipc_client; + ipc_client = (struct ipc_client *) client_data->ipc_client; LOGD("Creating new RFS client"); ipc_client = ipc_client_new(IPC_CLIENT_TYPE_RFS); @@ -323,7 +323,7 @@ int ipc_rfs_create(struct ril_client *client) return -1; } - client_object->ipc_client = ipc_client; + client_data->ipc_client = ipc_client; LOGD("Setting log handler"); rc = ipc_client_set_log_handler(ipc_client, ipc_log_handler, NULL); @@ -353,7 +353,7 @@ int ipc_rfs_create(struct ril_client *client) LOGD("Obtaining ipc_client_fd"); ipc_client_fd = ipc_client_get_handlers_common_data_fd(ipc_client); - client_object->ipc_client_fd = ipc_client_fd; + client_data->ipc_client_fd = ipc_client_fd; if(ipc_client_fd < 0) { LOGE("%s: client_rfs_fd is negative, aborting", __FUNCTION__); @@ -379,17 +379,17 @@ int ipc_rfs_destroy(struct ril_client *client) return 0; } - if(client->object == NULL) { - LOGE("client object was already destroyed"); + if(client->data == NULL) { + LOGE("client data was already destroyed"); return 0; } - ipc_client_fd = ((struct ipc_client_object *) client->object)->ipc_client_fd; + ipc_client_fd = ((struct ipc_client_data *) client->data)->ipc_client_fd; if(ipc_client_fd) close(ipc_client_fd); - ipc_client = ((struct ipc_client_object *) client->object)->ipc_client; + ipc_client = ((struct ipc_client_data *) client->data)->ipc_client; if(ipc_client != NULL) { ipc_client_destroy_handlers_common_data(ipc_client); @@ -397,7 +397,7 @@ int ipc_rfs_destroy(struct ril_client *client) ipc_client_free(ipc_client); } - free(client->object); + free(client->data); return 0; } |