|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] tools/libxc: Drop xc_cpuid_to_str()
commit d9e0cb858ebbb1003d926963d2d5e77ab30697ca
Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Wed Jun 27 12:35:08 2018 +0000
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Mon Jul 2 18:04:21 2018 +0100
tools/libxc: Drop xc_cpuid_to_str()
This helper appears to have been introduced 10 years ago by c/s 5f14a87ceb
"x86, hvm: Guest CPUID configuration" and never had any users at all.
alloc_str() is actually an opencoded calloc(), and now only has a single
caller. Use calloc() directly and drop alloc_str().
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
tools/libxc/include/xenctrl.h | 2 --
tools/libxc/xc_cpuid_x86.c | 25 +------------------------
2 files changed, 1 insertion(+), 26 deletions(-)
diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 408fa1c6a4..e8285dbb5f 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -1828,8 +1828,6 @@ int xc_cpuid_apply_policy(xc_interface *xch,
uint32_t domid,
uint32_t *featureset,
unsigned int nr_features);
-void xc_cpuid_to_str(const unsigned int *regs,
- char **strs); /* some strs[] may be NULL if ENOMEM */
int xc_mca_op(xc_interface *xch, struct xen_mc *mc);
int xc_mca_op_inject_v2(xc_interface *xch, unsigned int flags,
xc_cpumap_t cpumap, unsigned int nr_cpus);
diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index eb2e2db569..a6e84f6fbe 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -627,29 +627,6 @@ static int xc_cpuid_do_domctl(
return do_domctl(xch, &domctl);
}
-static char *alloc_str(void)
-{
- char *s = malloc(33);
- if ( s == NULL )
- return s;
- memset(s, 0, 33);
- return s;
-}
-
-void xc_cpuid_to_str(const unsigned int *regs, char **strs)
-{
- int i, j;
-
- for ( i = 0; i < 4; i++ )
- {
- strs[i] = alloc_str();
- if ( strs[i] == NULL )
- continue;
- for ( j = 0; j < 32; j++ )
- strs[i][j] = !!((regs[i] & (1U << (31 - j)))) ? '1' : '0';
- }
-}
-
static void sanitise_featureset(struct cpuid_domain_info *info)
{
const uint32_t fs_size = xc_get_cpu_featureset_size();
@@ -823,7 +800,7 @@ int xc_cpuid_set(
continue;
}
- config_transformed[i] = alloc_str();
+ config_transformed[i] = calloc(33, 1); /* 32 bits, NUL terminator. */
if ( config_transformed[i] == NULL )
{
rc = -ENOMEM;
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |