From 8a89322715d349920afb2ab9bf01949f09ee50db Mon Sep 17 00:00:00 2001 From: Wanlong Gao Date: Sat, 17 Dec 2011 22:43:08 +0800 Subject: [PATCH] kvm tools: change the binary name from kvm to lkvm in print message Introduce a new macro KVM_BINARY_NAME for the binary name of kvm tools, also for future using in printing command messages like these. Signed-off-by: Wanlong Gao Signed-off-by: Pekka Enberg --- tools/kvm/builtin-help.c | 7 ++++--- tools/kvm/builtin-run.c | 6 ++++-- tools/kvm/builtin-setup.c | 11 ++++++----- tools/kvm/include/kvm/kvm.h | 1 + 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/tools/kvm/builtin-help.c b/tools/kvm/builtin-help.c index d02e8394fdaf..5970fb7484f6 100644 --- a/tools/kvm/builtin-help.c +++ b/tools/kvm/builtin-help.c @@ -7,6 +7,7 @@ #include #include #include +#include const char kvm_usage_string[] = @@ -25,7 +26,7 @@ static void list_common_cmds_help(void) longest = strlen(common_cmds[i].name); } - puts(" The most commonly used kvm commands are:"); + puts(" The most commonly used lkvm commands are:"); for (i = 0; i < ARRAY_SIZE(common_cmds); i++) { printf(" %-*s ", longest, common_cmds[i].name); puts(common_cmds[i].help); @@ -34,8 +35,8 @@ static void list_common_cmds_help(void) static void kvm_help(void) { - printf("\n To start a simple non-privileged shell run 'kvm run'\n\n" - "usage: %s\n\n", kvm_usage_string); + printf("\n To start a simple non-privileged shell run '%s run'\n\n" + "usage: %s\n\n", KVM_BINARY_NAME, kvm_usage_string); list_common_cmds_help(); printf("\n %s\n\n", kvm_more_info_string); } diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c index 3881a7da2dd3..fac274c233cc 100644 --- a/tools/kvm/builtin-run.c +++ b/tools/kvm/builtin-run.c @@ -641,7 +641,8 @@ static void kernel_usage_with_options(void) fprintf(stderr, "\t%s\n", kernel); k++; } - fprintf(stderr, "\nPlease see 'kvm run --help' for more options.\n\n"); + fprintf(stderr, "\nPlease see '%s run --help' for more options.\n\n", + KVM_BINARY_NAME); } static u64 host_ram_size(void) @@ -1043,7 +1044,8 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix) virtio_blk__init_all(kvm); } - printf(" # kvm run -k %s -m %Lu -c %d --name %s\n", kernel_filename, ram_size / 1024 / 1024, nrcpus, guest_name); + printf(" # %s run -k %s -m %Lu -c %d --name %s\n", KVM_BINARY_NAME, + kernel_filename, ram_size / 1024 / 1024, nrcpus, guest_name); if (!kvm__load_kernel(kvm, kernel_filename, initrd_filename, real_cmdline, vidmode)) diff --git a/tools/kvm/builtin-setup.c b/tools/kvm/builtin-setup.c index f90a4d58f0f9..dd43fed94274 100644 --- a/tools/kvm/builtin-setup.c +++ b/tools/kvm/builtin-setup.c @@ -46,9 +46,9 @@ static void parse_setup_options(int argc, const char **argv) void kvm_setup_help(void) { - printf("\nkvm setup creates a new rootfs under %s.\n" - "This can be used later by the '-d' parameter of 'kvm run'.\n", - kvm__get_dir()); + printf("\n%s setup creates a new rootfs under %s.\n" + "This can be used later by the '-d' parameter of '%s run'.\n", + kvm__get_dir(), KVM_BINARY_NAME, KVM_BINARY_NAME); usage_with_options(setup_usage, setup_options); } @@ -221,8 +221,9 @@ int kvm_cmd_setup(int argc, const char **argv, const char *prefix) if (r == 0) printf("A new rootfs '%s' has been created in '%s%s'.\n\n" "You can now start it by running the following command:\n\n" - " kvm run -d %s\n", - instance_name, kvm__get_dir(), instance_name, instance_name); + " %s run -d %s\n", + instance_name, kvm__get_dir(), instance_name, + KVM_BINARY_NAME,instance_name); else printf("Unable to create rootfs in %s%s: %s\n", kvm__get_dir(), instance_name, strerror(errno)); diff --git a/tools/kvm/include/kvm/kvm.h b/tools/kvm/include/kvm/kvm.h index 8a0c01d2d18a..75adb25e66c2 100644 --- a/tools/kvm/include/kvm/kvm.h +++ b/tools/kvm/include/kvm/kvm.h @@ -13,6 +13,7 @@ #define KVM_PID_FILE_PATH "/.kvm-tools/" #define HOME_DIR getenv("HOME") +#define KVM_BINARY_NAME "lkvm" #define PAGE_SIZE (sysconf(_SC_PAGE_SIZE)) -- 2.39.5