utils: rename strtosz to use qemu prefix

Not only it makes sense, but it gets rid of checkpatch warning:
WARNING: consider using qemu_strtosz in preference to strtosz

Also remove get rid of tabs to please checkpatch.

Backports commit 4677bb40f809394bef5fa07329dea855c0371697 from qemu
This commit is contained in:
Marc-André Lureau 2018-02-22 00:16:43 -05:00 committed by Lioncash
parent d9fdc180d7
commit fff79ed49b
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
17 changed files with 31 additions and 57 deletions

View file

@ -2651,8 +2651,6 @@
#define strongarm_cp_reginfo strongarm_cp_reginfo_aarch64
#define strpadcpy strpadcpy_aarch64
#define strstart strstart_aarch64
#define strtosz strtosz_aarch64
#define strtosz_suffix strtosz_suffix_aarch64
#define stw_be_p stw_be_p_aarch64
#define stw_be_phys stw_be_phys_aarch64
#define stw_he_p stw_he_p_aarch64

View file

@ -2651,8 +2651,6 @@
#define strongarm_cp_reginfo strongarm_cp_reginfo_aarch64eb
#define strpadcpy strpadcpy_aarch64eb
#define strstart strstart_aarch64eb
#define strtosz strtosz_aarch64eb
#define strtosz_suffix strtosz_suffix_aarch64eb
#define stw_be_p stw_be_p_aarch64eb
#define stw_be_phys stw_be_phys_aarch64eb
#define stw_he_p stw_he_p_aarch64eb

View file

@ -2651,8 +2651,6 @@
#define strongarm_cp_reginfo strongarm_cp_reginfo_arm
#define strpadcpy strpadcpy_arm
#define strstart strstart_arm
#define strtosz strtosz_arm
#define strtosz_suffix strtosz_suffix_arm
#define stw_be_p stw_be_p_arm
#define stw_be_phys stw_be_phys_arm
#define stw_he_p stw_he_p_arm

View file

@ -2651,8 +2651,6 @@
#define strongarm_cp_reginfo strongarm_cp_reginfo_armeb
#define strpadcpy strpadcpy_armeb
#define strstart strstart_armeb
#define strtosz strtosz_armeb
#define strtosz_suffix strtosz_suffix_armeb
#define stw_be_p stw_be_p_armeb
#define stw_be_phys stw_be_phys_armeb
#define stw_he_p stw_he_p_armeb

View file

@ -2657,8 +2657,6 @@ symbols = (
'strongarm_cp_reginfo',
'strpadcpy',
'strstart',
'strtosz',
'strtosz_suffix',
'stw_be_p',
'stw_be_phys',
'stw_he_p',

View file

@ -156,23 +156,24 @@ int qemu_strtol(const char *nptr, const char **endptr, int base,
/*
* strtosz() suffixes used to specify the default treatment of an
* argument passed to strtosz() without an explicit suffix.
* qemu_strtosz() suffixes used to specify the default treatment of an
* argument passed to qemu_strtosz() without an explicit suffix.
* These should be defined using upper case characters in the range
* A-Z, as strtosz() will use qemu_toupper() on the given argument
* A-Z, as qemu_strtosz() will use qemu_toupper() on the given argument
* prior to comparison.
*/
#define STRTOSZ_DEFSUFFIX_EB 'E'
#define STRTOSZ_DEFSUFFIX_PB 'P'
#define STRTOSZ_DEFSUFFIX_TB 'T'
#define STRTOSZ_DEFSUFFIX_GB 'G'
#define STRTOSZ_DEFSUFFIX_MB 'M'
#define STRTOSZ_DEFSUFFIX_KB 'K'
#define STRTOSZ_DEFSUFFIX_B 'B'
int64_t strtosz(const char *nptr, char **end);
int64_t strtosz_suffix(const char *nptr, char **end, const char default_suffix);
int64_t strtosz_suffix_unit(const char *nptr, char **end,
const char default_suffix, int64_t unit);
#define QEMU_STRTOSZ_DEFSUFFIX_EB 'E'
#define QEMU_STRTOSZ_DEFSUFFIX_PB 'P'
#define QEMU_STRTOSZ_DEFSUFFIX_TB 'T'
#define QEMU_STRTOSZ_DEFSUFFIX_GB 'G'
#define QEMU_STRTOSZ_DEFSUFFIX_MB 'M'
#define QEMU_STRTOSZ_DEFSUFFIX_KB 'K'
#define QEMU_STRTOSZ_DEFSUFFIX_B 'B'
int64_t qemu_strtosz(const char *nptr, char **end);
int64_t qemu_strtosz_suffix(const char *nptr, char **end,
const char default_suffix);
int64_t qemu_strtosz_suffix_unit(const char *nptr, char **end,
const char default_suffix, int64_t unit);
/* used to print char* safely */
#define STR_OR_NULL(str) ((str) ? (str) : "null")

View file

@ -2651,8 +2651,6 @@
#define strongarm_cp_reginfo strongarm_cp_reginfo_m68k
#define strpadcpy strpadcpy_m68k
#define strstart strstart_m68k
#define strtosz strtosz_m68k
#define strtosz_suffix strtosz_suffix_m68k
#define stw_be_p stw_be_p_m68k
#define stw_be_phys stw_be_phys_m68k
#define stw_he_p stw_he_p_m68k

View file

@ -2651,8 +2651,6 @@
#define strongarm_cp_reginfo strongarm_cp_reginfo_mips
#define strpadcpy strpadcpy_mips
#define strstart strstart_mips
#define strtosz strtosz_mips
#define strtosz_suffix strtosz_suffix_mips
#define stw_be_p stw_be_p_mips
#define stw_be_phys stw_be_phys_mips
#define stw_he_p stw_he_p_mips

View file

@ -2651,8 +2651,6 @@
#define strongarm_cp_reginfo strongarm_cp_reginfo_mips64
#define strpadcpy strpadcpy_mips64
#define strstart strstart_mips64
#define strtosz strtosz_mips64
#define strtosz_suffix strtosz_suffix_mips64
#define stw_be_p stw_be_p_mips64
#define stw_be_phys stw_be_phys_mips64
#define stw_he_p stw_he_p_mips64

View file

@ -2651,8 +2651,6 @@
#define strongarm_cp_reginfo strongarm_cp_reginfo_mips64el
#define strpadcpy strpadcpy_mips64el
#define strstart strstart_mips64el
#define strtosz strtosz_mips64el
#define strtosz_suffix strtosz_suffix_mips64el
#define stw_be_p stw_be_p_mips64el
#define stw_be_phys stw_be_phys_mips64el
#define stw_he_p stw_he_p_mips64el

View file

@ -2651,8 +2651,6 @@
#define strongarm_cp_reginfo strongarm_cp_reginfo_mipsel
#define strpadcpy strpadcpy_mipsel
#define strstart strstart_mipsel
#define strtosz strtosz_mipsel
#define strtosz_suffix strtosz_suffix_mipsel
#define stw_be_p stw_be_p_mipsel
#define stw_be_phys stw_be_phys_mipsel
#define stw_he_p stw_he_p_mipsel

View file

@ -2651,8 +2651,6 @@
#define strongarm_cp_reginfo strongarm_cp_reginfo_powerpc
#define strpadcpy strpadcpy_powerpc
#define strstart strstart_powerpc
#define strtosz strtosz_powerpc
#define strtosz_suffix strtosz_suffix_powerpc
#define stw_be_p stw_be_p_powerpc
#define stw_be_phys stw_be_phys_powerpc
#define stw_he_p stw_he_p_powerpc

View file

@ -2651,8 +2651,6 @@
#define strongarm_cp_reginfo strongarm_cp_reginfo_sparc
#define strpadcpy strpadcpy_sparc
#define strstart strstart_sparc
#define strtosz strtosz_sparc
#define strtosz_suffix strtosz_suffix_sparc
#define stw_be_p stw_be_p_sparc
#define stw_be_phys stw_be_phys_sparc
#define stw_he_p stw_he_p_sparc

View file

@ -2651,8 +2651,6 @@
#define strongarm_cp_reginfo strongarm_cp_reginfo_sparc64
#define strpadcpy strpadcpy_sparc64
#define strstart strstart_sparc64
#define strtosz strtosz_sparc64
#define strtosz_suffix strtosz_suffix_sparc64
#define stw_be_p stw_be_p_sparc64
#define stw_be_phys stw_be_phys_sparc64
#define stw_he_p stw_he_p_sparc64

View file

@ -1965,8 +1965,8 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char *features,
char *err;
char num[32];
tsc_freq = strtosz_suffix_unit(val, &err,
STRTOSZ_DEFSUFFIX_B, 1000);
tsc_freq = qemu_strtosz_suffix_unit(val, &err,
QEMU_STRTOSZ_DEFSUFFIX_B, 1000);
if (tsc_freq < 0 || *err) {
error_setg(errp, "bad numerical value %s", val);
return;

View file

@ -129,19 +129,19 @@ char *qemu_strsep(char **input, const char *delim)
static int64_t suffix_mul(char suffix, int64_t unit)
{
switch (qemu_toupper(suffix)) {
case STRTOSZ_DEFSUFFIX_B:
case QEMU_STRTOSZ_DEFSUFFIX_B:
return 1;
case STRTOSZ_DEFSUFFIX_KB:
case QEMU_STRTOSZ_DEFSUFFIX_KB:
return unit;
case STRTOSZ_DEFSUFFIX_MB:
case QEMU_STRTOSZ_DEFSUFFIX_MB:
return unit * unit;
case STRTOSZ_DEFSUFFIX_GB:
case QEMU_STRTOSZ_DEFSUFFIX_GB:
return unit * unit * unit;
case STRTOSZ_DEFSUFFIX_TB:
case QEMU_STRTOSZ_DEFSUFFIX_TB:
return unit * unit * unit * unit;
case STRTOSZ_DEFSUFFIX_PB:
case QEMU_STRTOSZ_DEFSUFFIX_PB:
return unit * unit * unit * unit * unit;
case STRTOSZ_DEFSUFFIX_EB:
case QEMU_STRTOSZ_DEFSUFFIX_EB:
return unit * unit * unit * unit * unit * unit;
}
return -1;
@ -153,8 +153,8 @@ static int64_t suffix_mul(char suffix, int64_t unit)
* in *end, if not NULL. Return -ERANGE on overflow, Return -EINVAL on
* other error.
*/
int64_t strtosz_suffix_unit(const char *nptr, char **end,
const char default_suffix, int64_t unit)
int64_t qemu_strtosz_suffix_unit(const char *nptr, char **end,
const char default_suffix, int64_t unit)
{
int64_t retval = -EINVAL;
char *endptr;
@ -196,12 +196,13 @@ fail:
return retval;
}
int64_t strtosz_suffix(const char *nptr, char **end, const char default_suffix)
int64_t qemu_strtosz_suffix(const char *nptr, char **end,
const char default_suffix)
{
return strtosz_suffix_unit(nptr, end, default_suffix, 1024);
return qemu_strtosz_suffix_unit(nptr, end, default_suffix, 1024);
}
int64_t strtosz(const char *nptr, char **end)
int64_t qemu_strtosz(const char *nptr, char **end)
{
return strtosz_suffix(nptr, end, STRTOSZ_DEFSUFFIX_MB);
return qemu_strtosz_suffix(nptr, end, QEMU_STRTOSZ_DEFSUFFIX_MB);
}

View file

@ -2651,8 +2651,6 @@
#define strongarm_cp_reginfo strongarm_cp_reginfo_x86_64
#define strpadcpy strpadcpy_x86_64
#define strstart strstart_x86_64
#define strtosz strtosz_x86_64
#define strtosz_suffix strtosz_suffix_x86_64
#define stw_be_p stw_be_p_x86_64
#define stw_be_phys stw_be_phys_x86_64
#define stw_he_p stw_he_p_x86_64