Whamcloud - gitweb
Branch HEAD
authorscjody <scjody>
Sat, 28 Apr 2007 01:49:11 +0000 (01:49 +0000)
committerscjody <scjody>
Sat, 28 Apr 2007 01:49:11 +0000 (01:49 +0000)
Type-check arguments against format string in CDEBUG/CERROR, fix warnings
introduced.

Original patch by adilger.

b=12327
i=green
i=isaac

lustre/include/lustre_dlm.h
lustre/include/lustre_net.h
lustre/llite/rw26.c
lustre/obdclass/llog_lvfs.c
lustre/obdclass/obd_config.c
lustre/tests/test_brw.c

index c0184e8..632b7bb 100644 (file)
@@ -398,15 +398,16 @@ extern char *ldlm_it2str(int it);
 
 void _ldlm_lock_debug(struct ldlm_lock *lock, __u32 mask,
                       struct libcfs_debug_msg_data *data, const char *fmt,
 
 void _ldlm_lock_debug(struct ldlm_lock *lock, __u32 mask,
                       struct libcfs_debug_msg_data *data, const char *fmt,
-                      ...);
+                      ...)
+        __attribute__ ((format (printf, 4, 5)));
 
 #define LDLM_ERROR(lock, fmt, a...) do {                                 \
         static cfs_debug_limit_state_t _ldlm_cdls;                       \
         ldlm_lock_debug(&_ldlm_cdls, D_ERROR, lock,                      \
                         __FILE__, __FUNCTION__, __LINE__,                \
                         "### " fmt , ##a);                               \
 
 #define LDLM_ERROR(lock, fmt, a...) do {                                 \
         static cfs_debug_limit_state_t _ldlm_cdls;                       \
         ldlm_lock_debug(&_ldlm_cdls, D_ERROR, lock,                      \
                         __FILE__, __FUNCTION__, __LINE__,                \
                         "### " fmt , ##a);                               \
-  } while (0)
-  
+} while (0)
+
 #define LDLM_DEBUG(lock, fmt, a...)   do {                              \
         ldlm_lock_debug(NULL, D_DLMTRACE, lock,                         \
                         __FILE__, __FUNCTION__, __LINE__,               \
 #define LDLM_DEBUG(lock, fmt, a...)   do {                              \
         ldlm_lock_debug(NULL, D_DLMTRACE, lock,                         \
                         __FILE__, __FUNCTION__, __LINE__,               \
index cb942bb..0e9b401 100644 (file)
@@ -402,43 +402,44 @@ ptlrpc_rqphase2str(struct ptlrpc_request *req)
 /* Spare the preprocessor, spoil the bugs. */
 #define FLAG(field, str) (field ? str : "")
 
 /* Spare the preprocessor, spoil the bugs. */
 #define FLAG(field, str) (field ? str : "")
 
-#define DEBUG_REQ_FLAGS(req)                                                    \
-        ptlrpc_rqphase2str(req),                                                \
-        FLAG(req->rq_intr, "I"), FLAG(req->rq_replied, "R"),                    \
-        FLAG(req->rq_err, "E"),                                                 \
-        FLAG(req->rq_timedout, "X") /* eXpired */, FLAG(req->rq_resend, "S"),   \
-        FLAG(req->rq_restart, "T"), FLAG(req->rq_replay, "P"),                  \
-        FLAG(req->rq_no_resend, "N"),                                           \
+#define DEBUG_REQ_FLAGS(req)                                                  \
+        ptlrpc_rqphase2str(req),                                              \
+        FLAG(req->rq_intr, "I"), FLAG(req->rq_replied, "R"),                  \
+        FLAG(req->rq_err, "E"),                                               \
+        FLAG(req->rq_timedout, "X") /* eXpired */, FLAG(req->rq_resend, "S"), \
+        FLAG(req->rq_restart, "T"), FLAG(req->rq_replay, "P"),                \
+        FLAG(req->rq_no_resend, "N"),                                         \
         FLAG(req->rq_waiting, "W")
 
 #define REQ_FLAGS_FMT "%s:%s%s%s%s%s%s%s%s%s"
 
 void _debug_req(struct ptlrpc_request *req, __u32 mask,
         FLAG(req->rq_waiting, "W")
 
 #define REQ_FLAGS_FMT "%s:%s%s%s%s%s%s%s%s%s"
 
 void _debug_req(struct ptlrpc_request *req, __u32 mask,
-               struct libcfs_debug_msg_data *data, const char *fmt, ...);
-
-#define debug_req(cdls, level, req, file, func, line, fmt, a...)                \
-do {                                                                            \
-        CHECK_STACK();                                                          \
-                                                                                \
-        if (((level) & D_CANTMASK) != 0 ||                                      \
-            ((libcfs_debug & (level)) != 0 &&                                   \
-             (libcfs_subsystem_debug & DEBUG_SUBSYSTEM) != 0)) {                \
-                static struct libcfs_debug_msg_data _req_dbg_data =             \
-                DEBUG_MSG_DATA_INIT(cdls, DEBUG_SUBSYSTEM, file, func, line);   \
-                _debug_req((req), (level), &_req_dbg_data, fmt, ##a);           \
-        }                                                                       \
+                struct libcfs_debug_msg_data *data, const char *fmt, ...)
+        __attribute__ ((format (printf, 4, 5)));
+
+#define debug_req(cdls, level, req, file, func, line, fmt, a...)              \
+do {                                                                          \
+        CHECK_STACK();                                                        \
+                                                                              \
+        if (((level) & D_CANTMASK) != 0 ||                                    \
+            ((libcfs_debug & (level)) != 0 &&                                 \
+             (libcfs_subsystem_debug & DEBUG_SUBSYSTEM) != 0)) {              \
+                static struct libcfs_debug_msg_data _req_dbg_data =           \
+                DEBUG_MSG_DATA_INIT(cdls, DEBUG_SUBSYSTEM, file, func, line); \
+                _debug_req((req), (level), &_req_dbg_data, fmt, ##a);         \
+        }                                                                     \
 } while(0)
 
 /* for most callers (level is a constant) this is resolved at compile time */
 } while(0)
 
 /* for most callers (level is a constant) this is resolved at compile time */
-#define DEBUG_REQ(level, req, fmt, args...)                                    \
-do {                                                                           \
-        if ((level) & (D_ERROR | D_WARNING)) {                                 \
-                static cfs_debug_limit_state_t cdls;                           \
-                debug_req(&cdls, level, req, __FILE__, __func__, __LINE__,     \
-                          "@@@ "fmt, ## args);                                 \
-        } else                                                                 \
-                debug_req(NULL, level, req, __FILE__, __func__, __LINE__,      \
-                          "@@@ "fmt, ## args);                                 \
+#define DEBUG_REQ(level, req, fmt, args...)                                   \
+do {                                                                          \
+        if ((level) & (D_ERROR | D_WARNING)) {                                \
+            static cfs_debug_limit_state_t cdls;                              \
+            debug_req(&cdls, level, req, __FILE__, __func__, __LINE__,        \
+                      "@@@ "fmt" ", ## args);                                 \
+        } else                                                                \
+            debug_req(NULL, level, req, __FILE__, __func__, __LINE__,         \
+                      "@@@ "fmt" ", ## args);                                 \
 } while (0)
 
 struct ptlrpc_bulk_page {
 } while (0)
 
 struct ptlrpc_bulk_page {
index 4852d43..4fb767f 100644 (file)
@@ -204,8 +204,8 @@ static ssize_t ll_direct_IO_26(int rw, struct kiocb *iocb,
         if ((file_offset & (~CFS_PAGE_MASK)) || (count & ~CFS_PAGE_MASK))
                 RETURN(-EINVAL);
 
         if ((file_offset & (~CFS_PAGE_MASK)) || (count & ~CFS_PAGE_MASK))
                 RETURN(-EINVAL);
 
-        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), size="LPSZ" (max "LPSZ
-               "), offset=%lld=%llx, pages "LPSZ" (max "LPSZ")\n",
+        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), size="LPSZ" (max %lu), "
+               "offset=%lld=%llx, pages "LPSZ" (max %lu)\n",
                inode->i_ino, inode->i_generation, inode, count, MAX_DIO_SIZE,
                file_offset, file_offset, count >> CFS_PAGE_SHIFT,
                MAX_DIO_SIZE >> CFS_PAGE_SHIFT);
                inode->i_ino, inode->i_generation, inode, count, MAX_DIO_SIZE,
                file_offset, file_offset, count >> CFS_PAGE_SHIFT,
                MAX_DIO_SIZE >> CFS_PAGE_SHIFT);
index 6c287b3..53260c5 100644 (file)
@@ -267,8 +267,8 @@ static int llog_lvfs_write_rec(struct llog_handle *loghandle,
                                "modify record "LPX64": idx:%d/%u/%d, len:%u "
                                "offset %llu\n",
                                loghandle->lgh_id.lgl_oid, idx, rec->lrh_index,
                                "modify record "LPX64": idx:%d/%u/%d, len:%u "
                                "offset %llu\n",
                                loghandle->lgh_id.lgl_oid, idx, rec->lrh_index,
-                               loghandle->lgh_cur_idx,
-                               rec->lrh_len, saved_offset - sizeof(*llh));
+                               loghandle->lgh_cur_idx, rec->lrh_len,
+                               (long long)(saved_offset - sizeof(*llh)));
                         if (rec->lrh_index != loghandle->lgh_cur_idx) {
                                 CERROR("modify idx mismatch %u/%d\n",
                                        idx, loghandle->lgh_cur_idx);
                         if (rec->lrh_index != loghandle->lgh_cur_idx) {
                                 CERROR("modify idx mismatch %u/%d\n",
                                        idx, loghandle->lgh_cur_idx);
index cba4460..86bf791 100644 (file)
@@ -860,14 +860,14 @@ int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars,
                 }    
                 if (!matched) {
                         CERROR("%s: unknown param %s\n",
                 }    
                 if (!matched) {
                         CERROR("%s: unknown param %s\n",
-                               lustre_cfg_string(lcfg, 0), key);
+                               (char *)lustre_cfg_string(lcfg, 0), key);
                         rc = -EINVAL;
                         /* continue parsing other params */
                 } else {
                         LCONSOLE_INFO("%s.%.*s: set parameter %.*s=%s\n", 
                         rc = -EINVAL;
                         /* continue parsing other params */
                 } else {
                         LCONSOLE_INFO("%s.%.*s: set parameter %.*s=%s\n", 
-                                      lustre_cfg_string(lcfg, 0),
-                                      strlen(prefix) - 1, prefix,
-                                      sval - key - 1, key, sval);
+                                      (char *)lustre_cfg_string(lcfg, 0),
+                                      (int)strlen(prefix) - 1, prefix,
+                                      (int)(sval - key - 1), key, sval);
                 }
         }
         
                 }
         }
         
index d225b47..0e5605e 100644 (file)
@@ -81,7 +81,7 @@ int main(int argc, char **argv)
 {
         int fd;
         char *buf;
 {
         int fd;
         char *buf;
-        loff_t count, last, offset;
+        long long count, last, offset;
         long pg_vec, len;
         __u64 objid;
         struct stat st;
         long pg_vec, len;
         __u64 objid;
         struct stat st;
@@ -152,8 +152,8 @@ int main(int argc, char **argv)
                 objid = 3;
         }
 
                 objid = 3;
         }
 
-        printf("%s: %s on %s(objid "LPX64") for "LPSZ"x%ld pages \n",
-               argv[0], 
+        printf("%s: %s on %s(objid "LPX64") for %llux%ld pages \n",
+               argv[0],
 #ifdef O_DIRECT
                flags & O_DIRECT ? "directio" : "i/o",
 #else
 #ifdef O_DIRECT
                flags & O_DIRECT ? "directio" : "i/o",
 #else