mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-30 01:46:30 -05:00
100 lines
3.3 KiB
Diff
100 lines
3.3 KiB
Diff
From fc787ebd71fa231cc7dd2a0d5f2208da0527096a Mon Sep 17 00:00:00 2001
|
|
From: Katish Paran <kparan@codeaurora.org>
|
|
Date: Fri, 31 Jan 2014 12:00:37 +0530
|
|
Subject: diag: dci: Index DCI client table by client id
|
|
|
|
Diag driver maintains a table of all DCI clients. This table
|
|
is currently indexed by the PID of the clients. Make changes
|
|
to index the table base on an unique client id.
|
|
|
|
Change-Id: I57bfab9eae1381882b8eb6270d7ac212e0aaf271
|
|
CRs-fixed: 590721
|
|
Signed-off-by: Katish Paran <kparan@codeaurora.org>
|
|
---
|
|
drivers/char/diag/diag_dci.c | 16 ++++++++++++++++
|
|
drivers/char/diag/diag_dci.h | 4 ++++
|
|
drivers/char/diag/diagchar_core.c | 4 +++-
|
|
3 files changed, 23 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/drivers/char/diag/diag_dci.c b/drivers/char/diag/diag_dci.c
|
|
index 37c236d..0edfdad 100644
|
|
--- a/drivers/char/diag/diag_dci.c
|
|
+++ b/drivers/char/diag/diag_dci.c
|
|
@@ -847,6 +847,22 @@ int diag_process_dci_transaction(unsigned char *buf, int len)
|
|
return ret;
|
|
}
|
|
|
|
+int diag_dci_find_client_index_health(int client_id)
|
|
+{
|
|
+ int i, ret = DCI_CLIENT_INDEX_INVALID;
|
|
+
|
|
+ for (i = 0; i < MAX_DCI_CLIENTS; i++) {
|
|
+ if (driver->dci_client_tbl[i].client != NULL) {
|
|
+ if (driver->dci_client_tbl[i].client_id ==
|
|
+ client_id) {
|
|
+ ret = i;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ return ret;
|
|
+}
|
|
+
|
|
int diag_dci_find_client_index(int client_id)
|
|
{
|
|
int i, ret = DCI_CLIENT_INDEX_INVALID;
|
|
diff --git a/drivers/char/diag/diag_dci.h b/drivers/char/diag/diag_dci.h
|
|
index 2ab8a36..870b0f3 100644
|
|
--- a/drivers/char/diag/diag_dci.h
|
|
+++ b/drivers/char/diag/diag_dci.h
|
|
@@ -56,6 +56,7 @@ struct dci_pkt_req_entry_t {
|
|
} __packed;
|
|
|
|
struct diag_dci_client_tbl {
|
|
+ uint32_t client_id;
|
|
struct task_struct *client;
|
|
uint16_t list; /* bit mask */
|
|
int signal_type;
|
|
@@ -74,6 +75,7 @@ struct diag_dci_client_tbl {
|
|
|
|
/* This is used for DCI health stats */
|
|
struct diag_dci_health_stats {
|
|
+ int client_id;
|
|
int dropped_logs;
|
|
int dropped_events;
|
|
int received_logs;
|
|
@@ -119,6 +121,8 @@ int diag_process_smd_dci_read_data(struct diag_smd_info *smd_info, void *buf,
|
|
int recd_bytes);
|
|
int diag_process_dci_transaction(unsigned char *buf, int len);
|
|
void extract_dci_pkt_rsp(struct diag_smd_info *smd_info, unsigned char *buf);
|
|
+
|
|
+int diag_dci_find_client_index_health(int client_id);
|
|
int diag_dci_find_client_index(int client_id);
|
|
/* DCI Log streaming functions */
|
|
void create_dci_log_mask_tbl(unsigned char *tbl_buf);
|
|
diff --git a/drivers/char/diag/diagchar_core.c b/drivers/char/diag/diagchar_core.c
|
|
index 9a4e108..0e475c9 100644
|
|
--- a/drivers/char/diag/diagchar_core.c
|
|
+++ b/drivers/char/diag/diagchar_core.c
|
|
@@ -943,6 +943,8 @@ long diagchar_ioctl(struct file *filp,
|
|
for (i = 0; i < MAX_DCI_CLIENTS; i++) {
|
|
if (driver->dci_client_tbl[i].client == NULL) {
|
|
driver->dci_client_tbl[i].client = current;
|
|
+ driver->dci_client_tbl[i].client_id =
|
|
+ driver->dci_client_id;
|
|
driver->dci_client_tbl[i].list =
|
|
dci_params->list;
|
|
driver->dci_client_tbl[i].signal_type =
|
|
@@ -1043,7 +1045,7 @@ long diagchar_ioctl(struct file *filp,
|
|
sizeof(struct diag_dci_health_stats)))
|
|
return -EFAULT;
|
|
mutex_lock(&dci_health_mutex);
|
|
- i = diag_dci_find_client_index(current->tgid);
|
|
+ i = diag_dci_find_client_index_health(stats.client_id);
|
|
if (i != DCI_CLIENT_INDEX_INVALID) {
|
|
dci_params = &(driver->dci_client_tbl[i]);
|
|
stats.dropped_logs = dci_params->dropped_logs;
|
|
--
|
|
cgit v1.1
|
|
|