Replace app-related typedefs with struct types

This rewrite was mostly automatic:
sed -r -i 's/\b(trusty_app)_t\b/struct \1/g'
sed -r -i 's/\b(trusty_app_notifier)_t\b/struct \1/g'
sed -r -i 's/\b(trusty_app_props)_t\b/struct \1/g'
sed -r -i 's/\b(uctx)_t\b/struct \1/g'

Bug: 144593477
Change-Id: I25a140aa2dd31494b7c10cc0a7a801b4f956b6a4
diff --git a/lib/trusty/include/lib/trusty/trusty_app.h b/lib/trusty/include/lib/trusty/trusty_app.h
index e69a296..e2060b0 100644
--- a/lib/trusty/include/lib/trusty/trusty_app.h
+++ b/lib/trusty/include/lib/trusty/trusty_app.h
@@ -53,7 +53,7 @@
     struct list_node node;
 };
 
-typedef struct {
+struct trusty_app_props {
     uuid_t uuid;
     uint32_t mgmt_flags;
     uint32_t min_stack_size;
@@ -62,24 +62,24 @@
     uint32_t config_entry_cnt;
     uint32_t* config_blob;
     struct list_node port_entry_list;
-} trusty_app_props_t;
+};
 
 struct trusty_app_img {
     uintptr_t img_start;
     uintptr_t img_end;
 };
 
-typedef struct trusty_app trusty_app_t;
+struct trusty_app;
 
 struct trusty_thread {
     vaddr_t stack_start;
     size_t stack_size;
     vaddr_t entry;
     thread_t* thread;
-    trusty_app_t* app;
+    struct trusty_app* app;
 };
 
-typedef struct trusty_app {
+struct trusty_app {
     /* corresponds to the order in which the apps were started */
     u_int app_id;
     enum app_state state;
@@ -89,13 +89,13 @@
     vaddr_t cur_brk;
     vaddr_t end_brk;
     vaddr_t load_bias;
-    trusty_app_props_t props;
+    struct trusty_app_props props;
     struct trusty_app_img* app_img;
     struct trusty_thread* thread;
     /* app local storage */
     void** als;
     struct list_node node;
-} trusty_app_t;
+};
 
 void trusty_app_init(void);
 
@@ -125,25 +125,26 @@
                                           const uuid_t* uuid);
 
 void trusty_app_exit(int status) __NO_RETURN;
-status_t trusty_app_setup_mmio(trusty_app_t* trusty_app,
+status_t trusty_app_setup_mmio(struct trusty_app* trusty_app,
                                uint32_t mmio_id,
                                user_addr_t* uaddr_p,
                                uint32_t size);
-void trusty_app_forall(void (*fn)(trusty_app_t* ta, void* data), void* data);
+void trusty_app_forall(void (*fn)(struct trusty_app* ta, void* data),
+                       void* data);
 void trusty_thread_exit(int status);
 
-typedef struct trusty_app_notifier {
+struct trusty_app_notifier {
     struct list_node node;
-    status_t (*startup)(trusty_app_t* app);
-    status_t (*shutdown)(trusty_app_t* app);
-} trusty_app_notifier_t;
+    status_t (*startup)(struct trusty_app* app);
+    status_t (*shutdown)(struct trusty_app* app);
+};
 
 /*
  * All app notifiers registration has to be complete before
  * libtrusty is initialized which is happening at LK_INIT_LEVEL_APPS-1
  * init level.
  */
-status_t trusty_register_app_notifier(trusty_app_notifier_t* n);
+status_t trusty_register_app_notifier(struct trusty_app_notifier* n);
 
 /*
  * All als slots must be allocated before libtrusty is initialized
@@ -171,7 +172,7 @@
     return (struct trusty_thread*)tls_get(TLS_ENTRY_TRUSTY);
 }
 
-static inline trusty_app_t* current_trusty_app(void) {
+static inline struct trusty_app* current_trusty_app(void) {
     return current_trusty_thread()->app;
 }
 
diff --git a/lib/trusty/include/lib/trusty/uctx.h b/lib/trusty/include/lib/trusty/uctx.h
index da2d157..14c69f3 100644
--- a/lib/trusty/include/lib/trusty/uctx.h
+++ b/lib/trusty/include/lib/trusty/uctx.h
@@ -29,22 +29,24 @@
 
 #include <lib/trusty/handle.h>
 
-typedef struct uctx uctx_t;
+struct uctx;
 
 typedef uint32_t handle_id_t;
 
 #define INVALID_HANDLE_ID ((handle_id_t)0xFFFFFFFF)
 
-int uctx_create(void* priv, uctx_t** ctx);
-void uctx_destroy(uctx_t* ctx);
-void* uctx_get_priv(uctx_t* ctx);
-uctx_t* current_uctx(void);
+int uctx_create(void* priv, struct uctx** ctx);
+void uctx_destroy(struct uctx* ctx);
+void* uctx_get_priv(struct uctx* ctx);
+struct uctx* current_uctx(void);
 
-int uctx_handle_install(uctx_t* ctx, struct handle* handle, handle_id_t* id);
-int uctx_handle_remove(uctx_t* ctx,
+int uctx_handle_install(struct uctx* ctx,
+                        struct handle* handle,
+                        handle_id_t* id);
+int uctx_handle_remove(struct uctx* ctx,
                        handle_id_t handle_id,
                        struct handle** handle_ptr);
-int uctx_handle_get(uctx_t* ctx,
+int uctx_handle_get(struct uctx* ctx,
                     handle_id_t handle_id,
                     struct handle** handle_ptr);
 
diff --git a/lib/trusty/ipc.c b/lib/trusty/ipc.c
index c4f614d..3611e34 100644
--- a/lib/trusty/ipc.c
+++ b/lib/trusty/ipc.c
@@ -359,8 +359,8 @@
                                uint32_t num_recv_bufs,
                                uint32_t recv_buf_size,
                                uint32_t flags) {
-    trusty_app_t* tapp = current_trusty_app();
-    uctx_t* ctx = current_uctx();
+    struct trusty_app* tapp = current_trusty_app();
+    struct uctx* ctx = current_uctx();
     struct handle* port_handle = NULL;
     int ret;
     handle_id_t handle_id;
@@ -810,8 +810,8 @@
 #endif
 
 long __SYSCALL sys_connect(user_addr_t path, uint32_t flags) {
-    trusty_app_t* tapp = current_trusty_app();
-    uctx_t* ctx = current_uctx();
+    struct trusty_app* tapp = current_trusty_app();
+    struct uctx* ctx = current_uctx();
     struct handle* chandle;
     char tmp_path[IPC_PORT_PATH_MAX];
     int ret;
@@ -951,7 +951,7 @@
 }
 
 long __SYSCALL sys_accept(uint32_t handle_id, user_addr_t user_uuid) {
-    uctx_t* ctx = current_uctx();
+    struct uctx* ctx = current_uctx();
     struct handle* phandle = NULL;
     struct handle* chandle = NULL;
     int ret;
diff --git a/lib/trusty/syscall.c b/lib/trusty/syscall.c
index f407c99..217372c 100644
--- a/lib/trusty/syscall.c
+++ b/lib/trusty/syscall.c
@@ -147,7 +147,7 @@
 
 void* sys_brk(void* u_brk) {
     vaddr_t brk = (vaddr_t)u_brk;
-    trusty_app_t* trusty_app = current_trusty_app();
+    struct trusty_app* trusty_app = current_trusty_app();
 
     /* update brk, if within range */
     if ((brk >= trusty_app->start_brk) && (brk <= trusty_app->end_brk)) {
@@ -210,7 +210,7 @@
               uint32_t size,
               uint32_t flags,
               uint32_t handle) {
-    trusty_app_t* trusty_app = current_trusty_app();
+    struct trusty_app* trusty_app = current_trusty_app();
     long ret;
 
     /*
@@ -231,7 +231,7 @@
 }
 
 long sys_munmap(user_addr_t uaddr, uint32_t size) {
-    trusty_app_t* trusty_app = current_trusty_app();
+    struct trusty_app* trusty_app = current_trusty_app();
 
     /*
      * vmm_free_region always unmaps whole region.
diff --git a/lib/trusty/trusty_app.c b/lib/trusty/trusty_app.c
index 41f07e7..acc2387 100644
--- a/lib/trusty/trusty_app.c
+++ b/lib/trusty/trusty_app.c
@@ -188,7 +188,7 @@
     mutex_release(&apps_lock);
 }
 
-status_t trusty_register_app_notifier(trusty_app_notifier_t* n) {
+status_t trusty_register_app_notifier(struct trusty_app_notifier* n) {
     status_t ret = NO_ERROR;
 
     mutex_acquire(&apps_lock);
@@ -337,11 +337,12 @@
     thread_exit(retcode);
 }
 
-static struct trusty_thread* trusty_thread_create(const char* name,
-                                                  vaddr_t entry,
-                                                  int priority,
-                                                  size_t stack_size,
-                                                  trusty_app_t* trusty_app) {
+static struct trusty_thread* trusty_thread_create(
+        const char* name,
+        vaddr_t entry,
+        int priority,
+        size_t stack_size,
+        struct trusty_app* trusty_app) {
     struct trusty_thread* trusty_thread;
     status_t err;
     vaddr_t stack_bot = 0;
@@ -401,7 +402,7 @@
 
     DEBUG_ASSERT(is_mutex_held(&apps_lock));
 
-    list_for_every_entry(&trusty_app_list, app, trusty_app_t, node) {
+    list_for_every_entry(&trusty_app_list, app, struct trusty_app, node) {
         list_for_every_entry(&app->props.port_entry_list, entry,
                              struct manifest_port_entry, node) {
             if (!strncmp(port_path, entry->path, entry->path_len)) {
@@ -416,12 +417,12 @@
     return NULL;
 }
 /* Must be called with the apps_lock held */
-static trusty_app_t* trusty_app_find_by_uuid_locked(uuid_t* uuid) {
-    trusty_app_t* app;
+static struct trusty_app* trusty_app_find_by_uuid_locked(uuid_t* uuid) {
+    struct trusty_app* app;
 
     DEBUG_ASSERT(is_mutex_held(&apps_lock));
 
-    list_for_every_entry(&trusty_app_list, app, trusty_app_t, node) {
+    list_for_every_entry(&trusty_app_list, app, struct trusty_app, node) {
         if (!memcmp(&app->props.uuid, uuid, sizeof(uuid_t)))
             return app;
     }
@@ -429,7 +430,7 @@
     return NULL;
 }
 
-static status_t load_app_config_options(trusty_app_t* trusty_app,
+static status_t load_app_config_options(struct trusty_app* trusty_app,
                                         ELF_SHDR* shdr) {
     char* manifest_data;
     const char* port_name;
@@ -614,7 +615,7 @@
     return NO_ERROR;
 }
 
-static status_t init_brk(trusty_app_t* trusty_app) {
+static status_t init_brk(struct trusty_app* trusty_app) {
     status_t status;
     vaddr_t start_brk;
     vaddr_t brk_size;
@@ -735,7 +736,7 @@
     return NO_ERROR;
 }
 
-static status_t alloc_address_map(trusty_app_t* trusty_app) {
+static status_t alloc_address_map(struct trusty_app* trusty_app) {
     ELF_EHDR* elf_hdr = (ELF_EHDR*)trusty_app->app_img->img_start;
     void* trusty_app_image;
     ELF_PHDR* prg_hdr;
@@ -1013,7 +1014,7 @@
     ELF_SHDR* manifest_shdr;
     char* shstbl;
     uint32_t shstbl_size;
-    trusty_app_t* trusty_app;
+    struct trusty_app* trusty_app;
     u_int i;
     status_t ret;
     struct manifest_port_entry* entry;
@@ -1031,7 +1032,7 @@
             (void*)app_img->img_start, app_img->img_end - app_img->img_start,
             (void*)app_img->img_end);
 
-    trusty_app = (trusty_app_t*)calloc(1, sizeof(trusty_app_t));
+    trusty_app = (struct trusty_app*)calloc(1, sizeof(struct trusty_app));
     if (!trusty_app) {
         dprintf(CRITICAL,
                 "trusty_app: failed to allocate memory for trusty app\n");
@@ -1149,7 +1150,7 @@
     return ret;
 }
 
-status_t trusty_app_setup_mmio(trusty_app_t* trusty_app,
+status_t trusty_app_setup_mmio(struct trusty_app* trusty_app,
                                uint32_t mmio_id,
                                user_addr_t* uaddr_p,
                                uint32_t map_size) {
@@ -1209,7 +1210,7 @@
     return ERR_NOT_FOUND;
 }
 
-static status_t trusty_app_start(trusty_app_t* trusty_app) {
+static status_t trusty_app_start(struct trusty_app* trusty_app) {
     char name[32];
     struct trusty_thread* trusty_thread;
     struct trusty_app_notifier* n;
@@ -1490,22 +1491,25 @@
 }
 
 /* rather export trusty_app_list?  */
-void trusty_app_forall(void (*fn)(trusty_app_t* ta, void* data), void* data) {
-    trusty_app_t* ta;
+void trusty_app_forall(void (*fn)(struct trusty_app* ta, void* data),
+                       void* data) {
+    struct trusty_app* ta;
 
     if (fn == NULL)
         return;
 
     mutex_acquire(&apps_lock);
-    list_for_every_entry(&trusty_app_list, ta, trusty_app_t, node) fn(ta, data);
+    list_for_every_entry(&trusty_app_list, ta, struct trusty_app, node)
+            fn(ta, data);
     mutex_release(&apps_lock);
 }
 
 static void start_apps(uint level) {
-    trusty_app_t* trusty_app;
+    struct trusty_app* trusty_app;
 
     mutex_acquire(&apps_lock);
-    list_for_every_entry(&trusty_app_list, trusty_app, trusty_app_t, node) {
+    list_for_every_entry(&trusty_app_list, trusty_app, struct trusty_app,
+                         node) {
         if (is_deferred_start(trusty_app))
             continue;
 
diff --git a/lib/trusty/uctx.c b/lib/trusty/uctx.c
index 157b499..8e3826e 100644
--- a/lib/trusty/uctx.c
+++ b/lib/trusty/uctx.c
@@ -72,8 +72,8 @@
     handle_id_t handle_id_base;
 };
 
-static status_t _uctx_startup(trusty_app_t* app);
-static status_t _uctx_shutdown(trusty_app_t* app);
+static status_t _uctx_startup(struct trusty_app* app);
+static status_t _uctx_shutdown(struct trusty_app* app);
 
 static uint _uctx_slot_id;
 static struct trusty_app_notifier _uctx_notifier = {
@@ -81,8 +81,8 @@
         .shutdown = _uctx_shutdown,
 };
 
-static status_t _uctx_startup(trusty_app_t* app) {
-    uctx_t* uctx;
+static status_t _uctx_startup(struct trusty_app* app) {
+    struct uctx* uctx;
 
     int err = uctx_create(app, &uctx);
     if (err)
@@ -92,9 +92,9 @@
     return NO_ERROR;
 }
 
-static status_t _uctx_shutdown(trusty_app_t* app) {
+static status_t _uctx_shutdown(struct trusty_app* app) {
     LTRACEF("Destroying uctx for app:%d\n", app->app_id);
-    uctx_t* uctx;
+    struct uctx* uctx;
     uctx = trusty_als_get(app, _uctx_slot_id);
 
     if (uctx)
@@ -123,8 +123,8 @@
 /*
  *  Get uctx context of the current app
  */
-uctx_t* current_uctx(void) {
-    trusty_app_t* tapp = current_trusty_app();
+struct uctx* current_uctx(void) {
+    struct trusty_app* tapp = current_trusty_app();
     return trusty_als_get(tapp, _uctx_slot_id);
 }
 
@@ -135,7 +135,7 @@
  *  On success return index of the handle in handle table,
  *  negative error otherwise
  */
-static int _check_handle_id(uctx_t* ctx, handle_id_t handle_id) {
+static int _check_handle_id(struct uctx* ctx, handle_id_t handle_id) {
     uint32_t idx;
 
     DEBUG_ASSERT(ctx);
@@ -304,12 +304,12 @@
  *  to keep track handles on behalf of user space app. Exactly one user
  *  context is created for each trusty app during it's nitialization.
  */
-int uctx_create(void* priv, uctx_t** ctx) {
-    uctx_t* new_ctx;
+int uctx_create(void* priv, struct uctx** ctx) {
+    struct uctx* new_ctx;
 
     DEBUG_ASSERT(ctx);
 
-    new_ctx = calloc(1, sizeof(uctx_t));
+    new_ctx = calloc(1, sizeof(struct uctx));
     if (!new_ctx) {
         LTRACEF("Out of memory\n");
         return ERR_NO_MEMORY;
@@ -330,7 +330,7 @@
 /*
  *   Destroy user context previously created by uctx_create.
  */
-void uctx_destroy(uctx_t* ctx) {
+void uctx_destroy(struct uctx* ctx) {
     int i;
     DEBUG_ASSERT(ctx);
 
@@ -352,7 +352,7 @@
 /*
  *  Returns private data associated with user context. (Currently unused)
  */
-void* uctx_get_priv(uctx_t* ctx) {
+void* uctx_get_priv(struct uctx* ctx) {
     ASSERT(ctx);
     return ctx->priv;
 }
@@ -361,7 +361,9 @@
  * Install specified handle into user handle table and increment installed
  * handle ref count accordinly.
  */
-int uctx_handle_install(uctx_t* ctx, struct handle* handle, handle_id_t* id) {
+int uctx_handle_install(struct uctx* ctx,
+                        struct handle* handle,
+                        handle_id_t* id) {
     int ret;
     int idx;
 
@@ -438,7 +440,7 @@
  *   Retrieve handle from specified user context specified by
  *   given handle_id. Increment ref count for returned handle.
  */
-int uctx_handle_get(uctx_t* ctx,
+int uctx_handle_get(struct uctx* ctx,
                     handle_id_t handle_id,
                     struct handle** handle_ptr) {
     struct handle_ref tmp_ref;
@@ -459,7 +461,7 @@
  *  return it to caller if requested. In later case the caller becomes an owner
  *  of that handle.
  */
-int uctx_handle_remove(uctx_t* ctx,
+int uctx_handle_remove(struct uctx* ctx,
                        handle_id_t handle_id,
                        struct handle** handle_ptr) {
     int ret;
@@ -525,7 +527,7 @@
                         uint32_t timeout_msecs) {
     int ret;
     struct handle_ref target;
-    uctx_t* ctx = current_uctx();
+    struct uctx* ctx = current_uctx();
 
     LTRACEF("[%p][%d]: %d msec\n", current_trusty_thread(), handle_id,
             timeout_msecs);
@@ -551,7 +553,7 @@
 #if WITH_WAIT_ANY_SUPPORT
     int ret;
     struct handle_ref target;
-    uctx_t* ctx = current_uctx();
+    struct uctx* ctx = current_uctx();
 
     LTRACEF("[%p]: %d msec\n", current_trusty_thread(), timeout_msecs);