From: Alexander Clouter <alex@digriz.org.uk>
To: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
linux-mips <linux-mips@linux-mips.org>,
Manuel Lauss <manuel.lauss@gmail.com>,
Sam Ravnborg <sam@ravnborg.org>
Subject: Re: [PATCH v2] MIPS: Clean up the calculation of VMLINUZ_LOAD_ADDRESS
Date: Tue, 1 Jun 2010 14:41:53 +0100 [thread overview]
Message-ID: <20100601134153.GK2519@chipmunk> (raw)
In-Reply-To: <1275397916-6401-1-git-send-email-wuzhangjin@gmail.com>
Hi,
* Wu Zhangjin <wuzhangjin@gmail.com> [2010-06-01 21:11:56+0800]:
>
> Changes:
>
> v1 -> v2:
> o make it more portable (feedback from Alexander Clouter)
> use EXIT_SUCCESS and EXIT_FAILURE as the return value, and use uint64_t
> instead of "unsigned long long".
> o add a missing return value (feedback from Alexander Clouter)
> return EXIT_FAILURE if (n != 1).
>
> We have calculated VMLINUZ_LOAD_ADDRESS in shell, which is awful. This patch
> rewrites it in C.
>
s/awful/indecipherable/
:)
> Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
> ---
> arch/mips/boot/.gitignore | 1 +
> arch/mips/boot/compressed/Makefile | 22 ++++----
> arch/mips/boot/compressed/calc_vmlinuz_load_addr.c | 55 ++++++++++++++++++++
> 3 files changed, 66 insertions(+), 12 deletions(-)
> create mode 100644 arch/mips/boot/compressed/calc_vmlinuz_load_addr.c
>
> diff --git a/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c b/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c
> new file mode 100644
> index 0000000..81176b1
> --- /dev/null
> +++ b/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c
> @@ -0,0 +1,55 @@
>
> [snipped]
>
> +
> + /* Convert hex characters to dec number */
> + errno = 0;
> + n = sscanf(argv[2], "%llx", &vmlinux_load_addr);
> + if (n != 1) {
>
you can drop the 'n' with:
if (sscanf(argv[2], "%llx", &vmlinux_load_addr) != 1) {
> + if (errno != 0)
> + perror("sscanf");
> + else
> + fprintf(stderr, "No matching characters\n");
> +
> + return EXIT_FAILURE;
> + }
> +
> + vmlinux_size = (unsigned long long)sb.st_size;
>
I'm guessing this should probably be uint64_t also?
Other than that, makes me happy :)
Cheers
--
Alexander Clouter
.sigmonster says: And furthermore, my bowling average is unimpeachable!!!
next prev parent reply other threads:[~2010-06-01 13:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-01 13:11 [PATCH v2] MIPS: Clean up the calculation of VMLINUZ_LOAD_ADDRESS Wu Zhangjin
2010-06-01 13:41 ` Alexander Clouter [this message]
2010-06-01 13:50 ` wu zhangjin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100601134153.GK2519@chipmunk \
--to=alex@digriz.org.uk \
--cc=linux-mips@linux-mips.org \
--cc=manuel.lauss@gmail.com \
--cc=ralf@linux-mips.org \
--cc=sam@ravnborg.org \
--cc=wuzhangjin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox