From fb037bfb7cbf7b404c069b4ebac5a10059d948b1 Mon Sep 17 00:00:00 2001 From: Dan Handley Date: Thu, 10 Apr 2014 15:37:22 +0100 Subject: Always use named structs in header files Add tag names to all unnamed structs in header files. This allows forward declaration of structs, which is necessary to reduce header file nesting (to be implemented in a subsequent commit). Also change the typedef names across the codebase to use the _t suffix to be more conformant with the Linux coding style. The coding style actually prefers us not to use typedefs at all but this is considered a step too far for Trusted Firmware. Also change the IO framework structs defintions to use typedef'd structs to be consistent with the rest of the codebase. Change-Id: I722b2c86fc0d92e4da3b15e5cab20373dd26786f --- lib/semihosting/semihosting.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lib/semihosting/semihosting.c') diff --git a/lib/semihosting/semihosting.c b/lib/semihosting/semihosting.c index d5b8524b..3232cd54 100644 --- a/lib/semihosting/semihosting.c +++ b/lib/semihosting/semihosting.c @@ -45,23 +45,23 @@ typedef struct { const char *file_name; unsigned long mode; size_t name_length; -} smh_file_open_block; +} smh_file_open_block_t; typedef struct { long handle; void *buffer; size_t length; -} smh_file_read_write_block; +} smh_file_read_write_block_t; typedef struct { long handle; ssize_t location; -} smh_file_seek_block; +} smh_file_seek_block_t; typedef struct { char *command_line; size_t command_length; -} smh_system_block; +} smh_system_block_t; long semihosting_connection_supported(void) { @@ -70,7 +70,7 @@ long semihosting_connection_supported(void) long semihosting_file_open(const char *file_name, size_t mode) { - smh_file_open_block open_block; + smh_file_open_block_t open_block; open_block.file_name = file_name; open_block.mode = mode; @@ -82,7 +82,7 @@ long semihosting_file_open(const char *file_name, size_t mode) long semihosting_file_seek(long file_handle, ssize_t offset) { - smh_file_seek_block seek_block; + smh_file_seek_block_t seek_block; long result; seek_block.handle = file_handle; @@ -99,7 +99,7 @@ long semihosting_file_seek(long file_handle, ssize_t offset) long semihosting_file_read(long file_handle, size_t *length, void *buffer) { - smh_file_read_write_block read_block; + smh_file_read_write_block_t read_block; long result = -EINVAL; if ((length == NULL) || (buffer == NULL)) @@ -125,7 +125,7 @@ long semihosting_file_write(long file_handle, size_t *length, const void *buffer) { - smh_file_read_write_block write_block; + smh_file_read_write_block_t write_block; if ((length == NULL) || (buffer == NULL)) return -EINVAL; @@ -169,7 +169,7 @@ void semihosting_write_string(char *string) long semihosting_system(char *command_line) { - smh_system_block system_block; + smh_system_block_t system_block; system_block.command_line = command_line; system_block.command_length = strlen(command_line); -- cgit v1.2.3 From 97043ac98e13a726dbf8b3b41654dca759e3da2c Mon Sep 17 00:00:00 2001 From: Dan Handley Date: Wed, 9 Apr 2014 13:14:54 +0100 Subject: Reduce deep nesting of header files Reduce the number of header files included from other header files as much as possible without splitting the files. Use forward declarations where possible. This allows removal of some unnecessary "#ifndef __ASSEMBLY__" statements. Also, review the .c and .S files for which header files really need including and reorder the #include statements alphabetically. Fixes ARM-software/tf-issues#31 Change-Id: Iec92fb976334c77453e010b60bcf56f3be72bd3e --- lib/semihosting/semihosting.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/semihosting/semihosting.c') diff --git a/lib/semihosting/semihosting.c b/lib/semihosting/semihosting.c index 3232cd54..1bce377c 100644 --- a/lib/semihosting/semihosting.c +++ b/lib/semihosting/semihosting.c @@ -29,10 +29,9 @@ */ #include -#include #include -#include #include +#include #ifndef SEMIHOSTING_SUPPORTED #define SEMIHOSTING_SUPPORTED 1 -- cgit v1.2.3