From: Kefu Chai Date: Tue, 24 Jun 2025 14:38:13 +0000 (+0800) Subject: rbd: fix unused function warning when WITH_KRBD is disabled X-Git-Tag: testing/wip-vshankar-testing-20250625.095802-debug~9^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=9362ecc36407186182be2a967422a8bca1467cc9;p=ceph-ci.git rbd: fix unused function warning when WITH_KRBD is disabled Guard print_error_description() and get_unsupported_features() with `#ifdef WITH_KRBD` to prevent compiler warnings when KRBD support is not enabled. These functions are only called by do_kernel_map(), which is itself conditionally compiled. When WITH_KRBD is not defined, the compiler generates unused function warnings for these helper functions. Fixes warning: ``` /home/kefu/dev/ceph/src/tools/rbd/action/Kernel.cc:305:13: warning: ‘void rbd::action::kernel::print_error_description(const char*, const char*, const char*, const char*, int)’ defined but not used [-Wunused-function] 305 | static void print_error_description(const char *poolname, | ^~~~~~~~~~~~~~~~~~~~~~~ ``` this silences the warning. Signed-off-by: Kefu Chai --- diff --git a/src/tools/rbd/action/Kernel.cc b/src/tools/rbd/action/Kernel.cc index 117f9492d09..49bb33a58f9 100644 --- a/src/tools/rbd/action/Kernel.cc +++ b/src/tools/rbd/action/Kernel.cc @@ -270,6 +270,7 @@ static int do_kernel_list(Formatter *f) { #endif } +#ifdef WITH_KRBD static int get_unsupported_features(librbd::Image &image, uint64_t *unsupported_features) { @@ -373,6 +374,7 @@ static void print_error_description(const char *poolname, done: std::cout << "In some cases useful info is found in syslog - try \"dmesg | tail\"." << std::endl; } +#endif static int do_kernel_map(const char *poolname, const char *nspace_name, const char *imgname, const char *snapname,