[coreboot-gerrit] New patch to review for coreboot: b7b6d12 cbfstool: Don't typedef the comp_algo enum
Sol Boucher (solb@chromium.org)
gerrit at coreboot.org
Fri May 8 20:28:27 CEST 2015
Sol Boucher (solb at chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10146
-gerrit
commit b7b6d1269b37076d2f687eba23c9c2531eb38354
Author: Sol Boucher <solb at chromium.org>
Date: Thu May 7 21:12:28 2015 -0700
cbfstool: Don't typedef the comp_algo enum
Our style discourages unnecessary typedefs, and this one doesn't gain
us anything, nor is it consistent with the surrounding code: there's
a function pointer typedef'd nearby, but non-opaque structs aren't.
BUG=chromium:482652
TEST=None
BRANCH=None
Change-Id: Ie7565240639e5b1aeebb08ea005099aaa3557a27
Signed-off-by: Sol Boucher <solb at chromium.org>
Original-Change-Id: I4285e6b56f99b85b9684f2b98b35e9b35a6c4cb7
Original-Signed-off-by: Sol Boucher <solb at chromium.org>
---
util/cbfstool/cbfs-mkpayload.c | 8 ++++----
util/cbfstool/cbfs-mkstage.c | 2 +-
util/cbfstool/cbfs-payload-linux.c | 6 +++---
util/cbfstool/cbfstool.c | 2 +-
util/cbfstool/common.h | 16 ++++++++--------
util/cbfstool/compress.c | 2 +-
6 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/util/cbfstool/cbfs-mkpayload.c b/util/cbfstool/cbfs-mkpayload.c
index 6eebbef..5bebf51 100644
--- a/util/cbfstool/cbfs-mkpayload.c
+++ b/util/cbfstool/cbfs-mkpayload.c
@@ -68,7 +68,7 @@ void xdr_get_seg(struct cbfs_payload_segment *out,
}
int parse_elf_to_payload(const struct buffer *input, struct buffer *output,
- comp_algo algo)
+ enum comp_algo algo)
{
Elf64_Phdr *phdr;
Elf64_Ehdr ehdr;
@@ -249,7 +249,7 @@ int parse_flat_binary_to_payload(const struct buffer *input,
struct buffer *output,
uint32_t loadaddress,
uint32_t entrypoint,
- comp_algo algo)
+ enum comp_algo algo)
{
comp_func_ptr compress;
struct cbfs_payload_segment segs[2];
@@ -293,8 +293,8 @@ int parse_flat_binary_to_payload(const struct buffer *input,
return 0;
}
-int parse_fv_to_payload(const struct buffer *input,
- struct buffer *output, comp_algo algo)
+int parse_fv_to_payload(const struct buffer *input, struct buffer *output,
+ enum comp_algo algo)
{
comp_func_ptr compress;
struct cbfs_payload_segment segs[2];
diff --git a/util/cbfstool/cbfs-mkstage.c b/util/cbfstool/cbfs-mkstage.c
index f8a39bc..d8ca7ac 100644
--- a/util/cbfstool/cbfs-mkstage.c
+++ b/util/cbfstool/cbfs-mkstage.c
@@ -95,7 +95,7 @@ static Elf64_Shdr *find_ignored_section_header(struct parsed_elf *pelf,
* works for all elf files, not just the restricted set.
*/
int parse_elf_to_stage(const struct buffer *input, struct buffer *output,
- comp_algo algo, uint32_t *location,
+ enum comp_algo algo, uint32_t *location,
const char *ignore_section)
{
struct parsed_elf pelf;
diff --git a/util/cbfstool/cbfs-payload-linux.c b/util/cbfstool/cbfs-payload-linux.c
index 9e9a874..0a230b2 100644
--- a/util/cbfstool/cbfs-payload-linux.c
+++ b/util/cbfstool/cbfs-payload-linux.c
@@ -51,14 +51,14 @@ struct bzpayload {
struct buffer cmdline;
struct buffer initrd;
/* Output variables. */
- comp_algo algo;
+ enum comp_algo algo;
comp_func_ptr compress;
struct buffer output;
size_t offset;
struct cbfs_payload_segment *out_seg;
};
-static int bzp_init(struct bzpayload *bzp, comp_algo algo)
+static int bzp_init(struct bzpayload *bzp, enum comp_algo algo)
{
memset(bzp, 0, sizeof(*bzp));
@@ -203,7 +203,7 @@ static void bzp_output_segment(struct bzpayload *bzp, struct buffer *b,
*/
int parse_bzImage_to_payload(const struct buffer *input,
struct buffer *output, const char *initrd_name,
- char *cmdline, comp_algo algo)
+ char *cmdline, enum comp_algo algo)
{
struct bzpayload bzp;
unsigned int initrd_base = 64*1024*1024;
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index 4cf343f..11353b6 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -75,7 +75,7 @@ static struct param {
bool fill_partial_downward;
bool show_immutable;
int fit_empty_entries;
- comp_algo algo;
+ enum comp_algo algo;
/* for linux payloads */
char *initrd;
char *cmdline;
diff --git a/util/cbfstool/common.h b/util/cbfstool/common.h
index 392ec80..ddec1a7 100644
--- a/util/cbfstool/common.h
+++ b/util/cbfstool/common.h
@@ -154,28 +154,28 @@ const char *arch_to_string(uint32_t a);
uint32_t string_to_arch(const char *arch_string);
typedef int (*comp_func_ptr) (char *, int, char *, int *);
-typedef enum { CBFS_COMPRESS_NONE = 0, CBFS_COMPRESS_LZMA = 1 } comp_algo;
+enum comp_algo { CBFS_COMPRESS_NONE = 0, CBFS_COMPRESS_LZMA = 1 };
-comp_func_ptr compression_function(comp_algo algo);
+comp_func_ptr compression_function(enum comp_algo algo);
uint64_t intfiletype(const char *name);
/* cbfs-mkpayload.c */
int parse_elf_to_payload(const struct buffer *input, struct buffer *output,
- comp_algo algo);
-int parse_fv_to_payload(const struct buffer *input,
- struct buffer *output, comp_algo algo);
+ enum comp_algo algo);
+int parse_fv_to_payload(const struct buffer *input, struct buffer *output,
+ enum comp_algo algo);
int parse_bzImage_to_payload(const struct buffer *input,
struct buffer *output, const char *initrd,
- char *cmdline, comp_algo algo);
+ char *cmdline, enum comp_algo algo);
int parse_flat_binary_to_payload(const struct buffer *input,
struct buffer *output,
uint32_t loadaddress,
uint32_t entrypoint,
- comp_algo algo);
+ enum comp_algo algo);
/* cbfs-mkstage.c */
int parse_elf_to_stage(const struct buffer *input, struct buffer *output,
- comp_algo algo, uint32_t *location,
+ enum comp_algo algo, uint32_t *location,
const char *ignore_section);
void print_supported_filetypes(void);
diff --git a/util/cbfstool/compress.c b/util/cbfstool/compress.c
index 5b916ce..9f865fb 100644
--- a/util/cbfstool/compress.c
+++ b/util/cbfstool/compress.c
@@ -38,7 +38,7 @@ static int none_compress(char *in, int in_len, char *out, int *out_len)
return 0;
}
-comp_func_ptr compression_function(comp_algo algo)
+comp_func_ptr compression_function(enum comp_algo algo)
{
comp_func_ptr compress;
switch (algo) {
More information about the coreboot-gerrit
mailing list