Whamcloud - gitweb
LU-6803 gss: add printf format checking to __logmsg{,_gss}()
[fs/lustre-release.git] / lustre / utils / gss / lgss_utils.h
index 01405e6..51a8f45 100644 (file)
@@ -43,8 +43,6 @@
 #include <stdint.h>
 #include <gssapi/gssapi.h>
 
-#include <libcfs/libcfs.h>
-
 #define LGSS_SVC_MGS_STR        "lustre_mgs"
 #define LGSS_SVC_MDS_STR        "lustre_mds"
 #define LGSS_SVC_OSS_STR        "lustre_oss"
@@ -96,19 +94,22 @@ extern loglevel_t g_log_level;
 
 void lgss_set_loglevel(loglevel_t level);
 
-void __logmsg(loglevel_t level, const char *func, const char *format, ...);
+void __logmsg(loglevel_t level, const char *func, const char *format, ...)
+       __attribute__((format(printf, 3, 4)));
+
 void __logmsg_gss(loglevel_t level, const char *func, const gss_OID mech,
-                  uint32_t major, uint32_t minor, const char *format, ...);
+                 uint32_t major, uint32_t minor, const char *format, ...)
+       __attribute__((format(printf, 6, 7)));
 
 #define logmsg(loglevel, format, args...)                               \
 do {                                                                    \
-        if (unlikely(loglevel <= g_log_level))                          \
+       if (loglevel <= g_log_level)                                    \
                 __logmsg(loglevel, __FUNCTION__, format, ##args);       \
 } while (0)
 
 #define logmsg_gss(loglevel, mech, major, minor, format, args...)       \
 do {                                                                    \
-        if (unlikely(loglevel <= g_log_level))                          \
+       if (loglevel <= g_log_level)                                    \
                 __logmsg_gss(loglevel, __FUNCTION__, mech,              \
                              major, minor, format, ##args);             \
 } while (0)
@@ -127,8 +128,8 @@ do {                                                                    \
 #define printerr(priority, format, args...)                             \
         logmsg(priority, format, ##args)
 
-#define pgsserr(msg, maj_stat, min_stat, mech)                          \
-        logmsg_gss(LL_ERR, mech, maj_stat, min_stat, "")
+#define pgsserr(msg, maj_stat, min_stat, mech)                         \
+       logmsg_gss(LL_ERR, mech, maj_stat, min_stat, msg)
 
 /****************************************
  * GSS MECH, OIDs                       *