Skip to content

Commit 9362ecc

Browse files
committed
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 <[email protected]>
1 parent 555b14f commit 9362ecc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/tools/rbd/action/Kernel.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ static int do_kernel_list(Formatter *f) {
270270
#endif
271271
}
272272

273+
#ifdef WITH_KRBD
273274
static int get_unsupported_features(librbd::Image &image,
274275
uint64_t *unsupported_features)
275276
{
@@ -373,6 +374,7 @@ static void print_error_description(const char *poolname,
373374
done:
374375
std::cout << "In some cases useful info is found in syslog - try \"dmesg | tail\"." << std::endl;
375376
}
377+
#endif
376378

377379
static int do_kernel_map(const char *poolname, const char *nspace_name,
378380
const char *imgname, const char *snapname,

0 commit comments

Comments
 (0)