]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rbd: fix unused function warning when WITH_KRBD is disabled
authorKefu Chai <tchaikov@gmail.com>
Tue, 24 Jun 2025 14:38:13 +0000 (22:38 +0800)
committerKefu Chai <tchaikov@gmail.com>
Tue, 24 Jun 2025 14:44:16 +0000 (22:44 +0800)
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 <tchaikov@gmail.com>
src/tools/rbd/action/Kernel.cc

index 117f9492d0918b86e6fee7ee31c15247cd85d336..49bb33a58f9489afac43ca9ab72e35a350eb2eb9 100644 (file)
@@ -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,