Re: [PATCH v4 15/25] ibnbd: private headers with IBNBD protocol structs and helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/16/19 8:39 AM, Jinpu Wang wrote:
- Roman's pb emal address, it's no longer valid, will fix next round.



+static inline const char *ibnbd_io_mode_str(enum ibnbd_io_mode mode)
+{
+     switch (mode) {
+     case IBNBD_FILEIO:
+             return "fileio";
+     case IBNBD_BLOCKIO:
+             return "blockio";
+     case IBNBD_AUTOIO:
+             return "autoio";
+     default:
+             return "unknown";
+     }
+}
+
+static inline const char *ibnbd_access_mode_str(enum ibnbd_access_mode mode)
+{
+     switch (mode) {
+     case IBNBD_ACCESS_RO:
+             return "ro";
+     case IBNBD_ACCESS_RW:
+             return "rw";
+     case IBNBD_ACCESS_MIGRATION:
+             return "migration";
+     default:
+             return "unknown";
+     }
+}

These two functions are not in the hot path and hence should not be
inline functions.
Sounds reasonable, will remove the inline.
inline was added to fix the -Wunused-function warning  eg:

   CC [M]  /<<PKGBUILDDIR>>/ibnbd/ibnbd-clt.o
In file included from /<<PKGBUILDDIR>>/ibnbd/ibnbd-clt.h:34,
                  from /<<PKGBUILDDIR>>/ibnbd/ibnbd-clt.c:33:
/<<PKGBUILDDIR>>/ibnbd/ibnbd-proto.h:362:20: warning:
'ibnbd_access_mode_str' defined but not used [-Wunused-function]
  static const char *ibnbd_access_mode_str(enum ibnbd_access_mode mode)
                     ^~~~~~~~~~~~~~~~~~~~~
/<<PKGBUILDDIR>>/ibnbd/ibnbd-proto.h:348:20: warning:
'ibnbd_io_mode_str' defined but not used [-Wunused-function]
  static const char *ibnbd_io_mode_str(enum ibnbd_io_mode mode)

We have to move both functions to a separate header file if we really
want to do it.
The function is simple and small, if you insist, I will do it.

Please move these functions into a .c file. That will reduce the size of the kernel modules and will also reduce the size of the header file.

Thanks,

Bart.




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux