Whamcloud - gitweb
LU-6803 gss: add printf format checking to __logmsg{,_gss}()
[fs/lustre-release.git] / lustre / utils / gss / lgss_utils.h
index b5b96b0..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                       *
@@ -167,13 +168,14 @@ enum {
 };
 
 struct lgss_cred {
-        int                     lc_uid;
-        unsigned int            lc_root_flags;
-        uint64_t                lc_tgt_nid;
-        uint32_t                lc_tgt_svc;
-
-        struct lgss_mech_type  *lc_mech;
-        void                   *lc_mech_cred;
+       int                     lc_uid;
+       unsigned int            lc_root_flags;
+       uint64_t                lc_self_nid;
+       uint64_t                lc_tgt_nid;
+       uint32_t                lc_tgt_svc;
+
+       struct lgss_mech_type  *lc_mech;
+       void                   *lc_mech_cred;
 };
 
 struct lgss_mech_type *lgss_name2mech(const char *mech_name);