From: Yi Sun Date: Mon, 4 Sep 2017 11:01:44 +0000 (+0800) Subject: tools: change the type of '*nr' in 'libxl_psr_cat_get_info' X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=65c256266477e72f455a45a54597d5816646c74f;p=people%2Froyger%2Fxen.git tools: change the type of '*nr' in 'libxl_psr_cat_get_info' Due to historical reason, type of parameter '*nr' in 'libxl_psr_cat_get_info' is 'int'. But this is not right. It should be 'unsigned int'. This patch fixes this and does related changes. Suggested-by: Roger Pau Monné Signed-off-by: Yi Sun Acked-by: Wei Liu --- diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 9e5f99dfd0..91408b47b5 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -2224,7 +2224,7 @@ int libxl_psr_cat_get_cbm(libxl_ctx *ctx, uint32_t domid, * and the length in 'nr'. */ int libxl_psr_cat_get_info(libxl_ctx *ctx, libxl_psr_cat_info **info, - int *nr, unsigned int lvl); + unsigned int *nr, unsigned int lvl); int libxl_psr_cat_get_l3_info(libxl_ctx *ctx, libxl_psr_cat_info **info, int *nr); void libxl_psr_cat_info_list_free(libxl_psr_cat_info *list, int nr); diff --git a/tools/libxl/libxl_psr.c b/tools/libxl/libxl_psr.c index f55ba1e690..197505a1e0 100644 --- a/tools/libxl/libxl_psr.c +++ b/tools/libxl/libxl_psr.c @@ -362,7 +362,7 @@ int libxl_psr_cat_get_cbm(libxl_ctx *ctx, uint32_t domid, } int libxl_psr_cat_get_info(libxl_ctx *ctx, libxl_psr_cat_info **info, - int *nr, unsigned int lvl) + unsigned int *nr, unsigned int lvl) { GC_INIT(ctx); int rc; @@ -410,8 +410,11 @@ int libxl_psr_cat_get_l3_info(libxl_ctx *ctx, libxl_psr_cat_info **info, int *nr) { int rc; + unsigned int num; - rc = libxl_psr_cat_get_info(ctx, info, nr, 3); + rc = libxl_psr_cat_get_info(ctx, info, &num, 3); + if (!rc) + *nr = num; return rc; } diff --git a/tools/xl/xl_psr.c b/tools/xl/xl_psr.c index 544f6f0cc2..ef00048409 100644 --- a/tools/xl/xl_psr.c +++ b/tools/xl/xl_psr.c @@ -294,8 +294,8 @@ int main_psr_cmt_show(int argc, char **argv) static int psr_l3_cat_hwinfo(void) { - int rc, nr; - unsigned int i; + int rc; + unsigned int i, nr; uint32_t l3_cache_size; libxl_psr_cat_info *info; @@ -424,7 +424,7 @@ static int psr_cat_print_socket(uint32_t domid, libxl_psr_cat_info *info, static int psr_cat_show(uint32_t domid, unsigned int lvl) { - int i, nr; + unsigned int i, nr; int rc; libxl_psr_cat_info *info; @@ -453,8 +453,7 @@ out: static int psr_l2_cat_hwinfo(void) { int rc; - unsigned int i; - int nr; + unsigned int i, nr; libxl_psr_cat_info *info; rc = libxl_psr_cat_get_info(ctx, &info, &nr, 2);