adbd/logcat: Change alog_ prefix to logcat_

to unify the prefix usage in the code base

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2024-01-07 01:20:03 +08:00 committed by GUIDINGLI
parent 8930743831
commit db0e0b9bfe

View File

@ -36,12 +36,12 @@
* Private types * Private types
****************************************************************************/ ****************************************************************************/
typedef struct alog_service_s typedef struct logcat_service_s
{ {
adb_service_t service; adb_service_t service;
uv_poll_t poll; uv_poll_t poll;
int wait_ack; int wait_ack;
} alog_service_t; } logcat_service_t;
/**************************************************************************** /****************************************************************************
* Private Function Prototypes * Private Function Prototypes
@ -54,16 +54,16 @@ static void logcat_on_data_available(uv_poll_t * handle,
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
static int alog_on_write(adb_service_t *service, apacket *p) static int logcat_on_write(adb_service_t *service, apacket *p)
{ {
UNUSED(p); UNUSED(p);
UNUSED(service); UNUSED(service);
return -1; return -1;
} }
static void alog_on_kick(struct adb_service_s *service) static void logcat_on_kick(struct adb_service_s *service)
{ {
alog_service_t *svc = container_of(service, alog_service_t, service); logcat_service_t *svc = container_of(service, logcat_service_t, service);
if (!svc->wait_ack) if (!svc->wait_ack)
{ {
int ret; int ret;
@ -72,26 +72,26 @@ static void alog_on_kick(struct adb_service_s *service)
} }
} }
static int alog_on_ack(adb_service_t *service, apacket *p) static int logcat_on_ack(adb_service_t *service, apacket *p)
{ {
UNUSED(p); UNUSED(p);
alog_service_t *svc = container_of(service, alog_service_t, service); logcat_service_t *svc = container_of(service, logcat_service_t, service);
svc->wait_ack = 0; svc->wait_ack = 0;
alog_on_kick(service); logcat_on_kick(service);
return 0; return 0;
} }
static void close_cb(uv_handle_t *handle) static void close_cb(uv_handle_t *handle)
{ {
alog_service_t *service = container_of(handle, alog_service_t, poll); logcat_service_t *service = container_of(handle, logcat_service_t, poll);
free(service); free(service);
} }
static void alog_close(struct adb_service_s *service) static void logcat_on_close(struct adb_service_s *service)
{ {
int fd; int fd;
int ret; int ret;
alog_service_t *svc = container_of(service, alog_service_t, service); logcat_service_t *svc = container_of(service, logcat_service_t, service);
ret = uv_fileno((uv_handle_t *)&svc->poll, &fd); ret = uv_fileno((uv_handle_t *)&svc->poll, &fd);
assert(ret == 0); assert(ret == 0);
@ -100,12 +100,12 @@ static void alog_close(struct adb_service_s *service)
uv_close((uv_handle_t *)&svc->poll, close_cb); uv_close((uv_handle_t *)&svc->poll, close_cb);
} }
static const adb_service_ops_t logcat_ops = static const adb_service_ops_t g_logcat_ops =
{ {
.on_write_frame = alog_on_write, .on_write_frame = logcat_on_write,
.on_ack_frame = alog_on_ack, .on_ack_frame = logcat_on_ack,
.on_kick = alog_on_kick, .on_kick = logcat_on_kick,
.on_close = alog_close .on_close = logcat_on_close
}; };
static void logcat_on_data_available(uv_poll_t * handle, static void logcat_on_data_available(uv_poll_t * handle,
@ -114,7 +114,7 @@ static void logcat_on_data_available(uv_poll_t * handle,
int ret; int ret;
int fd; int fd;
apacket_uv_t *ap; apacket_uv_t *ap;
alog_service_t *service = container_of(handle, alog_service_t, poll); logcat_service_t *service = container_of(handle, logcat_service_t, poll);
adb_client_uv_t *client = (adb_client_uv_t *)handle->data; adb_client_uv_t *client = (adb_client_uv_t *)handle->data;
ap = adb_uv_packet_allocate(client, 0); ap = adb_uv_packet_allocate(client, 0);
@ -181,15 +181,15 @@ exit_stop_service:
adb_service_t * logcat_service(adb_client_t *client, const char *params) adb_service_t * logcat_service(adb_client_t *client, const char *params)
{ {
int ret; int ret;
alog_service_t *service = logcat_service_t *service =
(alog_service_t *)malloc(sizeof(alog_service_t)); (logcat_service_t *)malloc(sizeof(logcat_service_t));
if (service == NULL) if (service == NULL)
{ {
return NULL; return NULL;
} }
service->service.ops = &logcat_ops; service->service.ops = &g_logcat_ops;
service->wait_ack = 0; service->wait_ack = 0;
/* TODO parse params string to extract logcat parameters */ /* TODO parse params string to extract logcat parameters */
@ -208,7 +208,7 @@ adb_service_t * logcat_service(adb_client_t *client, const char *params)
assert(ret == 0); assert(ret == 0);
service->poll.data = client; service->poll.data = client;
alog_on_kick(&service->service); logcat_on_kick(&service->service);
return &service->service; return &service->service;
} }