[PATCH v2 04/20] fip: drop typedefs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Do not typedef struct types.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 commands/fiptool.c | 28 ++++++++++++++--------------
 include/fiptool.h  | 26 +++++++++++++-------------
 lib/fip.c          | 44 ++++++++++++++++++++++----------------------
 3 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/commands/fiptool.c b/commands/fiptool.c
index 2d766f895b..a4370c9eef 100644
--- a/commands/fiptool.c
+++ b/commands/fiptool.c
@@ -31,7 +31,7 @@ typedef struct cmd {
 } cmd_t;
 
 
-static int write_image_to_file(const image_t *image, const char *filename)
+static int write_image_to_file(const struct fip_image *image, const char *filename)
 {
 	int fd;
 
@@ -53,7 +53,7 @@ static int write_image_to_file(const image_t *image, const char *filename)
 
 static int info_cmd(struct fip_state *fip, int argc, char *argv[])
 {
-	image_desc_t *desc;
+	struct fip_image_desc *desc;
 	fip_toc_header_t toc_header;
 	int ret;
 
@@ -74,7 +74,7 @@ static int info_cmd(struct fip_state *fip, int argc, char *argv[])
 	    (unsigned long long)toc_header.flags);
 
 	for (desc = fip->image_desc_head; desc != NULL; desc = desc->next) {
-		image_t *image = desc->image;
+		struct fip_image *image = desc->image;
 
 		if (image == NULL)
 			continue;
@@ -193,7 +193,7 @@ static __maybe_unused int create_cmd(struct fip_state *fip, int argc, char *argv
 	while ((opt = getopt(argc, argv, "e:p:a:b:")) > 0) {
 		switch (opt) {
 		case 'e': {
-			image_desc_t *desc;
+			struct fip_image_desc *desc;
 
 			desc = lookup_image_desc_from_opt(fip, &optarg);
 			if (!desc)
@@ -214,7 +214,7 @@ static __maybe_unused int create_cmd(struct fip_state *fip, int argc, char *argv
 			char name[UUID_STRING_LEN + 1];
 			char filename[PATH_MAX] = { 0 };
 			uuid_t uuid = uuid_null;
-			image_desc_t *desc;
+			struct fip_image_desc *desc;
 
 			parse_blob_opt(optarg, &uuid,
 			    filename, sizeof(filename));
@@ -264,7 +264,7 @@ static __maybe_unused int update_cmd(struct fip_state *fip, int argc, char *argv
 	while ((opt = getopt(argc, argv, "e:p:b:a:o:")) > 0) {
 		switch (opt) {
 		case 'e': {
-			image_desc_t *desc;
+			struct fip_image_desc *desc;
 
 			desc = lookup_image_desc_from_opt(fip, &optarg);
 			if (!desc)
@@ -281,7 +281,7 @@ static __maybe_unused int update_cmd(struct fip_state *fip, int argc, char *argv
 			char name[UUID_STRING_LEN + 1];
 			char filename[PATH_MAX] = { 0 };
 			uuid_t uuid = uuid_null;
-			image_desc_t *desc;
+			struct fip_image_desc *desc;
 
 			parse_blob_opt(optarg, &uuid,
 			    filename, sizeof(filename));
@@ -339,7 +339,7 @@ static __maybe_unused int update_cmd(struct fip_state *fip, int argc, char *argv
 static int unpack_cmd(struct fip_state *fip, int argc, char *argv[])
 {
 	char outdir[PATH_MAX] = { 0 };
-	image_desc_t *desc;
+	struct fip_image_desc *desc;
 	int fflag = 0;
 	int unpack_all = 1;
 	int ret, opt;
@@ -350,7 +350,7 @@ static int unpack_cmd(struct fip_state *fip, int argc, char *argv[])
 	while ((opt = getopt(argc, argv, "e:b:fo:")) > 0) {
 		switch (opt) {
 		case 'e': {
-			image_desc_t *desc;
+			struct fip_image_desc *desc;
 
 			desc = lookup_image_desc_from_opt(fip, &optarg);
 			if (!desc)
@@ -363,7 +363,7 @@ static int unpack_cmd(struct fip_state *fip, int argc, char *argv[])
 			char name[UUID_STRING_LEN + 1];
 			char filename[PATH_MAX] = { 0 };
 			uuid_t uuid = uuid_null;
-			image_desc_t *desc;
+			struct fip_image_desc *desc;
 
 			parse_blob_opt(optarg, &uuid,
 			    filename, sizeof(filename));
@@ -411,7 +411,7 @@ static int unpack_cmd(struct fip_state *fip, int argc, char *argv[])
 	/* Unpack all specified images. */
 	for (desc = fip->image_desc_head; desc != NULL; desc = desc->next) {
 		char file[PATH_MAX];
-		image_t *image = desc->image;
+		struct fip_image *image = desc->image;
 
 		if (!unpack_all && desc->action != DO_UNPACK)
 			continue;
@@ -447,7 +447,7 @@ static __maybe_unused int remove_cmd(struct fip_state *fip, int argc, char *argv
 {
 	char outfile[PATH_MAX] = { 0 };
 	fip_toc_header_t toc_header;
-	image_desc_t *desc;
+	struct fip_image_desc *desc;
 	long align = 1;
 	int ret, opt, fflag = 0;
 
@@ -457,7 +457,7 @@ static __maybe_unused int remove_cmd(struct fip_state *fip, int argc, char *argv
 	while ((opt = getopt(argc, argv, "e:a:b:fo:")) > 0) {
 		switch (opt) {
 		case 'e': {
-			image_desc_t *desc;
+			struct fip_image_desc *desc;
 
 			desc = lookup_image_desc_from_opt(fip, &optarg);
 			if (!desc)
@@ -473,7 +473,7 @@ static __maybe_unused int remove_cmd(struct fip_state *fip, int argc, char *argv
 		case 'b': {
 			char name[UUID_STRING_LEN + 1], filename[PATH_MAX];
 			uuid_t uuid = uuid_null;
-			image_desc_t *desc;
+			struct fip_image_desc *desc;
 
 			parse_blob_opt(optarg, &uuid,
 			    filename, sizeof(filename));
diff --git a/include/fiptool.h b/include/fiptool.h
index 704845f456..6f1d69d178 100644
--- a/include/fiptool.h
+++ b/include/fiptool.h
@@ -16,23 +16,23 @@ enum {
 	DO_REMOVE = 3
 };
 
-typedef struct image_desc {
+struct fip_image_desc {
 	uuid_t             uuid;
 	char              *name;
 	char              *cmdline_name;
 	int                action;
 	char              *action_arg;
-	struct image      *image;
-	struct image_desc *next;
-} image_desc_t;
+	struct fip_image  *image;
+	struct fip_image_desc *next;
+};
 
-typedef struct image {
+struct fip_image {
 	struct fip_toc_entry toc_e;
 	void                *buffer;
-} image_t;
+};
 
 struct fip_state {
-	image_desc_t *image_desc_head;
+	struct fip_image_desc *image_desc_head;
 	size_t nr_image_descs;
 	int verbose;
 };
@@ -45,24 +45,24 @@ struct fip_state {
 	} \
 } while (0)
 
-image_desc_t *new_image_desc(const uuid_t *uuid,
+struct fip_image_desc *new_image_desc(const uuid_t *uuid,
 			     const char *name, const char *cmdline_name);
 
-void set_image_desc_action(image_desc_t *desc, int action,
+void set_image_desc_action(struct fip_image_desc *desc, int action,
     const char *arg);
 
-void free_image_desc(image_desc_t *desc);
+void free_image_desc(struct fip_image_desc *desc);
 
-void add_image_desc(struct fip_state *fip, image_desc_t *desc);
+void add_image_desc(struct fip_state *fip, struct fip_image_desc *desc);
 
 void free_image_descs(struct fip_state *fip);
 
 void fill_image_descs(struct fip_state *fip);
 
-image_desc_t *lookup_image_desc_from_uuid(struct fip_state *fip,
+struct fip_image_desc *lookup_image_desc_from_uuid(struct fip_state *fip,
 						 const uuid_t *uuid);
 
-image_desc_t *lookup_image_desc_from_opt(struct fip_state *fip, char **arg);
+struct fip_image_desc *lookup_image_desc_from_opt(struct fip_state *fip, char **arg);
 
 int parse_fip(struct fip_state *fip,
 		     const char *filename, fip_toc_header_t *toc_header_out);
diff --git a/lib/fip.c b/lib/fip.c
index ae7ff8b3ad..e7589ff4c2 100644
--- a/lib/fip.c
+++ b/lib/fip.c
@@ -26,10 +26,10 @@
 #include <fip.h>
 #include <fiptool.h>
 
-image_desc_t *new_image_desc(const uuid_t *uuid,
+struct fip_image_desc *new_image_desc(const uuid_t *uuid,
 			     const char *name, const char *cmdline_name)
 {
-	image_desc_t *desc;
+	struct fip_image_desc *desc;
 
 	desc = xzalloc(sizeof(*desc));
 	memcpy(&desc->uuid, uuid, sizeof(uuid_t));
@@ -39,7 +39,7 @@ image_desc_t *new_image_desc(const uuid_t *uuid,
 	return desc;
 }
 
-void set_image_desc_action(image_desc_t *desc, int action,
+void set_image_desc_action(struct fip_image_desc *desc, int action,
     const char *arg)
 {
 	ASSERT(desc != NULL);
@@ -52,7 +52,7 @@ void set_image_desc_action(image_desc_t *desc, int action,
 		desc->action_arg = xstrdup(arg);
 }
 
-void free_image_desc(image_desc_t *desc)
+void free_image_desc(struct fip_image_desc *desc)
 {
 	free(desc->name);
 	free(desc->cmdline_name);
@@ -64,9 +64,9 @@ void free_image_desc(image_desc_t *desc)
 	free(desc);
 }
 
-void add_image_desc(struct fip_state *fip, image_desc_t *desc)
+void add_image_desc(struct fip_state *fip, struct fip_image_desc *desc)
 {
-	image_desc_t **p = &fip->image_desc_head;
+	struct fip_image_desc **p = &fip->image_desc_head;
 
 	while (*p)
 		p = &(*p)->next;
@@ -78,7 +78,7 @@ void add_image_desc(struct fip_state *fip, image_desc_t *desc)
 
 void free_image_descs(struct fip_state *fip)
 {
-	image_desc_t *desc = fip->image_desc_head, *tmp;
+	struct fip_image_desc *desc = fip->image_desc_head, *tmp;
 
 	while (desc != NULL) {
 		tmp = desc->next;
@@ -96,7 +96,7 @@ void fill_image_descs(struct fip_state *fip)
 	for (toc_entry = toc_entries;
 	     toc_entry->cmdline_name != NULL;
 	     toc_entry++) {
-		image_desc_t *desc;
+		struct fip_image_desc *desc;
 
 		desc = new_image_desc(&toc_entry->uuid,
 		    toc_entry->name,
@@ -106,7 +106,7 @@ void fill_image_descs(struct fip_state *fip)
 	for (toc_entry = plat_def_toc_entries;
 	     toc_entry->cmdline_name != NULL;
 	     toc_entry++) {
-		image_desc_t *desc;
+		struct fip_image_desc *desc;
 
 		desc = new_image_desc(&toc_entry->uuid,
 		    toc_entry->name,
@@ -115,10 +115,10 @@ void fill_image_descs(struct fip_state *fip)
 	}
 }
 
-image_desc_t *lookup_image_desc_from_uuid(struct fip_state *fip,
+struct fip_image_desc *lookup_image_desc_from_uuid(struct fip_state *fip,
 						 const uuid_t *uuid)
 {
-	image_desc_t *desc;
+	struct fip_image_desc *desc;
 
 	for (desc = fip->image_desc_head; desc != NULL; desc = desc->next)
 		if (memcmp(&desc->uuid, uuid, sizeof(uuid_t)) == 0)
@@ -126,10 +126,10 @@ image_desc_t *lookup_image_desc_from_uuid(struct fip_state *fip,
 	return NULL;
 }
 
-image_desc_t *lookup_image_desc_from_opt(struct fip_state *fip, char **arg)
+struct fip_image_desc *lookup_image_desc_from_opt(struct fip_state *fip, char **arg)
 {
 	int len = 0;
-	image_desc_t *desc;
+	struct fip_image_desc *desc;
 	char *eq;
 
 	eq = strchrnul(*arg, '=');
@@ -200,8 +200,8 @@ int parse_fip(struct fip_state *fip,
 
 	/* Walk through each ToC entry in the file. */
 	while ((char *)toc_entry + sizeof(*toc_entry) - 1 < bufend) {
-		image_t *image;
-		image_desc_t *desc;
+		struct fip_image *image;
+		struct fip_image_desc *desc;
 
 		/* Found the ToC terminator, we are done. */
 		if (memcmp(&toc_entry->uuid, &uuid_null, sizeof(uuid_t)) == 0) {
@@ -260,10 +260,10 @@ int parse_fip(struct fip_state *fip,
 	return 0;
 }
 
-static image_t *read_image_from_file(const uuid_t *uuid, const char *filename)
+static struct fip_image *read_image_from_file(const uuid_t *uuid, const char *filename)
 {
 	struct stat st;
-	image_t *image;
+	struct fip_image *image;
 	int fd;
 
 	ASSERT(uuid != NULL);
@@ -298,7 +298,7 @@ int pack_images(struct fip_state *fip,
 		uint64_t toc_flags, unsigned long align)
 {
 	int fd;
-	image_desc_t *desc;
+	struct fip_image_desc *desc;
 	fip_toc_header_t *toc_header;
 	fip_toc_entry_t *toc_entry;
 	char *buf;
@@ -325,7 +325,7 @@ int pack_images(struct fip_state *fip,
 
 	entry_offset = buf_size;
 	for (desc = fip->image_desc_head; desc != NULL; desc = desc->next) {
-		image_t *image = desc->image;
+		struct fip_image *image = desc->image;
 
 		if (image == NULL || (image->toc_e.size == 0ULL))
 			continue;
@@ -361,7 +361,7 @@ int pack_images(struct fip_state *fip,
 	pr_verbose("Payload size: %llu bytes\n", payload_size);
 
 	for (desc = fip->image_desc_head; desc != NULL; desc = desc->next) {
-		image_t *image = desc->image;
+		struct fip_image *image = desc->image;
 
 		if (image == NULL)
 			continue;
@@ -396,11 +396,11 @@ int pack_images(struct fip_state *fip,
  */
 int update_fip(struct fip_state *fip)
 {
-	image_desc_t *desc;
+	struct fip_image_desc *desc;
 
 	/* Add or replace images in the FIP file. */
 	for (desc = fip->image_desc_head; desc != NULL; desc = desc->next) {
-		image_t *image;
+		struct fip_image *image;
 
 		if (desc->action != DO_PACK)
 			continue;

-- 
2.39.5





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux